Apparently the kernel supports a cgroups1
and cgroups2
. How can I find which version I have?
Asked
Active
Viewed 6,066 times
7

Evan Carroll
- 30,763
- 48
- 183
- 315
-
See https://unix.stackexchange.com/q/617764/86440. – Stephen Kitt Nov 15 '20 at 12:44
1 Answers
8
Check mount | grep group
, that's where the interface is exposed.
If you see something like,
cgroup2 on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
Then your kernel supports groups2 controllers.
If you see something like
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,name=systemd)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/rdma type cgroup (rw,nosuid,nodev,noexec,relatime,rdma)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
Then your kernel supports cgroups1 controllers.
Your kernel may support both.
You can script it with
$> mount | grep '^cgroup' | awk '{print $1}' | uniq
cgroup2
cgroup

Evan Carroll
- 30,763
- 48
- 183
- 315