What is required to activate cgroups in Linux

Solution 1:

You have to pass an -o to tell it what to mount.

mount -t cgroup -o memory cgroup_memory /sys/fs/cgroup/memory

And that's assuming that /sys/fs/cgroup is mounted at all.

mount -t tmpfs cgroup /sys/fs/cgroup

Ubuntu has a package named cgroup-lite which can do all this at boot. It doesn't appear to be in Debian so I'm not sure what the equivalent might be.

Note: I cannot add comments so I have to simply answer your question this way. For example: I wanted to ask if you had checked your kernel logs (dmesg | grep cgroup).

Solution 2:

You should mount like that[1]:

$ mount -t cgroup -o <cgroup_subsystem> name /cgroup/name

cgroup_subsystem can be[2]: {blkio, cpu, cpuacct, cpuset, devices, freezer, memory, net_cls, net_prio, ns}

You can also mount cgroups with the help of fstab (static information about the filesystems). Add this line to /etc/fstab to mount it at system boot with default cgroup subsystems.

$ cgroup  /sys/fs/cgroup  cgroup  defaults  0   0

Solution 3:

It depends on your distribution and kernel version. You can use following script from Docker to test cgroups and container related features:

wget https://raw.githubusercontent.com/docker/docker/master/contrib/check-config.sh -O cgroups_check && chmod +x cgroups_check
./cgroups_check