Enable cgroup v2 on RHEL8

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux 8

Issue

  • How to enable cgroup v2 on RHEL8?
  • Is cgroup v2 supported on RHEL 8?

Resolution

By default RHEL8 runs on cgroup-v1. You can switch to using cgroup-v2 by adding systemd.unified_cgroup_hierarchy=1 parameter on the kernel command line and reboot.

Using grubby tool

To modify the kernel command line, you can use the grubby tool:

# grubby --update-kernel=ALL --args="systemd.unified_cgroup_hierarchy=1"

Using grub2-mkconfig

Alternatively, you can use the the grub2-mkconfig method:

  1. Edit the /etc/default/grub file.

  2. This file contains multiple GRUB2 options. Kernel boot parameters are specified by the line that contains GRUB_CMDLINE_LINUX.
    Add the parameter systemd.unified_cgroup_hierarchy=1 at the end of GRUB_CMDLINE_LINUX line within the quotes.

  3. Once the file is edited, save it and execute the command specified below to generate a new grub.cfg file:

  For an MBR (BIOS-based) system
  # grub2-mkconfig -o /boot/grub2/grub.cfg

  For a GPT (UEFI-based) system:
  # grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
  1. Now, reboot the system to apply the changes.

  2. Execute the following command to validate.

# mount -l|grep cgroup
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)

The following Red Hat documentation has more details about updating grub command line parameters:

Diagnostic Steps

# mount -l|grep cgroup
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.