Article

Ubuntu24解决安装cAdvisor提示找不到 CPU 的挂载点错误

运维笔记发布于·更新于
#cAdvisor#Grafana#监控#Ubuntu#Linux#服务器

问题复现H1#

今天想折腾下Grafana+cadvisor+Prometheus的组合来监控下服务器的Docker应用

但部署cadvisor时出现了点问题:

Docker命令:

bash
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

容器启动失败:

log
F1006 07:45:20.802587       1 cadvisor.go:146] Failed to create a Container Manager: mountpoint for cpu not found

查了一下ds和bing,结论是Ubuntu24使用了cgroup v2,但cAdvisor依然尚不支持

那很糟糕了

遂有此文

解决方案H1#

参考这篇博文 (CSDN难得有好文章)

编辑GRUB文件其实是一个相当危险的行为,请量力而行

(要碰我不熟悉的Linux了,好害怕)

diff
# 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"

重启H2#

瑟瑟发抖地在终端中敲下了:

bash
sudo update-grub #必须要有这一步
sudo reboot

验证H2#

万幸启动成功了

可以看见cAdvisor启动成功

Copyright & License
© 2025 Teror Fox
Ubuntu24解决安装cAdvisor提示找不到 CPU 的挂载点错误
CC知识共享许可
BY署名:必须保留原作者署名
NC非商业:禁止用于商业目的
SA相同方式共享:以同协议发布
许可协议:署名-非商业性使用-相同方式共享
Teror Fox
Teror Fox离线