Enable cgroup v2 on RHEL8
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:
-
Edit the
/etc/default/grubfile. -
This file contains multiple GRUB2 options. Kernel boot parameters are specified by the line that contains
GRUB_CMDLINE_LINUX.
Add the parametersystemd.unified_cgroup_hierarchy=1at the end ofGRUB_CMDLINE_LINUXline within the quotes. -
Once the file is edited, save it and execute the command specified below to generate a new
grub.cfgfile:
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
-
Now, reboot the system to apply the changes.
-
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)
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.