containers / podman-desktop

Podman Desktop - A graphical tool for developing on containers and Kubernetes
https://podman-desktop.io
Apache License 2.0
4.22k stars 264 forks source link

Switching default podman connection via Podman Desktop always uses rootless connection #7000

Closed xbabalov closed 3 weeks ago

xbabalov commented 3 weeks ago

Bug description

Creating/having a rootless machine makes all previously existing or new rootful machines implicitly rootless when they are used as default connections.

I wrote one way to reproduce but the outcome is the same no matter if the rootless machine was created first, last, or new rootful machine was created and connected after the rootless one. Any rootful machine default connection is always rootless unless manually swapped in CLI.

It can be fixed by deleting all of the machines. After deletion, starting a new rootful machine and setting its connection to default results in a rootful connection. Deleting only the rootless machine does not help.

Operating system

Windows 10

Installation Method

Installer from website/GitHub releases

Version

1.10.0

Steps to reproduce

  1. Install Podman Desktop and Podman
  2. Create a rootful machine and set its connection to default
  3. Assert the connection is rootful in CLI (podman system connection list)
  4. Stop the rootful machine and create a new rootless machine, set its connection to default
  5. Assert the connection is rootless in CLI
  6. Stop the rootless machine, restart the rootful machine and set its connection to default
  7. Assert the connection is rootful in CLI Actual result: the connection is rootless

Relevant log output

No response

Additional context

No response

benoitf commented 3 weeks ago

hi, what does mean " set its connection to default" what is the command you're executing

By default a machine contains both rootless and rootful socket and one is exposed to the socket on the host, and CLI is using system connection so toggling system connection to rootless or rootful is possible.

But here I don't know what you did in the steps

odockal commented 3 weeks ago

@benoitf It should be the dialog that appears in the UI when you are starting the machine that is different from the one that had the connection set (either rootful or rootless) to default.

odockal commented 3 weeks ago

@xbabalov @benoitf So, I would like to colaborate a bit on a reproducer:

  1. Create a podman machine (with default values) and let it start
  2. Assert: Machine is started, the socket connection used is correct: podman system connection ls show default true for podman-machine-default-root connection
  3. Stop the machine
  4. Create new machine called rootful, also keep all values default (rootful, start now)
  5. Assert: Machine is created
  6. User is offered a dialog to switch the defautl connection to the rootful machine which was jsut created - accept and confirm
  7. Assert: podman system connection ls shows that default true value is at rootful-root connection Actual: Default true value is at rootful connection -> which is rootless.
odockal commented 3 weeks ago

Problem might be the change between podman 4.x and 5.x in the content of the Machine config Json: https://github.com/containers/podman-desktop/blob/db8c457226f711a748acf5a87344de01511df3e1/extensions/podman/src/extension.ts#L405-L414

machineConfig.Rootful is undefined with podman v5.

This is new json content:

{
   "Created":"2024-04-30T12:57:55.2389544+02:00",
   "GvProxy":{
      "Debug":false,
      "MTU":0,
      "LogFile":"",
      "PidFile":"",
      "SSHPort":0
   },
   "HostUser":{
      "Rootful":true,
      "UID":1000,
      "HostUserModified":false
   },
   "LastUp":"2024-04-30T12:59:58.8456202+02:00",
   "Mounts":null,
   "Name":"podman-machine-default",
   "Resources":{
      "CPUs":2,
      "DiskSize":100,
      "Memory":2048,
      "USBs":[

      ]
   },
   "SSH":{
      "IdentityPath":"C:\\Users\\podmanqe\\.local\\share\\containers\\podman\\machine\\machine",
      "Port":64572,
      "RemoteUsername":"user"
   },
   "Version":1,
   "ImagePath":{
      "Path":"C:\\Users\\podmanqe\\.local\\share\\containers\\podman\\machine\\wsl\\podman-machine-default-amd64"
   },
   "WSLHypervisor":{
      "UserModeNetworking":false
   },
   "Starting":false
}
benoitf commented 3 weeks ago

AFAIK this issue was existing in all previous releases

odockal commented 3 weeks ago

yes.

benoitf commented 3 weeks ago

but yes probably related to podman v4 -> v5

benoitf commented 3 weeks ago

PR opened https://github.com/containers/podman-desktop/pull/7024