Skip to content

Enabling CGroups

XternA edited this page Apr 10, 2024 · 10 revisions

If there's an issue applying the resource limits when installing the application, there's a good chance that cgroup isn't enabled on the system.

cgroups (abbreviated from control groups) is a Linux kernel feature that limits, accounts for, and isolates the resource usage (CPU, memory, disk I/O, etc.[1]) of a collection of processes.

You would expect to see the following warning ⚠️ when installing applications.

Income Generator Application Manager
----------------------------------------

Installing only applications supporting VPS/Hosting...

[+] Running 18/18
 ✔ Container spide                                                                                                                Started           12.0s
 ✔ Container tm                                                                                                                   Started           11.5s
 ✔ Container watchtower                                                                                                           Started           13.2s
 ! traffmonetizer Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap.                    0.0s
 ! watchtower Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap.                        0.0s
 ! spide Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap.                             0.0s
 
Press Enter to continue...

Applications will still function and run but the resource limit constraints won't be applied.

Raspberry Pi

To enable cgroup on Rasberry Pi, it is required to modify the cmdline.txt boot file to automount and enable the feature.

sudo nano /boot/firmware/cmdline.txt`

And append the following three entries to the file.

  1. cgroup_enable=cpuset
  2. cgroup_enable=memory
  3. cgroup_memory=1
cgroup_enable=memory swapaccount=1 cgroup_memory=1 cgroup_enable=cpuset

⚠️ Do not add it onto a new line. Just append after existing entries followed a space separator.

Reboot the Raspberry Pi and the cgroup feature should be enabled. Redeploy the applications again for the changes to take place.

Linux

As each Linux distribution is different from each others and the way the filesystem is configured, it's going to be hard to cover it all here.

Therefore you should google "How to enable cgroup" for your distribution and follow the steps to enable it.

Clone this wiki locally