Fixing the 'CPU Mountpoint Not Found' Error When Installing cAdvisor on Ubuntu 24
Issue Reproduction
Today, I decided to experiment with the combination of Grafana, cAdvisor, and Prometheus to monitor Docker applications on my server.
However, I encountered an issue while deploying cAdvisor:
Docker command:
docker run \
--volume=/:/rootfs:ro \
--volume=/var/run:/var/run:rw \
--volume=/sys:/sys:ro \
--volume=/var/lib/docker/:/var/lib/docker:ro \
--volume=/dev/disk/:/dev/disk:ro \
--publish=9101:8080 \
--detach=true \
--name=cadvisor \
google/cadvisor:latest
Container failed to start:
F1006 07:45:20.802587 1 cadvisor.go:146] Failed to create a Container Manager: mountpoint for cpu not found
After some searching on DuckDuckGo and Bing, I found out that Ubuntu 24 uses cgroup v2, which is not yet supported by cAdvisor.
Well, that's unfortunate.
Hence, this post.
Solution
Referencing this blog post (a rare gem on CSDN):
Edit the File
Edit the following file: /etc/default/grub
(I’m venturing into unfamiliar Linux territory, feeling quite nervous)
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'
GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`( . /etc/os-release; echo ${NAME:-Ubuntu} ) 2>/dev/null || echo Ubuntu`
GRUB_CMDLINE_LINUX_DEFAULT="splash=silent showopts crashkernel=0M-3G:0M,3G-8G:192M,8G-16G:256M,16G-64G:384M,64G-128G:512M,128G-486G:768M,486G-972G:1024M,972G-:2048M net.ifnames=0 biosdevname=0 console=ttyS0,115200 console=tty0 panic=5 intel_idle.max_cstate=1 intel_pstate=disable processor.max_cstate=1 amd_iommu=on iommu=pt spec_rstack_overflow=off"
- GRUB_CMDLINE_LINUX=""
+ GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=0 systemd.unified_cgroup_hierarchy=0"
# If your computer has multiple operating systems installed, then you
# probably want to run os-prober. However, if your computer is a host
# for guest OSes installed via LVM or raw disk devices, running
# os-prober can cause damage to those guest OSes as it mounts
# filesystems to look for things.
#GRUB_DISABLE_OS_PROBER=false
# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
# Uncomment to disable graphical terminal
#GRUB_TERMINAL=console
# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true
# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"
# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"
Restart
Nervously type the following commands in the terminal:
sudo update-grub # This step is mandatory
sudo reboot
Verification
Thankfully, the system rebooted successfully.
You should now see that cAdvisor has started successfully.