-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If initializing a machine fails, it should not be added to the list of machines #15154
Comments
@ashley-cui PTAL |
it seems also that the machine is added to the list of machines before the machine is fully ready. Machine is becoming listed as a podman machine so in another terminal we can do so we can have errors like
|
I think this is because list just goes through the machine directory and unmarshalls machine jsons, if the machine json exists, then podman machine recognizes the machine as "exists". Would the solution here be removing the machine json automatically if the init fails? Something like if the init returns an error, automatically do a rm of the machine? |
That seems reasonable to me. We don't want to leave around broken configuration. |
@ashley-cui and probably the machine needs to be listed in For example I can launch |
So I guess we solve the issue by both having a "ready" state for a machine, as well as removing the config file immediately on a failed init? I'm not sure if we should check for ready status on a podman machine list though, this seems like it could create issues where there are ghost machines that the user doesn't know exists. |
A few of us were discussing this on chat. For the next couple of days my bandwidth is limited and won't be able to work on a patch, but @gbraad might have some cycles to help out if you need that @ashley-cui. A couple thoughts:
|
SGTM, will try to take a look, but I don't have a windows box for testing. Will try to get as far as possible with this :) |
I reproduced it easily with a VM having https://developer.microsoft.com/en-us/windows/downloads/virtual-machines/ as by default there is no nested virtualization enabled by default on most of virtualization products But I can also test some custom podman binaries that I can build from source code. |
BTW there was some changes to the Makefile process that make cross-building the msi a little finicky. I can push up a build if needed (or test something as well) without much effort. just ping me |
It is specific to the WSL2 provider as the This also happens when you break out during the Doing the following: diff --git a/pkg/machine/wsl/machine.go b/pkg/machine/wsl/machine.go
index 189723ac7..bc0c5b400 100644
--- a/pkg/machine/wsl/machine.go
+++ b/pkg/machine/wsl/machine.go
@@ -349,14 +349,6 @@ func (v *MachineVM) Init(opts machine.InitOptions) (bool, error) {
return false, err
}
- if err := v.writeConfig(); err != nil {
- return false, err
- }
-
- if err := setupConnections(v, opts, sshDir); err != nil {
- return false, err
- }
-
dist, err := provisionWSLDist(v)
if err != nil {
return false, err
@@ -375,6 +367,14 @@ func (v *MachineVM) Init(opts machine.InitOptions) (bool, error) {
return false, err
}
+ if err := v.writeConfig(); err != nil {
+ return false, err
+ }
+
+ if err := setupConnections(v, opts, sshDir); err != nil {
+ return false, err
+ }
+
return true, nil
}
would work |
…ritten When the break out or the WSL environment fails to start, the config and connections should not be written. Placing them at the end of the provisioning step will mitigate the issue. [NO NEW TESTS NEEDED] Signed-off-by: Gerard Braad <[email protected]>
Fixes #15154 Change order when config and connections are written
…ritten When the break out or the WSL environment fails to start, the config and connections should not be written. Placing them at the end of the provisioning step will mitigate the issue. [NO NEW TESTS NEEDED] Signed-off-by: Gerard Braad <[email protected]>
this is still an issue for me.
running but now I ran |
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
on Windows, if I use the msi and I don't have all requirements (like hyper-v installed, etc)
Calling
podman machine init
is giving an error but the machine is inserted as a "podman machine"and then if I call
podman machine list
I can see a machineas it's listed as a stopped machine we can try start
and we have errors as well but if machine is not added it might be better.
And if I reboot after enabling virtualization the machine still fails to start so it's corrupted and should not be there.
Creating a new one works
Steps to reproduce the issue:
Windows 11 without nested virtualization enabled.
podman machine init
podman machine list
Describe the results you received:
a machine is listed
Describe the results you expected:
no machine as initialization failed.
Additional information you deem important (e.g. issue happens only occasionally):
Output of
podman version
:Output of
podman info --debug
:Package info (e.g. output of
rpm -q podman
orapt list podman
):Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/main/troubleshooting.md)
Yes/No
Additional environment details (AWS, VirtualBox, physical, etc.):
The text was updated successfully, but these errors were encountered: