Ubuntu 提示 boot 空间不足的解决办法
Ubuntu 提示 boot 空间不足的解决办法
一、查看当前系统使用的内核相关信息。
root@gpu2:~# uname -r
4.4.0-142-generic
二、查看安装的内核信息
root@gpu2:~# dpkg --get-selections | grep linux-image
linux-image-4.4.0-108-generic deinstall
linux-image-4.4.0-109-generic deinstall
linux-image-4.4.0-116-generic deinstall
linux-image-4.4.0-119-generic deinstall
linux-image-4.4.0-121-generic deinstall
linux-image-4.4.0-124-generic deinstall
linux-image-4.4.0-127-generic deinstall
linux-image-4.4.0-128-generic install
linux-image-4.4.0-130-generic deinstall
linux-image-4.4.0-133-generic deinstall
linux-image-4.4.0-134-generic deinstall
linux-image-4.4.0-137-generic deinstall
linux-image-4.4.0-138-generic deinstall
linux-image-4.4.0-139-generic deinstall
linux-image-4.4.0-141-generic deinstall
linux-image-4.4.0-142-generic install
linux-image-4.4.0-168-generic deinstall
linux-image-4.4.0-169-generic install
linux-image-4.4.0-170-generic install
linux-image-4.4.0-21-generic deinstall
linux-image-4.4.0-98-generic deinstall
linux-image-extra-4.4.0-108-generic deinstall
linux-image-extra-4.4.0-109-generic deinstall
linux-image-extra-4.4.0-112-generic deinstall
linux-image-extra-4.4.0-116-generic deinstall
linux-image-extra-4.4.0-119-generic deinstall
linux-image-extra-4.4.0-121-generic deinstall
linux-image-extra-4.4.0-124-generic deinstall
linux-image-extra-4.4.0-127-generic deinstall
linux-image-extra-4.4.0-128-generic install
linux-image-extra-4.4.0-130-generic deinstall
linux-image-extra-4.4.0-133-generic deinstall
linux-image-extra-4.4.0-134-generic deinstall
linux-image-extra-4.4.0-137-generic deinstall
linux-image-extra-4.4.0-138-generic deinstall
linux-image-extra-4.4.0-139-generic deinstall
linux-image-extra-4.4.0-141-generic deinstall
linux-image-extra-4.4.0-142-generic install
linux-image-extra-4.4.0-98-generic deinstall
linux-image-generic install
deinstall 表示该旧内核已经被删除了,需要的是删除不用的内核。
三、删除旧内核及解决问题
删除现在还在安装但是已经不再使用的内核
apt remove linux-image-4.4.0-128-generic linux-image-4.4.0-169-generic linux-image-4.4.0-170-generic linux-image-extra-4.4.0-128-generic linux-image-generic
运行命令 sudo /usr/sbin/update-grub 更新即可。
若在安装软件过程中提示系统中有多余的不被依赖的包,可以运行 sudo apt-get autoremove 以删除无用的包。
关闭自动更新内核
# cat /etc/apt/apt.conf.d/10periodic
APT::Periodic::Update-Package-Lists "0"; # 将1修改为0
APT::Periodic::Download-Upgradeable-Packages "0";
APT::Periodic::AutocleanInterval "0";
添加到ubuntu的基础配置中禁止自动更新内核文件
编写salt配置文件
/etc/apt/apt.conf.d/10periodic:
file.managed:
- user: root
- group: root
- mode: 644
- source: salt://UBUNTU/base/10periodic
推送配置到所有机器上
salt -G "os:Ubuntu" state.sls UBUNTU.base.init