环境:
Ubuntu 20.04 TLS
1、查看当前已有内核
dpkg --list|grep linux-image
dpkg --list|grep linux-headers
2、查看当前使用的内核版本
uname -r
3、卸载内核命令**(如果不想卸载内核不要执行这些命令)**
sudo apt purge linux-image-xxx# xxx表示上图中后面的数字
sudo apt purge linux-headers-xxx
sudo apt autoremove # 自动删除不用的安装包
卸载完内核后需要执行下列命令更新grub
sudo update-grub
4、关闭内核的自动更新
sudo apt-mark hold linux-image-xx.x.x-xx-generic
sudo apt-mark hold linux-headers-xx.x.x-xx-generic
sudo apt-mark hold linux-modules-extra-xx.x.x-xx-generic
5、重新启用内核更新
sudo apt-mark unhold linux-image-xx.x.x-xx-generic
sudo apt-mark hold linux-headers-xx.x.x-xx-generic
sudo apt-mark hold linux-modules-extra-xx.x.x-xx-generic
6、关闭内核自动更新(配置方法)[正在实验中]
# 修改以下文件
sudo vim /etc/apt/apt.conf.d/10periodic
sudo vim /etc/apt/apt.conf.d/20auto-upgrades
#关闭自动更新
APT::Periodic::Update-Package-Lists "0";
APT::Periodic::Download-Upgradeable-Packages "0";
APT::Periodic::AutocleanInterval "0";
APT::Periodic::Unattended-Upgrade "0";
#开启自动更新
APT::Periodic::Update-Package-Lists "2";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::AutocleanInterval "0";
APT::Periodic::Unattended-Upgrade "1";
如果觉得《linux自动升级关闭 Ubuntu关闭内核自动更新》对你有帮助,请点赞、收藏,并留下你的观点哦!