Categories
SysOps

How to downgrade cgroup version on DietPi

DietPi an extremely lightweight Debian OS is using cgroup v2 on Raspberry Pi, but this causes warning when using snap packages…

Use snap package usage that causes a warning.

$ snap run lxd --version
WARNING: cgroup v2 is not fully supported yet, proceeding with partial confinement
4.20

Display currently used cgroup version.

$ findmnt -lo source,target,fstype,options -t cgroup,cgroup2
SOURCE  TARGET         FSTYPE  OPTIONS
cgroup2 /sys/fs/cgroup cgroup2 rw,nosuid,nodev,noexec,relatime

This warning is issued because we are using snap version 2.52 instead of least 2.53 according to Switch to “unified” cgroup hierarchy (cgroupv2) bug report.

$ snap version 
snap    2.52.1
snapd   2.52.1
series  16
debian  11
kernel  5.10.63-v8+

Inspect kernel boot parameters.

$ cat /boot/cmdline.txt 
root=PARTUUID=8b0ac6f5-02 rootfstype=ext4 rootwait fsck.repair=yes net.ifnames=0 logo.nologo quiet console=tty1

Append systemd.unified_cgroup_hierarchy=0 parameter to not use cgroup v2.

$ sudo sed -i -e "1 s/$/ systemd.unified_cgroup_hierarchy=0/" /boot/cmdline.txt 
$ cat  /boot/cmdline.txt 
root=PARTUUID=8b0ac6f5-02 rootfstype=ext4 rootwait fsck.repair=yes net.ifnames=0 logo.nologo quiet console=tty1 systemd.unified_cgroup_hierarchy=0

Reboot operating system.

$ sudo reboot

Display currently used cgroup version.

$ findmnt -lo source,target,fstype,options -t cgroup,cgroup2
$ findmnt -lo source,target,fstype,options -t cgroup,cgroup2
SOURCE  TARGET                          FSTYPE  OPTIONS
cgroup2 /sys/fs/cgroup/unified          cgroup2 rw,nosuid,nodev,noexec,relatime
cgroup  /sys/fs/cgroup/systemd          cgroup  rw,nosuid,nodev,noexec,relatime,xattr,name=systemd
cgroup  /sys/fs/cgroup/perf_event       cgroup  rw,nosuid,nodev,noexec,relatime,perf_event
cgroup  /sys/fs/cgroup/pids             cgroup  rw,nosuid,nodev,noexec,relatime,pids
cgroup  /sys/fs/cgroup/cpu,cpuacct      cgroup  rw,nosuid,nodev,noexec,relatime,cpu,cpuacct
cgroup  /sys/fs/cgroup/cpuset           cgroup  rw,nosuid,nodev,noexec,relatime,cpuset,clone_children
cgroup  /sys/fs/cgroup/net_cls,net_prio cgroup  rw,nosuid,nodev,noexec,relatime,net_cls,net_prio
cgroup  /sys/fs/cgroup/freezer          cgroup  rw,nosuid,nodev,noexec,relatime,freezer
cgroup  /sys/fs/cgroup/blkio            cgroup  rw,nosuid,nodev,noexec,relatime,blkio
cgroup  /sys/fs/cgroup/devices          cgroup  rw,nosuid,nodev,noexec,relatime,devices

Use snap package usage that caused a warning.

$ snap run lxd --version
4.20

That is all.