Ubuntu 24: Resolving cAdvisor Installation Error "mountpoint for cpu not found"
Problem Reproduction
Today I wanted to play around with the Grafana + cAdvisor + Prometheus combination to monitor Docker applications on the server.
But I encountered some issues 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
I checked DeepSeek and Bing, and the conclusion is that Ubuntu 24 uses cgroup v2, but cAdvisor still does not support it.
That's too bad
Hence this article.
Solution
Refer to this blog post (Rare to find a good article on CSDN)
Editing the GRUB file is actually a quite dangerous action; please proceed with caution.
Edit File
Edit the following file: /etc/default/grub
(Going to touch Linux, which I'm not familiar with, so scared)
# 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"
Reboot
Trembling, I typed into the terminal:
sudo update-grub #必须要有这一步
sudo reboot
Verification
Fortunately, it started successfully.
You can see that cAdvisor started successfully.