August 2020, last year, I changed the cgroups from v2 as a default setting to v1 on my Fedora because I wanted to run Docker on my Fedora [1]. The Docker did not support cgroups v2 at that time.
However the time has passed. The Docker 20.10 supports cgroups v2 initially [2]. The Fedora 34 ships the Docker 20.10 as the RPM moby-engine
. We do not need to use cgroups v1. Actually I have sometimes an issue related to hardware io. Suddenly we can not write the data to the hardware. The issue might come from the hardware, but I think the issue might comes from a criteria with the cgroup v1. So, that's one of the motivations I wanted to run the kernel with the default arguments.
Seeing the [1], I executed the following command to run with cgroups v1.
$ sudo grubby --update-kernel=ALL --args="systemd.unified_cgroup_hierarchy=0"
The following command log was executed in Fedora 33.
$ cat /etc/fedora-release Fedora release 33 (Thirty Three)
Now then the kernels are executed with the arguments.
$ sudo grubby --info=ALL | grep cgroup args="ro resume=/dev/mapper/fedora_localhost--live-swap rd.lvm.lv=fedora_localhost-live/root rd.luks.uuid=luks-acd212a1-cb29-4136-9766-d8416f829127 rd.lvm.lv=fedora_localhost-live/swap rhgb quiet systemd.unified_cgroup_hierarchy=0" args="ro resume=/dev/mapper/fedora_localhost--live-swap rd.lvm.lv=fedora_localhost-live/root rd.luks.uuid=luks-acd212a1-cb29-4136-9766-d8416f829127 rd.lvm.lv=fedora_localhost-live/swap rhgb quiet systemd.unified_cgroup_hierarchy=0" args="ro resume=/dev/mapper/fedora_localhost--live-swap rd.lvm.lv=fedora_localhost-live/root rd.luks.uuid=luks-acd212a1-cb29-4136-9766-d8416f829127 rd.lvm.lv=fedora_localhost-live/swap rhgb quiet systemd.unified_cgroup_hierarchy=0" args="ro resume=/dev/mapper/fedora_localhost--live-swap rd.lvm.lv=fedora_localhost-live/root rd.luks.uuid=luks-acd212a1-cb29-4136-9766-d8416f829127 rd.lvm.lv=fedora_localhost-live/swap rhgb quiet systemd.unified_cgroup_hierarchy=0"
According to the [3], here is the command to check if the current cgroup is v1.
$ df /sys/fs/cgroup/systemd Filesystem 1K-blocks Used Available Use% Mounted on cgroup 0 0 0 - /sys/fs/cgroup/systemd
Then run the following command to remove the added argument by grubby --remove-args
option.
$ sudo grubby --update-kernel=ALL --remove-args="systemd.unified_cgroup_hierarchy=0"
Then you can see the arguments are removed.
$ sudo grubby --info=ALL | grep args args="ro resume=/dev/mapper/fedora_localhost--live-swap rd.lvm.lv=fedora_localhost-live/root rd.luks.uuid=luks-acd212a1-cb29-4136-9766-d8416f829127 rd.lvm.lv=fedora_localhost-live/swap rhgb quiet" args="ro resume=/dev/mapper/fedora_localhost--live-swap rd.lvm.lv=fedora_localhost-live/root rd.luks.uuid=luks-acd212a1-cb29-4136-9766-d8416f829127 rd.lvm.lv=fedora_localhost-live/swap rhgb quiet" args="ro resume=/dev/mapper/fedora_localhost--live-swap rd.lvm.lv=fedora_localhost-live/root rd.luks.uuid=luks-acd212a1-cb29-4136-9766-d8416f829127 rd.lvm.lv=fedora_localhost-live/swap rhgb quiet" args="ro resume=/dev/mapper/fedora_localhost--live-swap rd.lvm.lv=fedora_localhost-live/root rd.luks.uuid=luks-acd212a1-cb29-4136-9766-d8416f829127 rd.lvm.lv=fedora_localhost-live/swap rhgb quiet"
So, restart the OS.
$ sudo shutdown -r now
Then according to the [3], you can check that the running cgroups is actually v2 by the following commands. In my case, both the /sys/fs/cgroup/systemd
and the /sys/fs/cgroup/unified
directory did not existed. The /sys/fs/cgroup/
's filesystem is cgroup2.
$ df /sys/fs/cgroup/systemd df: /sys/fs/cgroup/systemd: No such file or directory $ df /sys/fs/cgroup/unified df: /sys/fs/cgroup/unified: No such file or directory $ df /sys/fs/cgroup/ Filesystem 1K-blocks Used Available Use% Mounted on cgroup2 0 0 0 - /sys/fs/cgroup