I was using Podman on Rocky Linux’s latest version and got this error.
Error: stats is not supported in rootless mode without cgroups v2
Running podman info --debug
gave the following output.
host:
arch: amd64
buildahVersion: 1.21.3
cgroupControllers: []
cgroupManager: cgroupfs
cgroupVersion: v1
...
Then I tried running the following command to enable cgroups v2
sudo grubby --update-kernel=/boot/vmlinuz-$(uname -r) --args="systemd.unified_cgroup_hierarchy=1"
And now, podman stats is giving another error.
WARN[0013] Failed to retrieve cgroup stats: open /sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/user.slice/19b6668bc6278a66b3ffc98ae1515af25f5bebcd20bf26de803cae41c4485f59/memory.current: no such file or directory
WARN[0013] Failed to retrieve cgroup stats: open /sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/user.slice/19b6668bc6278a66b3ffc98ae1515af25f5bebcd20bf26de803cae41c4485f59/pids.current: no such file or directory
WARN[0013] Failed to retrieve cgroup stats: open /sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/user.slice/5507087b3133950e4dbee35692af9bdb9a6b2cc473f3005306e27e9d05a72bd3/memory.current: no such file or directory
WARN[0013] Failed to retrieve cgroup stats: open /sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/user.slice/5507087b3133950e4dbee35692af9bdb9a6b2cc473f3005306e27e9d05a72bd3/pids.current: no such file or directory
Any idea why is this happening and how to fix it?