podman
podman copied to clipboard
Automatic installation of WSL fails
Issue Description
If WSL isn't installed, and a user tries to run podman machine init on Windows, Podman tries to install WSL automatically. This flow is currently broken.
Steps to reproduce the issue
Steps to reproduce the issue
- Disable the Windows feature
VirtualMachinePlatformand reboot - (until #25522 get merged) Build podman from PR #25522
- Run
podman machine init
Describe the results you received
When machine init is run from an Admin terminal, the command fails with the error Error: could not enable Virtual Machine Feature: command dism [/online /enable-feature /featurename:VirtualMachinePlatform /all /norestart] failed: exit status 3010.
When machine init is run from a non-Admin terminal, the command fails because podman machine init is re-executed with elevated privileges and the hidden parameter --reexec. It fails when it tries to recreate the system connection with the same name (the system connection was already created before the WSL check).
Describe the results you expected
WSL should be enabled successfully
podman info output
OS: windows/amd64
provider: wsl
version: 5.5.0-dev
Cannot connect to Podman. Please verify your connection to the Linux system using `podman system connection list`, or try `podman machine init` and `podman machine start` to manage a new Linux VM
Error: unable to connect to Podman socket: Get "http://d/v5.5.0/libpod/_ping": dial unix /run/podman/podman.sock: connect: A socket operation encountered a dead network.
Podman in a container
No
Privileged Or Rootless
None
Upstream Latest Release
Yes
Additional environment details
Additional environment details
Additional information
Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting
I've been facing this issue since yesterday. The documentation clearly states that WSL will be setup automatically as a part of the podman machine init.
- First, the init process fails immediately if WSL is outdated/stock version is available. I had to manually update wsl to move to the next step.
- WSL's installation process itself is supposed to auto-enable some Windows Features, which usually works fine. Podman straight away fails due to features being unavailable, we have to do that manually.
....it seems like complete manual installation of WSL is still required for podman to be initiated successfully.
Kindly let me know if I am missing something in my setup, or if I am going wrong somewhere :)
@farhan-ct, this issue makes only sense if this PR gets merged. Without that, the machine init command always assumes that WSL is installed and the required Windows feature is enabled. Thank you for the feedback; I missed that the doc mentioned it, and we may need to remove it if we can't fix it in the short term.
It would also be helpful to catch error code 3010 from dism and just prompt the user to restart.
Had this error come up multiple times running podman machine init when it tried to automatically enable WSL2 - took me a while to figure out that error code 3010 just means "hey, that windows feature is installed, but I need a restart".