Skip to content
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

Creating a podman machine with user mode networking leaves a stranded wsl machine #25302

Open
danivilla9 opened this issue Feb 12, 2025 · 7 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. machine windows issue/bug on Windows

Comments

@danivilla9
Copy link

Issue Description

When I create a podman machine with user mode networking enabled, it creates a wsl machine alongside that persists after deleting the original podman machine. Is this expected behavior? Because it has proved to be a problem in podman desktop.

Steps to reproduce the issue

Steps to reproduce the issue

  1. Create a podman machine with user mode networking enabled: podman machine init --user-mode-networking
  2. List wsl connections: wsl --list (podman-net-usermode and podman-machine-default are there)
  3. Stop the podman machine: podman machine stop podman-machine-default
  4. Remove the podman machine: podman machine rm -f podman-machine-default
  5. List wsl connections again: wsl --list (podman-net-usermode is still there)

Describe the results you received

podman-net-usermode wsl machine persists after deleting the podman machine that needed it

Describe the results you expected

podman-net-usermode is deleted alongside the podman machine that needed it

podman info output

OS: windows/amd64
provider: wsl
version: 5.3.2

Podman in a container

No

Privileged Or Rootless

Rootless

Upstream Latest Release

Yes

Additional environment details

No response

Additional information

No response

@danivilla9 danivilla9 added the kind/bug Categorizes issue or PR as related to a bug. label Feb 12, 2025
@Luap99 Luap99 added machine windows issue/bug on Windows labels Feb 12, 2025
@baude
Copy link
Member

baude commented Feb 12, 2025

I think you are missing a step? somewhere between 1-3 there should be a start? Or at least ... no step 3?

@danivilla9
Copy link
Author

I think you are missing a step? somewhere between 1-3 there should be a start? Or at least ... no step 3?

Yeah, sorry, I forgot to add the start step, it got automatically started for me through Podman Desktop when I checked that the machine was found on the app and completely missed it

@l0rd
Copy link
Member

l0rd commented Feb 13, 2025

I was able to reproduce the problem. The curious thing is that both machines are started/stopped with podman machine start/stop, but only podman-machine-default is removed with podman machine rm.

@baude
Copy link
Member

baude commented Feb 13, 2025

i spoke with @n1hility about this yesterday; there is intent on this behavior. we did talk about whether the behavior can change and this was my take away:

  1. we can eliminate the wsl instance for usermode networking if no other wsl machines are using usermode networking.
  2. we may have a harder time (or impossible) to prevent removing the wsl instance in the case that they decided to use it for another wsl instance (outside of the context of podman machine).

So there is some risk to changing this behavior but I think if the consensus is that we should do this, then that is OK. One idea would be to remove it but have something like a --preserve option that would not remove the usermode instance. Maybe we are overthinking and we should just do it and see who compains?

@danivilla9
Copy link
Author

I don't have the data to prove this, but I think that the number of users with an unexpected and unused wsl machine in their devices should be way bigger than the number of users that "recycle" said wsl machine. And if a user wants to have a standalone wsl machine, they can create it explicitly for that purpose outside of the podman context, right?

@l0rd
Copy link
Member

l0rd commented Feb 14, 2025

I agree with @danivilla9; recycling user mode machine seems unlikely. That said, the --preserve option looks like a good compromise and something that we may mention when asking for confirmation of the machine removal:

PS > podman machine rm
The following files will be deleted:

(...)

+ Re-run this command with the `--preserve` flag to keep the `podman-net-usermode` machine.
 
Are you sure you want to continue? [y/N]

@Luap99
Copy link
Member

Luap99 commented Feb 14, 2025

I don't mind mind deleting it but it MUST be race free. How are you going to deal with the fact the one machine rm commands remove it while another machine is created with user mode networking or uses podman machine set --user-mode-networking? AFAIK we do not hold any global locks between machine create and remove so this requires a fair amount of locking to actually work reliably without introducing plenty of race conditions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. machine windows issue/bug on Windows
Projects
None yet
Development

No branches or pull requests

4 participants