Score:2

is `cgroup-tools` using cgroup v1 or v2

co flag

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?
Ciro Santilli 新疆再教育营六四事件法轮功郝海东 avatar
A bug report: https://bugs.launchpad.net/ubuntu/+source/libcgroup/+bug/1948415
Ciro Santilli 新疆再教育营六四事件法轮功郝海东 avatar
It seems that it is possible to revert to v1 with a kernel param, maybe that will serve as a workaround for anyone stuck on 21.10: https://stackoverflow.com/questions/65646317/sys-fs-cgroup-memory-memory-limit-in-bytes-not-present-in-fedora-33
Score:1
br flag

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.

Ciro Santilli 新疆再教育营六四事件法轮功郝海东 avatar
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.
br flag
`cgcreate` on jammy works for me - the above command completes without an error. Check that the file system is still mounted.
Ciro Santilli 新疆再教育营六四事件法轮功郝海东 avatar
I take that back. I think I had tried running it without `sudo`. It does work.
Ciro Santilli 新疆再教育营六四事件法轮功郝海东 avatar
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 :-)
doraemon avatar
co flag
can I download this `cgroup-tools version 2.0` and use it in ubuntu 21.10?
br flag
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.
doraemon avatar
co flag
thanks. I will try it when I have time.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.