6

I have ubuntu 21.10 installed. I confirmed that I am using cgroup v2 by running mount, which shows cgrup2 on /sys/fs/cgroup type cgroup2.

When I want to use cgcreate from cgroup-tools to create a new group for cpu:

sudo cgcreate -g cpu:newgroup  # or
sudo cgcreate -g all:newgroup 

it fails with error:

cgcreate: libcgroup initialization failed: Cgroup is not mounted

I have several questions:

  • Is this because cgroup-tools is for cgroup v1?
  • What should I use to create new cgroups for cgroup v2?
  • How to create persistent cgroups (when booting) using config files for cgroup v2?
doraemon
  • 163

1 Answers1

4

The current cgroup-tools (in Ubuntu 21.10 and earlier) is 0.41 which only works with CGroups v1 and is no longer supported. Jammy (22.04) will have the new cgroup-tools version 2.0 that supports CGroups v2.

Guss
  • 3,535
  • can I download this cgroup-tools version 2.0 and use it in ubuntu 21.10? – doraemon Feb 04 '22 at 06:19
  • Theoretically, you should be able to - just download the required deb files and use dpkg -i to install them. You'd need to also download the libcgroup1 package linked from the Ubuntu Packages page I linked to, as it is required. I do recommend checking first whether something you have installed requires the old libcgroup1 by running apt rdepends --installed libcgroup1, but there should be nothing there, by default, except the tools package. – Guss Feb 06 '22 at 10:40
  • thanks. I will try it when I have time. – doraemon Feb 08 '22 at 03:19
  • 1
    I just upgraded to Ubuntu 22.04 to try it out, but it unfortunately did not solve the issue. dpkg does say that I have cgroup-tools 2.0-2. – Ciro Santilli OurBigBook.com May 03 '22 at 10:04
  • 1
    cgcreate on jammy works for me - the above command completes without an error. Check that the file system is still mounted. – Guss May 03 '22 at 11:11
  • I take that back. I think I had tried running it without sudo. It does work. – Ciro Santilli OurBigBook.com May 03 '22 at 11:19
  • 1
    BTW, I haven't managed to run cgexec without sudo if you have any clues about that: https://askubuntu.com/questions/1406329/how-to-run-cgexec-without-sudo-as-current-user-on-ubuntu-22-04-with-cgroups-v2 :-) – Ciro Santilli OurBigBook.com May 03 '22 at 11:41