Enabling cgroups v2

At boot time, Oracle Linux 8 mounts cgroups v1 by default. To use cgroups v2, you must manually configure the system.

  1. Verify that cgroups v2 is enabled and mounted on the system.
    sudo mount -l | grep cgroup
    cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,seclabel,nsdelegate,memory_recursiveprot)

    If the output of the command doesn't specify cgroup2, then do the following to enable version 2.

    1. Configure the system boot to mount cgroups v2 by default.

      sudo grubby --update-kernel=/boot/vmlinuz-$(uname -r) --args="systemd.unified_cgroup_hierarchy=1"

      The command adds systemd.unified_cgroup_hierarchy=1 to the current boot entry. To add this parameter to all kernel boot entries, type:

      sudo grubby --update-kernel=ALL --args="systemd.unified_cgroup_hierarchy=1"
    2. Reboot the system.

    3. After the system reboots, verify that cgroups v2 is now mounted.

      sudo mount -l | grep cgroup
  2. Optionally, check the contents of /sys/fs/cgroup directory, which is also called the root control group.
    ls -l /sys/fs/cgroup/

    For cgroups v2, the files in the directory should have prefixes to their file names, for example, cgroup.*, cpu.*, memory.*, and so on. See About the Control Group File System.