![依赖问题导致无法删除 linux-image](https://linux22.com/image/1196601/%E4%BE%9D%E8%B5%96%E9%97%AE%E9%A2%98%E5%AF%BC%E8%87%B4%E6%97%A0%E6%B3%95%E5%88%A0%E9%99%A4%20linux-image.png)
最近我的 Linux 自行更新了内核,因此导致我的启动内存不足,我试图删除旧的 Linux 内核版本:6.2.0 和 5.19.0.45
saba@saba:~$ dpkg --list | grep linux-image
pi linux-image-5.19.0-45-generic 5.19.0-45.46~22.04.1 amd64 Signed kernel image generic
ii linux-image-5.19.0-46-generic 5.19.0-46.47~22.04.1 amd64 Signed kernel image generic
ii linux-image-5.19.0-50-generic 5.19.0-50.50 amd64 Signed kernel image generic
pi linux-image-6.2.0-26-generic 6.2.0-26.26~22.04.1 amd64 Signed kernel image generic
我正在尝试使用 Mainline Kernels 应用程序进行删除(我也尝试过手动删除,但结果是一样的)
但它显示以下错误:
mainline 1.4.8
uninstall 6.2.0-26.26~22.04.1
Uninstalling 6.2.0-26.26~22.04.1
dpkg: dependency problems prevent removal of linux-image-6.2.0-26-generic:
linux-signatures-nvidia-6.2.0-26-generic depends on linux-image-6.2.0-26-generic | linux-image-unsigned-6.2.0-26-generic; however:
Package linux-image-6.2.0-26-generic is to be removed.
Package linux-image-unsigned-6.2.0-26-generic is not installed.
linux-modules-nvidia-525-6.2.0-26-generic depends on linux-image-6.2.0-26-generic | linux-image-unsigned-6.2.0-26-generic; however:
Package linux-image-6.2.0-26-generic is to be removed.
Package linux-image-unsigned-6.2.0-26-generic is not installed.
dpkg: error processing package linux-image-6.2.0-26-generic (--purge):
dependency problems - not removing
dpkg: dependency problems prevent removal of linux-modules-6.2.0-26-generic:
linux-image-6.2.0-26-generic depends on linux-modules-6.2.0-26-generic.
dpkg: error processing package linux-modules-6.2.0-26-generic (--purge):
dependency problems - not removing
Errors were encountered while processing:
linux-image-6.2.0-26-generic
linux-modules-6.2.0-26-generic
mainline: done
无论内核版本是什么,都会出现同样的错误。
当我尝试手动删除它时,我会这样做:
sudo apt-get --purge remove linux-image-6.2.0-26-generic
在日志的末尾得到了这个
/var/lib/dpkg/info/linux-image-6.2.0-26-generic.postrm ... removing pending trigger
rmdir: failed to remove '/lib/modules/6.2.0-26-generic': Directory not empty
Processing triggers for linux-image-unsigned-6.2.0-26-generic (6.2.0-26.26~22.04.1) ...
dpkg --list | head -n 4
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
那么我该如何删除它们?为什么会发生这种情况?