Jun's Blog

Output, activities, memo and etc.

How to rollback from cgroups v1 to v2.

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

i3: Set up Czech input environment

In my past blog, I wrote about how to set up i3 Japanese input environment [1].

This time I wrote about how to set up Czech input environment on i3. The articles [2], [3] were helpful.

First check the current keyword setting by setxkbmap command.

$ setxkbmap -query
rules:      evdev
model:      pc105
layout:     us,cz
variant:    ,

Then here is the setting to change the keyboard by toggle, typing Shift + Alt. I confirmed it works on the terminal.

$ setxkbmap -layout us,cz -option grp:alt_shift_toggle

Here is the setting typing Alt + Space. This one is my favorite setting. But as it does not work on VIM, maybe because space is occupied by another setting of mine. I did not set this one.

$ setxkbmap -layout us,cz -option grp:alt_space_toggle

Then add the following config to the config file.

$ vi ~/.config/i3/config
...
exec --no-startup-id "setxkbmap -layout us,cz -option grp:alt_shift_toggle"
...

Load the setting by typing Window key + Shift + r.

Now the updated setting is like this.

$ setxkbmap -query
rules:      evdev
model:      pc105
layout:     us,cz
variant:    ,
options:    grp:alt_shift_toggle

That's all.

References