添加了 cpu 子系统的自动挂载配置(比如类似 none /sys/fs/cgroup/cpu cgroup defaults,cpu 0 0 的行),目的是让系统启动时自动挂载 cpu 子系统,避免每次手动挂载。
none /sys/fs/cgroup/cpu cgroup defaults,cpu,cpuacct 0 0
=========================================================================================================================
shitou@aishitou:~/monitor$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda2 during curtin installation
/dev/disk/by-uuid/975f86b3-b8ea-4365-902d-5c61c0ad749c / ext4 defaults 0 1
# /boot was on /dev/sda3 during curtin installation
/dev/disk/by-uuid/069c7f52-682b-45f4-8c2e-2f2f38f9c60a /boot ext4 defaults 0 1
/dev/disk/by-uuid/8b865cd9-1d8f-48e5-bfe6-6a649909b853 none swap sw 0 0
# /boot/efi was on /dev/sda1 during curtin installation
/dev/disk/by-uuid/2D20-0B2E /boot/efi vfat defaults 0 1
none /sys/fs/cgroup/cpu cgroup defaults,cpu,cpuacct 0 0
-------------------------------------------------------------------------------------------
shitou@aishitou:~/monitor$ cat /etc/fstab.bf
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda2 during curtin installation
/dev/disk/by-uuid/975f86b3-b8ea-4365-902d-5c61c0ad749c / ext4 defaults 0 1
# /boot was on /dev/sda3 during curtin installation
/dev/disk/by-uuid/069c7f52-682b-45f4-8c2e-2f2f38f9c60a /boot ext4 defaults 0 1
/dev/disk/by-uuid/8b865cd9-1d8f-48e5-bfe6-6a649909b853 none swap sw 0 0
# /boot/efi was on /dev/sda1 during curtin installation
/dev/disk/by-uuid/2D20-0B2E /boot/efi vfat defaults 0 1
===========================================================================================================
-------------------------------------------------------------------------------
shitou@aishitou:~$ sudo mount -a
mount: /sys/fs/cgroup/cpu: none already mounted or mount point busy.
dmesg(1) may have more information after failed mount system call.
mount: (hint) your fstab has been modified, but systemd still uses
the old version; use 'systemctl daemon-reload' to reload.
shitou@aishitou:~$ mount | grep cgroup | grep cpu
cpuacct on /sys/fs/cgroup/cpuacct type cgroup (rw,relatime,cpuacct)
--------------------------------------------------------------------------------
执行 sudo mount -a 让 fstab 中的配置立即生效(无需重启),但报错 mount: /sys/fs/cgroup/cpu: none already mounted or mount point busy,说明:
要么 cpu 子系统已通过其他方式挂载(但实际 mount | grep cgroup | grep cpu 显示未挂载,更可能是冲突);
要么与系统当前的 cgroup v2 机制冲突(cgroup v2 是统一挂载,不支持 v1 子系统的单独挂载)。
也就是从这个时候开始切换的
---------------------------------------------------------------------------------------------------
========================================================================================================
shitou@aishitou:~$ sudo nano /etc/fstab
shitou@aishitou:~$ sudo umount /sys/fs/cgroup/cpu
umount: /sys/fs/cgroup/cpu: not mounted.
尝试卸载/sys/fs/cgroup/cpu这个挂载点(取消该目录与 cgroupcpu子系统的关联)。
但提示not mounted,说明该目录当前并未被挂载,无需卸载。
shitou@aishitou:~$ sudo systemctl daemon-reload
重新加载配置文件
shitou@aishitou:~$ sudo umount /sys/fs/cgroup/cpu
umount: /sys/fs/cgroup/cpu: not mounted.
shitou@aishitou:~$ sudo systemctl daemon-reload
shitou@aishitou:~$ sudo mount -a
mount: /sys/fs/cgroup/cpu: none already mounted or mount point busy.
dmesg(1) may have more information after failed mount system call.
挂载/etc/fstab中所有未挂载的文件系统(按配置自动挂载)。
这里报错/sys/fs/cgroup/cpu: none already mounted or mount point busy,说明fstab中关于/sys/fs/cgroup/cpu的配置与当前系统(仍在使用 cgroup v2)冲突,无法挂载。
shitou@aishitou:~$ mount | grep cgroup | grep cpu
cpuacct on /sys/fs/cgroup/cpuacct type cgroup (rw,relatime,cpuacct)
查看系统中与cgroup和cpu相关的挂载记录。
输出cpuacct on /sys/fs/cgroup/cpuacct...说明cpuacct子系统已挂载,但cpu子系统仍未挂载(这正是cadvisor报错的核心原因)。
---------------------------------------------------------------------------------------------------
cpuacct:这是 cgroup(控制组)的一个子系统,主要用于CPU 资源使用的计量(accounting),即跟踪和统计进程或进程组消耗的 CPU 时间(用户态、内核态等)。
on /sys/fs/cgroup/cpuacct:表示 cpuacct 子系统被挂载到了 /sys/fs/cgroup/cpuacct 目录下。通过这个目录,用户可以配置和查看该子系统的相关参数(如进程组的 CPU 使用统计)。
type cgroup:说明这是一个 cgroup 类型的文件系统(cgroup 本质上是通过特殊文件系统实现的资源管理机制)。
(rw,relatime,cpuacct):挂载选项。其中:
rw 表示该文件系统以可读写模式挂载;
relatime 表示文件访问时间会相对延迟更新(优化性能);
cpuacct 是该 cgroup 子系统的标识。
改回,默认为v2
shitou@aishitou:~/monitor$ sudo cp /etc/fstab /etc/fstab.v1
shitou@aishitou:~/monitor$ sudo rm /etc/fstab
shitou@aishitou:~/monitor$ sudo cp /etc/fstab.
fstab.bf fstab.v1
shitou@aishitou:~/monitor$ sudo cp /etc/fstab.bf /etc/fstab
shitou@aishitou:~/monitor$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda2 during curtin installation
/dev/disk/by-uuid/975f86b3-b8ea-4365-902d-5c61c0ad749c / ext4 defaults 0 1
# /boot was on /dev/sda3 during curtin installation
/dev/disk/by-uuid/069c7f52-682b-45f4-8c2e-2f2f38f9c60a /boot ext4 defaults 0 1
/dev/disk/by-uuid/8b865cd9-1d8f-48e5-bfe6-6a649909b853 none swap sw 0 0
# /boot/efi was on /dev/sda1 during curtin installation
/dev/disk/by-uuid/2D20-0B2E /boot/efi vfat defaults 0 1
shitou@aishitou:~/monitor$ cat /etc/fstab.
fstab.bf fstab.v1
shitou@aishitou:~/monitor$ cat /etc/fstab.v1
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda2 during curtin installation
/dev/disk/by-uuid/975f86b3-b8ea-4365-902d-5c61c0ad749c / ext4 defaults 0 1
# /boot was on /dev/sda3 during curtin installation
/dev/disk/by-uuid/069c7f52-682b-45f4-8c2e-2f2f38f9c60a /boot ext4 defaults 0 1
/dev/disk/by-uuid/8b865cd9-1d8f-48e5-bfe6-6a649909b853 none swap sw 0 0
# /boot/efi was on /dev/sda1 during curtin installation
/dev/disk/by-uuid/2D20-0B2E /boot/efi vfat defaults 0 1
none /sys/fs/cgroup/cpu cgroup defaults,cpu,cpuacct 0 0