每当我安装任何新内核(或内核升级)时,都会出现很多错误。
做完之后我得到的错误
sudo apt -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
5 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up linux-headers-4.18.0-17-generic (4.18.0-17.18) ...
/etc/kernel/header_postinst.d/dkms:
Error! Could not locate dkms.conf file.
File: does not exist.
run-parts: /etc/kernel/header_postinst.d/dkms exited with return code 4
dpkg: error processing package linux-headers-4.18.0-17-generic (--configure):
installed linux-headers-4.18.0-17-generic package post-installation script subprocess returned error exit status 1
Setting up linux-image-4.18.0-17-generic (4.18.0-17.18) ...
dpkg: dependency problems prevent configuration of linux-headers-generic:
linux-headers-generic depends on linux-headers-4.18.0-17-generic; however:
Package linux-headers-4.18.0-17-generic is not configured yet.
dpkg: error processing package linux-headers-generic (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-generic:
linux-generic depends on linux-headers-generic (= 4.18.0.17.18); however:
Package linux-headers-generic is not configured yet.
dpkg: error processing package linux-generic (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-signed-generic:
linux-signed-generic depends on linux-generic; however:
Package linux-generic is not configured yet.
dpkg: error processing package linux-signed-generic (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
No apport report written because the error message indicates its a followup error from a previous failure.
No apport report written because MaxReports is reached already
Processing triggers for linux-image-4.18.0-17-generic (4.18.0-17.18) ...
/etc/kernel/postinst.d/dkms:
Error! Could not locate dkms.conf file.
File: does not exist.
run-parts: /etc/kernel/postinst.d/dkms exited with return code 4
dpkg: error processing package linux-image-4.18.0-17-generic (--configure):
installed linux-image-4.18.0-17-generic package post-installation script subprocess returned error exit status 1
No apport report written because MaxReports is reached already
Errors were encountered while processing:
linux-headers-4.18.0-17-generic
linux-headers-generic
linux-generic
linux-signed-generic
linux-image-4.18.0-17-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
我已经尝试了其他问题中发布的所有内容
apt-get -f install
apt-get autoremove
apt-get remove linux-image-4.18.0-17-generic
我还使用 dpkg 和 ukuu 删除包 linux-image-4.18.0-17-generic 但没有任何效果
这是我尝试过的各种命令的输出
sudo dpkg --configure -a
Setting up linux-image-4.18.0-17-generic (4.18.0-17.18) ...
dpkg: dependency problems prevent configuration of linux-headers-generic:
linux-headers-generic depends on linux-headers-4.18.0-17-generic; however:
Package linux-headers-4.18.0-17-generic is not configured yet.
dpkg: error processing package linux-headers-generic (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-generic:
linux-generic depends on linux-headers-generic (= 4.18.0.17.18); however:
Package linux-headers-generic is not configured yet.
dpkg: error processing package linux-generic (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-signed-generic:
linux-signed-generic depends on linux-generic; however:
Package linux-generic is not configured yet.
dpkg: error processing package linux-signed-generic (--configure):
dependency problems - leaving unconfigured
Processing triggers for linux-image-4.18.0-17-generic (4.18.0-17.18) ...
/etc/kernel/postinst.d/dkms:
Error! Could not locate dkms.conf file.
File: does not exist.
run-parts: /etc/kernel/postinst.d/dkms exited with return code 4
dpkg: error processing package linux-image-4.18.0-17-generic (--configure):
installed linux-image-4.18.0-17-generic package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
linux-headers-generic
linux-generic
linux-signed-generic
linux-image-4.18.0-17-generic
sudo dpkg --purge linux-headers-4.18.0-17-generic
dpkg: dependency problems prevent removal of linux-headers-4.18.0-17-generic:
linux-headers-generic depends on linux-headers-4.18.0-17-generic.
dpkg: error processing package linux-headers-4.18.0-17-generic (--purge):
dependency problems - not removing
Errors were encountered while processing:
linux-headers-4.18.0-17-generic
额外信息
我无法删除 4.18.0-17 并且我在互联网上尝试了几乎所有内容,并且 askubuntu 上的所有答案都说同样的事情,这对我不起作用。我的系统上还安装了一堆 dkms 模块,但我很确定这是由于 wine 而发生的,因为这是除了 chrome 和 dkms 模块之外我安装的唯一额外的东西,并且在此错误发生之前我通常使用 ubuntu。
看着这个:Can't remove kernels "run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1",我想出了一个解决方案。
尝试重命名 grub 脚本以绕过它。这不是一个长期的解决方案,但您可以运行更新。
然后更新
您可以使用以下命令获取已安装内核的列表:
在上述命令的输出中,请注意“ii”表示已安装,“rc”表示已删除,“rH”表示已删除一半、已损坏等。
您应该始终查看当前正在使用哪个内核(
uname -r
)并且永远不要删除这个!然后您可以删除有问题的内核(此处为 linux-image-4.18.0-17-generic):
最后将 grub 脚本放回原处。