ubuntu禁止内核自动更新

禁止Ubuntu 自动更新内核

Ubuntu 内核会经常自动更新,有时候系统重启时有可能会碰到以下问题:

1.Nvidia 显卡驱动找不到了,可能是因为内核版本与之前安装的驱动版本不匹配
2.导致循环登入问题,一直登入不进去

所以想在环境配好之后,禁止内核自动更新,省得出现没有必要的麻烦。
在解决了上述出现的问题之后,让咱们一起来把自动更新的内核禁止吧!

1.查看系统安装的内核有哪些

dpkg --get-selections | grep linux-image

在这里插入图片描述
2.查看系统正在使用的内核

uname -a

在这里插入图片描述

3.将系统正在使用的内核设置为禁止自动更新

sudo apt-mark hold linux-image-4.15.0-96-generic
sudo apt-mark hold linux-modules-extra-4.15.0-96-generic

在这里插入图片描述
之前查资料,有的人使用

sudo apt-mark hold linux-image-extra-4.15.0-96-generic

然后会报错

E: Unable to locate package linux-image-extra-4.15.0-96-generic
E:Couldn’t find any package by glob ‘linux-image-extra-4.15.0-96-generic’
E: Couldn’t find any package by regex 'linux-image-extra-4.15.0-96-generic’E: No packages found

因为库的名字换了。
如果你最后想把自动更新换回来,你可以使用以下命令

sudo apt-mark unhold linux-image-4.15.0-96-generic
sudo apt-mark unhold linux-modules-extra-4.15.0-96-generic

发布了3 篇原创文章 · 获赞 0 · 访问量 25

猜你喜欢

转载自blog.csdn.net/haijun7013/article/details/105454293