I have a cgroup setup that I use to limit memory usage for rsync and firefox, primarily. It is a manual setup (no systemd involvement) that I run from a Makefile after each boot (yeah I know not great, but systemd is such a hassle to learn).
When I upgraded from ubuntu 21.04 to 22.04 today, the law of unintended consequences ensured that my cgroup setup no longer works, probably because cgroup V2 is now standard.
What it looks like to me is that the file hierarchy in /sys/fs/cgroups has changed. I used to have, for example for my user reik
/sys/fs/cgroup/memory/custom/reik-2048M
which I created with a Makefile snippet that generates the following script
MEM=2048M
sudo cgcreate -a reik -t reik -g memory:/custom/reik-$(MEM)
sudo cgset -r memory.limit_in_bytes=$(MEM) custom/reik-$(MEM)
sudo cgset -r memory.memsw.limit_in_bytes=$(MEM) custom/reik-$(MEM)
I could then run a program as follows
% gexec --sticky -g memory:custom/reik-2048M someprogram
With cgroup v2 the memory.blah variable names had changed, which I think I fixed, as follows
sudo cgcreate -a reik -t reik -g memory:/custom/reik-2048M
sudo cgset -r memory.max=2048M custom/reik-2048M
sudo cgset -r memory.swap.max=2048M custom/reik-2048M
But now I get an error if I try to run any program, say ls, as follows
% cgexec --sticky -g memory:custom/reik-2048M ls
cgroup change of group failed
One thing that seems different is that the file hierarchy no longer has the /memory/ component in it, that is, the path that gets created is just
/sys/fs/cgroup/custom/reik-2048M
That is as far as I got. I am looking for ideas on what I am doing wrong here. I also looked for docs about how to translate cgroup v1 commands into cgroup v2, but did not find anything very concrete.