I am trying to set up resource limit delegation for a specific user myuser
on Ubuntu 20.04.5. The point is that I need to be able to control resource limits when running my rootless Podman container.
However, despite the numerous online tutorials on cgroups, I am at a loss as to how I'm supposed to achieve this.
On the official Podman website, it says that I can verify whether resource limit delegation is enabled by running the following command:
cat "/sys/fs/cgroup/user.slice/user-$(id -u).slice/user@$(id -u).service/cgroup.controllers"
But the user.slice
folder doesn't exist. Then it says that in any case I can enable resource limit delegation for all users by modifying the file:
/etc/systemd/system/user@.service.d/delegate.conf
But the user@.service.d
folder doesn't exist. Then I'm being told that I maybe need to install the libcgroup
package, but when I run
apt-get install libcgroup
I get
Unable to locate package libcgroup
So what am I supposed to do to enable cgroups on Ubuntu 20.04.5 and set up resource limit delegation for myuser
?
Please help...
find /sys/fs/cgroup/* | grep "user@$(id -u).service/cgroup.controllers"
shows that it's located at/sys/fs/cgroup/unified/user.slice/user-$(id -u).slice/user@$(id -u).service/cgroup.controllers
– mchid Oct 07 '22 at 06:33cat...
command, I get an empty return value, i.e., can't delegate resource limits for that user. And thedelegate.conf
file is not existing anywhere. – 87dsf897w6543d54fsdf Oct 07 '22 at 06:38cgroup-tools
Also, the package you were looking for islibcgroup1
instead oflibcgroup
for some reason. Runapt-cache search cgroup | grep cgroup
to list related packages. – mchid Oct 07 '22 at 06:49vi
user, just usenano
instead and you probably need to usesudo
to run the commands in the linked answer or as root. – mchid Oct 07 '22 at 06:51libcgroup
package. But still, there is no/etc/cgrules.conf
file. And still nodelegate.conf
file. I installed both thelibcgroup1
andcgroup-tools
packages. – 87dsf897w6543d54fsdf Oct 07 '22 at 06:56/etc/cgrules.conf
should be provided by thecgroup-tools
package. – mchid Oct 07 '22 at 07:12/etc/cgrules.conf
file seems pretty straightforward. If possible, you might be able to use that instead of the delegate file. – mchid Oct 07 '22 at 07:15/usr/share/doc/cgroup-tools/examples/cgrules.conf
instead of/etc/cgrules.conf
. That seems strange, especially that it's inside a folder namedexamples
. Am I supposed to copy that into/etc/
? Why is there so little documentation on this? It's confusing, every step of the way. – 87dsf897w6543d54fsdf Oct 07 '22 at 07:18cgrules.conf
file is an example file located at/usr/share/doc/cgroup-tools/examples/cgrules.conf
You can look to this file for examples. All you have to do is create your own file at/etc/cgrules.conf
If the example configuration is what you want then copy the file to/etc/cgrules.conf
and you can use that as a template. – mchid Oct 07 '22 at 07:20groupname:username
– mchid Oct 07 '22 at 07:22cgroup
s orcgconfig
s in the list of services, even though several tutorials suggest executingservice cgconfig restart
– 87dsf897w6543d54fsdf Oct 07 '22 at 07:30