ubuntu内核卸载、禁止自动更新
sudo dpkg --get-selections | grep linux
查看当前使用的内核
uname -a
//如果出现不存在,则跳过
卸载不用的内核
sudo apt remove linux-image-5.8.0-59-generic
sudo apt remove linux-headers-5.8.0-59
sudo apt remove linux-headers-5.8.0-59-generic
sudo apt remove linux-modules-5.8.0-59-generic
删除对应的源码
sudo rm -rf /boot/vmlinuz-5.8.0-59-generic-*
sudo rm -rf /boot/initrd-5.8.0-59-generic-*
sudo rm -rf /boot/System-map-5.8.0-59-generic-*
sudo rm -rf /boot/config-5.8.0-59-generic
sudo rm -rf /lib/modules/5.8.0-59-generic-*
禁止更新
sudo apt-mark hold linux-image-5.8.0-48-generic
sudo apt-mark hold linux-image-extra-5.8.0-48-generic
sudo apt-mark hold linux-headers-5.8.0-48-generic
sudo apt-mark hold linux-modules-5.8.0-48--generic
sudo apt-mark hold linux-modules-extra-5.8.0-48-generic
sudo apt-mark hold linux-hwe-5.11-headers-5.11.0-37
如果需要恢复原来的设定的话即允许更新内核,执行如下命令即可:
sudo apt-mark unhold linux-image-5.8.0-48-generic
sudo apt-mark unhold linux-image-extra-5.8.0-48-generic
sudo apt-mark unhold linux-headers-5.8.0-48-generic
sudo apt-mark unhold linux-modules-5.8.0-48--generic
sudo apt-mark unhold linux-modules-extra-5.8.0-48-generic