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

Can't reinit Podman inside WSL2 #15107

Closed
delucca opened this issue Jul 28, 2022 · 7 comments
Closed

Can't reinit Podman inside WSL2 #15107

delucca opened this issue Jul 28, 2022 · 7 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. windows issue/bug on Windows

Comments

@delucca
Copy link

delucca commented Jul 28, 2022

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

I tried to use Podman within my setup (Windows 11 + WSL2) but was having issues while trying to connect with a container from Windows.

I found this reply, so I updated my Podman version to 4.1.1 and, after that, I ran:

podman machine init

Them:

podman machine start

After the machine start command, I received the following error:

Starting machine "podman-machine-default"
Waiting for VM ...
Error: dial unix /mnt/wslg/runtime-dir/podman/podman-machine-default_ready.sock: connect: connection refused

I've already tried to change the permissions of /dev/kvm to 666, but the issue remains.

What should I do? Even with 4.1.1 if I run a Podman container I can connect with its port from within Linux, but I can't access it from Windows.

Steps to reproduce the issue:

N/A

Describe the results you received:

After running podman machine start

Starting machine "podman-machine-default"
Waiting for VM ...
Error: dial unix /mnt/wslg/runtime-dir/podman/podman-machine-default_ready.sock: connect: connection refused

Describe the results you expected:

To be able to interact with my containers ports from the Windows side

Additional information you deem important (e.g. issue happens only occasionally):

Output of podman version:

podman version 4.1.1

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.26.1
  cgroupControllers: []
  cgroupManager: cgroupfs
  cgroupVersion: v1
  conmon:
    package: conmon-2.1.3-1.fc35.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.3, commit: '
  cpuUtilization:
    idlePercent: 99.68
    systemPercent: 0.14
    userPercent: 0.18
  cpus: 16
  distribution:
    distribution: fedora
    variant: container
    version: "35"
  eventLogger: file
  hostname: delucca-laptop
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
  kernel: 5.10.102.1-microsoft-standard-WSL2
  linkmode: dynamic
  logDriver: k8s-file
  memFree: 10320986112
  memTotal: 16642248704
  networkBackend: netavark
  ociRuntime:
    name: crun
    package: crun-1.5-1.fc35.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 1.5
      commit: 54ebb8ca8bf7e6ddae2eb919f5b82d1d96863dea
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    path: /mnt/wslg/runtime-dir/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.1.12-2.fc35.x86_64
    version: |-
      slirp4netns version 1.1.12
      commit: 7a104a101aa3278a2152351a082a6df71f57c9a3
      libslirp: 4.6.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.3
  swapFree: 4294967296
  swapTotal: 4294967296
  uptime: 5h 25m 0.77s (Approximately 0.21 days)
plugins:
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries:
  search:
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - docker.io
  - quay.io
store:
  configFile: /home/delucca/.config/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/delucca/.local/share/containers/storage
  graphRootAllocated: 269490393088
  graphRootUsed: 85515636736
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 22
  runRoot: /mnt/wslg/runtime-dir/containers
  volumePath: /home/delucca/.local/share/containers/storage/volumes
version:
  APIVersion: 4.1.1
  Built: 1658515434
  BuiltTime: Fri Jul 22 15:43:54 2022
  GitCommit: ""
  GoVersion: go1.16.15
  Os: linux
  OsArch: linux/amd64
  Version: 4.1.1

Package info (e.g. output of rpm -q podman or apt list podman):

podman-4.1.1-1.fc35.x86_64

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

Additional environment details (AWS, VirtualBox, physical, etc.):

@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label Jul 28, 2022
@n1hility
Copy link
Member

Hi @delucca am I correct in that you are running podman machine init and start within WSL2? Those commands need to be run on your Windows host in powershell / windows terminal.

See the tutorial here: https://github.com/containers/podman/blob/main/docs/tutorials/podman-for-windows.md

@delucca
Copy link
Author

delucca commented Jul 29, 2022

hi @n1hility thanks!

I've followed the steps under the tutorial. I've installed podman on Windows, but how can I access and use that podman machine inside WSL?

For example (like I do with Docker), Podman is running on Windows, and I've a WSL machine running, so I can execute Podman inside my WSL machine that will use the Podman machine hosted in Windows?

@gbraad
Copy link
Member

gbraad commented Aug 3, 2022

WSL does not allow nested virtualization, so starting machine inside WSL2 will not work.

I am not so sure what you mean with 'use podman machine inside WSL'. You mean to use the podman command inside the debian/ubuntu environment to handle the WSL2 Fedora environment?

Have you tried setting the Docker host inside the WSL2 environment?

DOCKER_HOST='npipe:////./pipe/podman-machine-default' podman ls

Note: unable to test atm.

@delucca
Copy link
Author

delucca commented Aug 3, 2022

WSL does not allow nested virtualization, so starting machine inside WSL2 will not work.

I am not so sure what you mean with 'use podman machine inside WSL'. You mean to use the podman command inside the debian/ubuntu environment to handle the WSL2 Fedora environment?

Have you tried setting the Docker host inside the WSL2 environment?

DOCKER_HOST='npipe:////./pipe/podman-machine-default' podman ls

Note: unable to test atm.

Docker works (as expected) inside WSL2. To achieve this I need to install Docker in the Windows Machine, and it creates a socket that can be used within WSL2

In any case, I've decided to move away from WSL and go back to Linux. I had several problems with WSL2 (mainly related to the filesystem and USB in general), so this issue is no longer relevant (at least for me)

@gbraad
Copy link
Member

gbraad commented Aug 4, 2022

I forgot that we run win-sshproxy for this, so a system connection might have been able to use podman as a remote client. WSL2 is not the same as an actual VM, as it also does not run systemd ATM, which means the init process uses workarounds to make it run daemon services. One of the reasons I still use a dedicated VM alongside on the same machine, ...

I will record that this needs to be described (new issue). Can you otherwise close this one as the described practice is not recommended.


$ podman system connection add podman-machine ssh://user@localhost:56852/run/user/1000/podman/podman.sock

where the port is based on the host's connection:

PS> podman.exe system connection ls

and make sure you share the keys with the other WSL environment to allow password-less (key-based) authentication.

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@n1hility
Copy link
Member

Closing since there was no underlying bug.

@rhatdan rhatdan closed this as completed Sep 26, 2022
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 14, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. windows issue/bug on Windows
Projects
None yet
Development

No branches or pull requests

5 participants