/sys/fs/cgroup/memory/memory.limit_in_bytes not present in Fedora 33

Viewed 1774

I have an old script that do

$(cat /sys/fs/cgroup/memory/memory.limit_in_bytes)

In fedora 33 this file is not present.

What can I do to resolve this?

Thanks.

2 Answers

The issue is related to new cgroup v2. To resolve this, revert cgroup to v1:

sudo sed -i '/^GRUB_CMDLINE_LINUX/ s/"$/ systemd.unified_cgroup_hierarchy=0"/' /etc/default/grub

and reboot.

After this /sys/fs/cgroup/memory/memory.limit_in_bytes will be present.

Before rebooting, it's necessary to redo the command to regenerate grub. For Fedora 33, the commands are:

BIOS

grub2-mkconfig -o /boot/grub2/grub.cfg

UEFI

grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
Related