Ubuntu24解决安装cAdvisor提示找不到 CPU 的挂载点错误
问题复现
今天想折腾下Grafana
+cadvisor
+Prometheus
的组合来监控下服务器的Docker应用
但部署cadvisor时出现了点问题:
Docker命令:
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
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
依然尚不支持
那很糟糕了
遂有此文
解决方案
参考这篇博文 (CSDN难得有好文章)
::: banner {error}
编辑GRUB文件其实是一个相当危险的行为,请量力而行
:::
编辑文件
编辑如下文件:/etc/default/grub
(要碰我不熟悉的Linux了,好害怕)
# 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"
sudo update-grub #必须要有这一步
sudo reboot
可以看见cAdvisor启动成功
评论
0 条评论