Switch RHEL8 to cgroup v2

https://gist.github.com/mancubus77/0a56431fd50b957bf15af085dcaddf95

Switch RHEL8 to cgroup v2 cgroups-rhel8.md Solution 1

I was not able to run podman stats on RHEL8. The command returned:

Error: stats is not supported in rootless mode without cgroups v2 Solution based on this article -> https://sleeplessbeastie.eu/2021/09/10/how-to-enable-control-group-v2/

vi /etc/default/grub and append systemd.unified_cgroup_hierarchy=1 to make it like

GRUB_CMDLINE_LINUX=”console=tty0 console=ttyS0,115200n8 no_timer_check net.ifnames=0 crashkernel=auto systemd.unified_cgroup_hierarchy=1” Rebuild grub config

grub2-mkconfig -o “$(readlink -e /etc/grub2.conf)” Reboot system

init 6 Run it again

podman stats -a –no-stream ID NAME CPU % MEM USAGE / LIMIT MEM % NET IO BLOCK IO PIDS CPU TIME AVG CPU % 1a6dad44f8be ansible_runner_66 4.39% 1.013GB / 17GB 5.96% – / – – / – 198 1m12.078589s 4.39% 276a8a3dba1a ansible_runner_64 4.39% 1.013GB / 17GB 5.96% – / – – / – 198 1m12.078655s 4.39% 2be1402c870c ansible_runner_70 4.39% 1.013GB / 17GB 5.96% – / – – / – 198 1m12.078821s 4.39% a5ec1b29c8f5 ansible_runner_72 4.39% 1.013GB / 17GB 5.96% – / – – / – 198 1m12.079041s 4.39% d691d440957f ansible_runner_68 4.39% 1.013GB / 17GB 5.96% – / – – / – 198 1m12.079041s 4.39% Happy dayz

Solution 2

Update Grub

sudo grubby –update-kernel=ALL –args=’systemd.unified_cgroup_hierarchy’ sudo reboot Tune cgroups

sudo mkdir /etc/systemd/system/user@.service.d sudo cat > /etc/systemd/system/user@.service.d/delegate.conf«EOF [Service] Delegate=cpu cpuset io memory pids EOF sudo systemctl daemon-reload @davemq davemq commented on Oct 25, 2023 Should that be /etc/grub2.cfg above? I found /etc/grub2.cfg but not /etc/grub2.conf on my RHEL 8.8 VMs.

@mancubus77 Author mancubus77 commented on Oct 30, 2023 hey @davemq yes, apologies. Should be grub2.cfg

Updated: