我最近发现我的 Ubuntu 22.04.2 LTS 上安装了一堆奇怪的内核,它们不知怎么安装的,但由于某种原因无法删除。
ii linux-image-5.15.0-1028-nvidia 5.15.0-1028.28 amd64 Signed kernel image nvidia
ii linux-image-5.15.0-1031-intel-iotg 5.15.0-1031.36 amd64 Signed kernel image intel-iotg
ii linux-image-5.15.0-1038-oracle 5.15.0-1038.44 amd64 Signed kernel image oracle
ii linux-image-5.15.0-25-generic 5.15.0-25.25 amd64 Signed kernel image generic
ii linux-image-5.15.0-76-lowlatency 5.15.0-76.83 amd64 Signed kernel image lowlatency
ii linux-image-5.17.0-1033-oem 5.17.0-1033.34 amd64 Signed kernel image oem
ii linux-image-5.19.0-1026-oracle 5.19.0-1026.29~22.04.1 amd64 Signed kernel image oracle
ii linux-image-5.19.0-46-generic 5.19.0-46.47~22.04.1 amd64 Signed kernel image generic
ii linux-image-generic-hwe-22.04 5.19.0.46.47~22.04.21 amd64 Generic Linux kernel image
ii linux-image-unsigned-5.19.0-1028-lowlatency 5.19.0-1028.29~22.04.1 amd64 Linux kernel image for version 5.19.0 on 64 bit x86 SMP
如果我尝试删除其中一个,操作系统也会使用未签名的版本重新安装它
johan@linux1:~$ sudo apt-get purge linux-image-5.15.0-1028-nvidia
[sudo] password for johan:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
linux-image-unsigned-5.15.0-1028-nvidia
Suggested packages:
fdutils linux-doc | linux-nvidia-source-5.15.0 linux-nvidia-tools linux-headers-5.15.0-1028-nvidia linux-modules-extra-5.15.0-1028-nvidia
The following packages will be REMOVED:
linux-image-5.15.0-1028-nvidia*
The following NEW packages will be installed:
linux-image-unsigned-5.15.0-1028-nvidia
0 upgraded, 1 newly installed, 1 to remove and 1 not upgraded.
Need to get 12,2 MB of archives.
After this operation, 559 kB of additional disk space will be used.
Do you want to continue? [Y/n] n
Abort.
johan@linux1:~$ sudo apt-get purge linux-image-5.15.0-1031-intel-iotg
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
linux-image-unsigned-5.15.0-1031-intel-iotg
Suggested packages:
fdutils linux-doc | linux-intel-iotg-source-5.15.0 linux-intel-iotg-tools linux-headers-5.15.0-1031-intel-iotg linux-modules-extra-5.15.0-1031-intel-iotg
The following packages will be REMOVED:
linux-image-5.15.0-1031-intel-iotg*
The following NEW packages will be installed:
linux-image-unsigned-5.15.0-1031-intel-iotg
0 upgraded, 1 newly installed, 1 to remove and 1 not upgraded.
Need to get 11,7 MB of archives.
After this operation, 522 kB of additional disk space will be used.
Do you want to continue? [Y/n]
所以,问题是……它们是如何安装的,我如何摆脱它们? GRUB 认为 /boot/vmlinuz-5.19.0-1028-lowlatency 应该是我的默认内核 :-(
答案1
有许多其他软件包依赖于映像包,当您删除映像包时,它们似乎会强制安装“冲突”未签名的软件包。只需删除整个组,它们的名称和版本号非常不同。查看软件包
apt-cache pkgnames |grep 5.17.0-1033
如果列表看起来不错,您可以在下一个命令中使用(后退符号和感叹号)清除整个列表:
sudo apt purge `!!`
不要对正在运行的内核执行此操作,(使用 uname -a 检查)如果 ...generic 是您想要的,请保留它和正在运行的内核,然后重新启动并选择通用内核,然后您可以删除最后一个不需要的内核。