1

i am using a Raspbi 4 with the newest OS 32bit lite. The OS is using cgroups v2 Due to some software limitations i need the cgroups v1. I've added cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1 swapaccount=1 but nothing happens still v2 is active.

How can i change it ?

Skary
  • 111
  • 1
  • 2
  • "The OS is using cgroups v2" According to man cgroups: "Although cgroups v2 is intended as a replacement for cgroups v1, the older system continues to exist (and for compatibility reasons is unlikely to be removed). Currently, cgroups v2 implements only a subset of the controllers available in cgroups v1. The two systems are implemented so that both v1 controllers and v2 controllers can be mounted on the same system..." – goldilocks Dec 07 '21 at 16:51
  • "...Thus, for example, it is possible to use those controllers that are supported under version 2, while also using version 1 controllers where version 2 does not yet support those controllers. The only restriction here is that a controller can't be simultaneously employed in both a cgroups v1 hierarchy and in the cgroups v2 hierarchy." To me this says you shouldn't have to do anything, although I admit I've probably only ever used the v2 interface. Are you sure this isn't an XY problem? – goldilocks Dec 07 '21 at 16:53
  • @goldilocks Yes it can be: The AWS ECS Agent (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_agent.html) is yelling at me that i need cgroupsv1 but cgroups v2 is enabled. – Skary Dec 07 '21 at 19:36

1 Answers1

3

You should add systemd.unified_cgroup_hierarchy=0 to your /boot/cmdline.txt or /boot/firmware/cmdline.txt

Before:

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

After adding systemd.unified_cgroup_hierarchy=0 and reboot:

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