Common Issues with Linux Control Groups - e.g. Lack of Space, Device Busy/Mount Problems, Subgroup can't be deleted, no cpu shares file

Problem: The group will e.g. not let you echo PIDs into its "tasks" file and complain about a lack of space.
Solution: You have probably not set up all necessary settings of the group yet. E.g. for cpuset you must assign cpu and memory to the group before you can use it:
The magic files are cpuset.cpus and cpuset.mems. First you'll want to know what we've got available. You can just check what the root group has, it automatically has all memory and cpus assigned to it: tail ../cpuset.cpus ../cpuset.mems
Then echo at least one cpu and one memory slot into your group. In my case: echo 0 | tee cpuset.cpus cpuset.mems.

Problem: Mounting with -o cpu,memory fails, e.g. with filesystem busy. This is because some other process mounted them into separate dictories before and modified them separately. Now they might be or are different, so they can't be mounted into the same directory anymore.
Solution: Close all daemons that exit cgroups, then use cgclear.

Problem: Subgroups can't be deleted. It says access denied or a similar error.
Solution: Use rmdir or rm -r, but not rm -rf to delete a directory. Don't ask me why. ;)

Problem: I can't find the cpu shares or memory limits file.
Solution: If you're a beginner, you likely really want to use "cpu" and "memory" as "mount -o" not "cpuset" when mounting cgroups.

Problem: How do I get it to work in the first place so I can test how well it works?
Solution: Check this first steps with cgroups article.

More to come... Just asks in the comments if you run into other problems ;)

No comments:

Post a Comment

I appreciate comments. Feel free to write anything you wish. Selected comments and questions will be published.