额外信息

额外信息

每当我安装任何新内核(或升级内核)时,都会出现很多错误。

我这样做之后得到的错误

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。

答案1

看看这个:无法删除内核“run-parts:/etc/kernel/postrm.d/zz-update-grub 退出,返回代码 1”,我想到了一个解决办法。

尝试重命名 grub 脚本以便绕过它。这不是一个长期的解决方案,但您可能能够运行更新。

sudo mv /etc/kernel/postrm.d/zz-update-grub /etc/kernel/postrm.d/zz-update-grub.bad

然后更新

sudo apt update && sudo apt full-upgrade

您可以使用以下命令获取已安装内核的列表:

dpkg -l | tail -n +6 | grep -E 'linux-image-[0-9]+' | grep -Fv $(uname -r)

在上述命令的输出中,请注意“ii”表示已安装,“rc”表示已删除,“rH”表示半删除、损坏或类似情况。

您应该始终查看当前正在使用哪个内核(uname -r)并且永远不要删除这个内核!

然后您可以删除有问题的内核(这里是 linux-image-4.18.0-17-generic):

sudo apt remove --purge linux-image-4.18.0-17-generic

最后将 grub 脚本放回原位。

sudo mv /etc/kernel/postrm.d/zz-update-grub.bad /etc/kernel/postrm.d/zz-update-grub

相关内容