Podman Desktop treats running WSL machine as stopped and reassigns SSH port (native systemd detection failure)
On Windows with a WSL-backed Podman machine, podman machine list / podman machine inspect often report State=stopped even when:
wsl -l -vshowspodman-machine-defaultRunning- systemd is healthy inside the guest (
systemctl is-system-running→running) - rootful Podman API works (via SSH or
wsl -d … podman)
Podman Desktop then treats the machine as stopped and runs podman machine start, which under networkingMode=mirrored reassigns the SSH port (guest sshd already visible on Windows loopback), desyncs system connections, and fails with exit 125. A working stack is damaged by the “fix” Start.
This is a podman machine (Windows/WSL provider) bug; Desktop is the common trigger.
Root cause 1 — false negative in isRunning() / State()
WSL provider detects “running” approximately as:
SYSDPID=`ps -eo cmd,pid | grep -m 1 ^/lib/systemd/systemd | awk '{print $2}'`
# numeric PID > 0 ⇒ running
(see pkg/machine/wsl/declares.go sysdpid, used by isSystemdRunning / isRunning in pkg/machine/wsl/machine.go)
Modern machine images use native WSL systemd:
# /etc/wsl.conf inside podman-machine-default
[boot]
systemd=true
In that configuration, PID 1 typically appears as:
/sbin/init 1
(/sbin/init → ../lib/systemd/systemd), not as a cmd line starting with /lib/systemd/systemd.
So the grep matches nothing → State=stopped forever while the distro is fine.
The bootstrap script still assumes an older nested-systemd model:
ps -ef | grep -v grep | grep -q systemd && exit 0
nohup unshare … /lib/systemd/systemd &
With [boot] systemd=true, nested systemd is unnecessary, but Windows State() was never updated to treat real PID1 systemd as running.
Proof (guest)
$ ps -eo cmd,pid | head -3
CMD PID
/sbin/init 1
…
$ ps -eo cmd,pid | grep -m 1 ^/lib/systemd/systemd
# (no match)
$ systemctl is-system-running
running
Workaround that confirms the diagnosis
Run a long-lived process with argv0 exactly /lib/systemd/systemd and no extra args (so awk '{print $2}' is the PID), e.g.:
exec -a /lib/systemd/systemd /usr/bin/yes >/dev/null 2>&1
Then:
podman machine list→ Currently runningpodman machine start→unable to start …: already running(correct; does not reassign SSH)
Root cause 2 — Start reassigns SSH under mirrored networking
With %USERPROFILE%\.wslconfig:
[wsl2]
networkingMode=mirrored
Guest sshd listening on e.g. 0.0.0.0:49613 is also visible on Windows 127.0.0.1:49613.
podman machine start (believing the machine is stopped) logs:
detected port conflict on machine ssh port [49613], reassigning
It rewrites guest /etc/ssh/sshd_config Port and machine JSON / connections to a new port, but often does not align live sshd (or health checks the new dead port). Result:
API forwarding for Docker API clients is not available due to the following startup failures.
could not start api proxy since expected pipe is not available: podman-machine-default
Podman clients are still able to connect.
Error: machine did not transition into running state: ssh error: machine not in running state
Connections then point at a port nothing listens on until manually re-pinned.
Related issues (symptoms overlap; this report focuses on State() detection)
- https://github.com/containers/podman/issues/28341 — start failure, port reassignment, bootstrap/sshd races (closed as not planned; ARM64-framed)
- https://github.com/containers/podman/issues/22975 — mirrored networking + machine start / SSH
- https://github.com/containers/podman-desktop/issues/7588 — mirrored + Desktop
Steps to reproduce the issue
- Windows 11, WSL2, Podman 6.x Windows client, WSL machine
podman-machine-defaultcreated via Desktop or CLI (rootful). - Optional but makes Start destructive: set
networkingMode=mirroredin.wslconfig,wsl --shutdown, reboot stack. - Ensure guest has
[boot] systemd=true(default on current machine images). - Start the WSL distro without a successful
podman machine startlifecycle, e.g. cold boot thenwsl -d podman-machine-default -u root -- true, or leave distro running after a previous partial start. - Observe:
wsl -l -v→podman-machine-defaultRunningpodman machine inspect→State=stopped(without the argv0 shim)
- Run
podman machine startor click Start in Podman Desktop. - Observe port reassignment warning, exit 125, broken SSH URIs.
Describe the results you received
- False stopped while distro + systemd + podman are healthy.
- Desktop Start / machine start reassigns SSH, breaks CLI and Desktop, exit 125.
- Named-pipe API proxy messages are secondary fallout.
Describe the results you expected
State()/machine listreport running when WSL distro is up and systemd is the system manager (PID1), regardless of whetherpsshows/sbin/initor/lib/systemd/systemd.- If the machine is already effectively running,
machine startis a no-op (or only starts missing host pieces likewin-sshproxy), without reassigning SSH. - Under mirrored networking, a port already serving this machine’s sshd with the machine identity is not treated as a foreign conflict; if reassignment is required, restart sshd and wait until the new port listens before updating connections / health checks.
podman info output
Client:
APIVersion: 6.0.2
Built: 1784689050
BuiltTime: Wed Jul 22 12:57:30 2026
GitCommit: b28edb9ad70ce4317dc762ee9ce0a6d081d154e9
GoVersion: go1.26.5
Os: windows
OsArch: windows/amd64
Version: 6.0.2
host:
arch: amd64
buildahVersion: 1.44.1
cdiSpecDirs:
- /etc/cdi
- /var/run/cdi
cgroupControllers:
- cpuset
- cpu
- io
- memory
- hugetlb
- pids
- rdma
cgroupManager: systemd
cgroupVersion: v2
conmon:
package: conmon-2.2.1-2.fc44.x86_64
path: /usr/bin/conmon
version: 'conmon version 2.2.1, commit: '
cpuUtilization:
idlePercent: 94.68
systemPercent: 3.54
userPercent: 1.78
cpus: 32
databaseBackend: sqlite
distribution:
distribution: fedora
variant: podman-machine-os
version: "44"
emulatedArchitectures:
- linux/arm
- linux/arm64
- linux/arm64be
- linux/loong64
- linux/mips
- linux/mips64
- linux/ppc
- linux/ppc64
- linux/ppc64le
- linux/riscv32
- linux/riscv64
- linux/s390x
eventLogger: journald
freeLocks: 2034
hostname: Pegasus
idMappings:
gidmap: null
uidmap: null
kernel: 6.6.114.1-microsoft-standard-WSL2
linkmode: dynamic
logDriver: journald
memFree: 4942012416
memTotal: 16722706432
networkBackend: netavark
networkBackendInfo:
backend: netavark
defaultNetwork: podman
dns:
package: aardvark-dns-2.0.0-1.fc44.x86_64
path: /usr/libexec/podman/aardvark-dns
version: aardvark-dns 2.0.0
package: netavark-2.0.0-2.fc44.x86_64
path: /usr/libexec/podman/netavark
version: netavark 2.0.0
ociRuntime:
name: crun
package: crun-1.28-1.fc44.x86_64
path: /usr/bin/crun
version: |-
crun version 1.28
commit: 54f16ffbefcd022bf032af768b5c5ce075c18bfc
rundir: /run/crun
spec: 1.0.0
+SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +JSON_C
os: linux
pasta:
executable: /usr/bin/pasta
package: passt-0^20260716.g090d739-2.fc44.x86_64
version: |
pasta 0^20260716.g090d739-2.fc44.x86_64
Copyright Red Hat
GNU General Public License, version 2 or later
<https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
remoteSocket:
exists: true
path: unix:///run/podman/podman.sock
rootlessNetworkCmd: pasta
rootlessPortForwarder: rootlessport
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: false
seccompEnabled: true
seccompProfilePath: /usr/share/containers/seccomp.json
selinuxEnabled: false
serviceIsRemote: true
swapFree: 4294967296
swapTotal: 4294967296
uptime: 0h 38m 38.00s
variant: ""
plugins:
authorization: null
log:
- k8s-file
- none
- passthrough
- journald
network:
- bridge
- macvlan
- ipvlan
volume:
- local
registries:
search:
- docker.io
store:
containerStore:
number: 10
paused: 0
running: 10
stopped: 0
graphDriverName: overlay
graphOptions:
additionalImageStores:
- /usr/lib/containers/storage
imagestore: /usr/lib/containers/storage
overlay.mountopt: nodev,metacopy=on
graphRoot: /var/lib/containers/storage
graphRootAllocated: 1081101176832
graphRootUsed: 8701001728
graphStatus:
Backing Filesystem: extfs
Native Overlay Diff: "false"
Supports d_type: "true"
Supports shifting: "true"
Supports volatile: "true"
Using metacopy: "true"
imageCopyTmpDir: /var/tmp
imageStore:
number: 10
runRoot: /run/containers/storage
transientStore: false
volumePath: /var/lib/containers/storage/volumes
version:
APIVersion: 6.0.2
BuildOrigin: 'Copr: packit/podman-container-tools-podman-29249'
Built: 1784592000
BuiltTime: Tue Jul 21 10:00:00 2026
GitCommit: b28edb9ad70ce4317dc762ee9ce0a6d081d154e9
GoVersion: go1.26.5-X:nodwarf5
Os: linux
OsArch: linux/amd64
Version: 6.0.2
Podman in a container
No
Privileged Or Rootless
Privileged
Upstream Latest Release
Yes
Additional environment details
- OS: Windows 11 (build 10.0.26200.x)
- WSL: 2.7.1.0, kernel 6.6.x
- Podman client: 6.0.2 (windows/amd64)
- Podman server (in machine): 6.0.2 (linux/amd64)
- Machine: WSL, rootful,
UserModeNetworking=false - Host
.wslconfig:networkingMode=mirrored,dnsTunneling=true,firewall=true,autoProxy=true - Also present: second WSL distro (e.g. custom Linux) as default — common multi-distro setup
- UI: Podman Desktop starts machine via same
podman machine startpath
Additional information
Suggested fix
- Replace or extend
sysdpiddetection, e.g.:systemctl is-system-runningisrunning/degraded, or- PID 1 is systemd (
readlink -f /proc/1/exeends withsystemd//sbin/initwith systemd), or - Keep legacy nested-systemd grep as a fallback only.
- SSH port allocation: if configured port is in use but SSH with machine identity succeeds to
[email protected]:<port>and remote socket exists, keep the port. - On reassignment:
systemctl restart sshd(or equivalent), wait for listen, then health-check. - On Start when
Statebecomes running but pipes missing: startwin-sshproxyonly, do not rewrite SSH.
Happy to test a PR on Windows amd64 + mirrored WSL.
Hi @feczo, thanks for the detailed report and root-cause analysis. I'd like to work on this, starting with the native WSL systemd detection issue in isSystemdRunning() / isRunning() while preserving the legacy detection as a fallback.
Is this available for me to pick up?
Hi @feczo, thanks for the detailed report and root-cause analysis. I'd like to work on this, starting with the native WSL systemd detection issue in isSystemdRunning() / isRunning() while preserving the legacy detection as a fallback.
Is this available for me to pick up?
yes
Closing this as dup, running with the native systemd support is not officially support yet https://github.com/podman-container-tools/podman/issues/26098#issuecomment-2872698032
cc @l0rd