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.conffile is not existing anywhere. – 87dsf897w6543d54fsdf Oct 07 '22 at 06:38cgroup-toolsAlso, the package you were looking for islibcgroup1instead oflibcgroupfor some reason. Runapt-cache search cgroup | grep cgroupto list related packages. – mchid Oct 07 '22 at 06:49viuser, just usenanoinstead and you probably need to usesudoto run the commands in the linked answer or as root. – mchid Oct 07 '22 at 06:51libcgrouppackage. But still, there is no/etc/cgrules.conffile. And still nodelegate.conffile. I installed both thelibcgroup1andcgroup-toolspackages. – 87dsf897w6543d54fsdf Oct 07 '22 at 06:56/etc/cgrules.confshould be provided by thecgroup-toolspackage. – mchid Oct 07 '22 at 07:12/etc/cgrules.conffile 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.confinstead 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.conffile is an example file located at/usr/share/doc/cgroup-tools/examples/cgrules.confYou can look to this file for examples. All you have to do is create your own file at/etc/cgrules.confIf the example configuration is what you want then copy the file to/etc/cgrules.confand you can use that as a template. – mchid Oct 07 '22 at 07:20groupname:username– mchid Oct 07 '22 at 07:22cgroups orcgconfigs in the list of services, even though several tutorials suggest executingservice cgconfig restart– 87dsf897w6543d54fsdf Oct 07 '22 at 07:30