ubuntu禁止和启动内核更新的两种方式

x33g5p2x  于2021-12-28 转载在 Linux  
字(1.0k)|赞(0)|评价(0)|浏览(448)

症状:

内核更新可能会由于内核与驱动不匹配,导致系统无限重启
1.
方式一(apt命令):

#查看已安装的内核
sudo dpkg --get-selections | grep linux

#查看正在使用的内核
uname -r

#使用apt命令禁止内核更新
sudo apt-mark hold linux-image-4.4.0-21-generic
sudo apt-mark hold linux-image-extra-4.4.0-21-generic

dpkg --list | grep linux-image
 dpkg --list | grep linux-headers
  dpkg --list | grep linux-modules
  
  apt-mark hold linux-image-5.4.0-70-generic
  apt-mark hold linux-headers-5.4.0-70-generic
  apt-mark hold linux-modules-extra-5.4.0-70-generic

#重启内核更新
sudo apt-mark unhold linux-image-4.4.0-21-generic
sudo apt-mark unhold linux-image-extra-4.4.0-21-generic

方式二(修改配置文件):

修改以下文件

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";
 

相关文章