microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.46k stars 822 forks source link

v1.2.5 regression - podman stats broken by lack of cgroups v2 #10050

Closed shoffmeister closed 5 months ago

shoffmeister commented 1 year ago

Windows Version

Microsoft Windows [Version 10.0.22621.1555]

WSL Version

1.2.5

Are you using WSL 1 or WSL 2?

Kernel Version

5.15.90.1

Distro Version

Fedora Linux 38

Other Software

wsl.exe --version WSL version: 1.2.5.0 Kernel version: 5.15.90.1 WSLg version: 1.0.51 MSRDC version: 1.2.3770 Direct3D version: 1.608.2-61064218 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.22621.1555

podman 4.5.0 (from Fedora Linux 4.5.0)

Repro Steps

Expected Behavior

Good output from podman stats

Actual Behavior

WARN[0000] "/" is not a shared mount, this could cause issues or missing mounts with rootless containers
Error: stats is not supported in rootless mode without cgroups v2

This is a regression relative to WSL 1.1.6.

Diagnostic Logs

No response

shoffmeister commented 1 year ago

FWIW, the overall intent is to run rootless podman as a systemd user unit (service).

The steps above reproduce this with Fedora Linux, but, I guess, any distribution will do fine following roughly these steps

This was working fine on WSL 1.1.6, I could even launch minikube through the podman driver.

MorphBonehunter commented 1 year ago

Related to #9962, this was "downgraded" because of docker errors in Ubuntu 20.04. I'm unsure if this is an Ubuntu specific Problem, because @benhillis (https://github.com/microsoft/WSL/issues/9962#issuecomment-1507233830) could not easy repro this and i can confirm that this was working on my ArchLinux Container with cgroupv2. I hope they bring back cgroupv2 soon, as v1 ist deprecated (at least for the mm) and systemd will remove support in 2024.

shoffmeister commented 1 year ago

I worked around the reported problem on WSL 1.2.5 by tuning the cgroups setup as follows:

On the Windows side, edit the WSL configuration file $HOME/.wslconfig and make sure that cgroups V1 is disabled:

[wsl2]
kernelCommandLine = cgroup_no_v1=all

Within my Linux distribution, make sure that /etc/fstab contains the following line

cgroup2 /sys/fs/cgroup cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate 0 0

Credits to https://stackoverflow.com/questions/73021599/how-to-enable-cgroup-v2-in-wsl2 (and https://github.com/microsoft/WSL/issues/9868#issuecomment-1490790097)

microsoft-github-policy-service[bot] commented 5 months ago

This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

Thank you!