12

On a Raspberry Pi 4, on a vanilla downloaded 19.10 image of Ubuntu 19 arm64, I failed trying to enable cgroup memory, needed for Kubernetes.

I created (because I don't understand well the real one, I think the 4th)

  • /boot/cmdline.txt
  • /boot/firmware/cmdline.txt
  • /boot/firmware/btcmd.txt (modified)
  • /boot/firmware/usercfg.txt (modified)

to append:

cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1

but in vain.

If I check cat /proc/cgroups the cgroup memory is disabled.

If I check cat /proc/cmdline there isn't.

How can I fix that?

10 Answers 10

19

Following @kremerol solution, I was able to get my RPI 4 with Ubuntu 20.04 working.

  1. Run sudo nano /boot/firmware/cmdline.txt

  2. Edit the default file to look like below.

     net.ifnames=0 dwc_otg.lpm_enable=0 console=serial0,115200 cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1 console=tty1 root=LABEL=writable rootfstype=ext4 elevator=deadline rootwait fixrtc
    

    NOTE: These are the 3 settings to add:

    • cgroup_enable=cpuset
    • cgroup_enable=memory
    • cgroup_memory=1
  3. Save the file and reboot and the node status will change to ready.

  4. You can check the status by running sudo microk8s.kubectl get nodes

1
  • /boot/firmware/cmdline.txt is still the correct file to edit if you want to edit the kernel command line in ubuntu 21.10. Oct 17, 2021 at 17:10
13

I've just had this exact problem after picking up a new rpi4 on Ubuntu 19.10. After a quick poke...

The /boot/firmware/README file appears to detail the updated boot process. The second step in the process is to load /boot/firmware/config.txt which specifies /boot/firmware/nobtcmd.txt as the current cmdline.

So modify /boot/firmware/nobtcmd.txt and append: cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1. Reboot and cat /proc/cmdline

I wouldn't be surprised if some magic (maybe enabling BT?) changes the cmdline to /boot/firmware/btcmd.txt so it might be worth adding the change to that file too.

1
  • This answer has valuable information also for ubuntu 21.10 on RPi: Read /boot/firmware/README. I read there that I had to edit /boot/firmware/cmdline.txt in ubuntu 21.10 for changing the kernel command line, and it worked! Oct 17, 2021 at 17:11
4

On Raspbian I had to add the following in /boot/cmdline.txt

cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory

You must add this to the end of the existing line; if you add it at the bottom of file in a new line it doesn't work.

3
  • specific to Rasbpian
    – karel
    Aug 9, 2020 at 8:19
  • This solution fixed my Raspberry Pi Zero W
    – Huan
    Jul 3, 2021 at 9:43
  • This file does not exist in ubuntu distributions for Raspberry Pi. See other answers for ubuntu. Oct 17, 2021 at 17:12
1

On my Raspberry Pi 4 (ubuntu-server-20.10/arm64) I had to append the following lines to /boot/firmware/cmdline.txt:

cgroup_enable=memory cgroup_memory=1

1
  • I believe you have to extend the existing line in this file, not add another line. But I am not sure. Oct 17, 2021 at 17:15
0

Maybe you're using an external USB disk with a microsd as boot device? In that case, the change must be done in the microsd partition and not in the USB.

1
  • I'm using the microsd slot available in the raspberry as a primary storage, attaching that sd to the pc i can see 2 partitions: boot and another one not readable from windows, i think the os one. Maybe i miss some basics. Nov 17, 2019 at 13:59
0

Reading in the boot partition the config.txt the settings of cmdline point to a file nobtcmd.txt, which is exactly what I can see at runtime from /proc/cmdline. Changed inside that and now it works properly.

0

Before I tried these solutions which involve editing /boot/firmware/cmdline.txt or any other mentioned file, I tried first with installing cgroup-lite via apt-get. This seemed to do the trick as well.

Docker: Version Groovy Gorilla 20.10.6 Ubuntu version 20.10 Pi 4: 8GB ARM64

0

Here is a one-liner to enable cgroup support in Raspberry Pi OS. Remember, you must reboot after running this command.

sudo sed -i '$ s/$/ cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory/' /boot/cmdline.txt
0

If you load up the SD card on a Windows machine, there are a few drives mounted (don't format them again when windows offers to).

In the drive labelled ubuntu-seed, not ubuntu-boot you will find the cmdline.txt file to append cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory

-1

If you need to automate it

sed -e '1s/$/ cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory/' -i /boot/cmdline.txt

This appends cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory at the end of the first line of /boot/cmdline.txt

1
  • No file named /boot/cmdline.txt exists in ubuntu distributions for Raspberry Pi. Oct 17, 2021 at 17:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .