首先,我相信我应该说我本周早些时候刚刚安装了 Ubuntu 18.04 LTS,所以我基本上什么都不知道。
我今天正在安装python3 idle并且遇到了一个错误:
dpkg: error processing package linux-modules-4.15.0-22-generic (--configure):
package is in a very bad inconsistent state; you should
reinstall it before attempting configuration
No apport report written because the error message indicates its a followup error from a previous failure.
dpkg: dependency problems prevent configuration of linux-image-4.15.0-22-generic:
linux-image-4.15.0-22-generic depends on linux-modules-4.15.0-22-generic; however:
Package linux-modules-4.15.0-22-generic is not configured yet.
dpkg: error processing package linux-image-4.15.0-22-generic (--configure):
dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.27-3ubuntu1) ...
dpkg: dependency problems prevent configuration of linux-modules-extra-4.15.0-22-generic:
linux-modules-extra-4.15.0-22-generic depends on linux-image-4.15.0-22-generic | linux-image-unsigned-4.15.0-22-generic; however:
Package linux-image-4.15.0-22-generic is not configured yet.
Package linux-image-unsigned-4.15.0-22-generic is not installed.
dpkg: error processing package linux-modules-extra-4.15.0-22-generic (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Processing triggers for man-db (2.8.3-2) ...
Processing triggers for gnome-menus (3.13.3-11ubuntu1) ...
Setting up libtcl8.6:amd64 (8.6.8+dfsg-3) ...
dpkg: dependency problems prevent configuration of linux-image-generic:
linux-image-generic depends on linux-image-4.15.0-22-generic; however:
Package linux-image-4.15.0-22-generic is not configured yet.
linux-image-generic depends on linux-modules-extra-4.15.0-22-generic; however:
Package linux-modules-extra-4.15.0-22-generic is not configured yet.
dpkg: error processing package linux-image-generic (--configure):
dependency problems - leaving unconfigured
Setting up libtk8.6:amd64 (8.6.8-4) ...
No apport report written because MaxReports is reached already
Setting up tk8.6-blt2.5 (2.5.3+dfsg-4) ...
dpkg: dependency problems prevent configuration of linux-generic:
linux-generic depends on linux-image-generic (= 4.15.0.22.23); however:
Package linux-image-generic is not configured yet.
dpkg: error processing package linux-generic (--configure):
dependency problems - leaving unconfigured
Setting up blt (2.5.3+dfsg-4) ...
No apport report written because MaxReports is reached already
Setting up python3-tk:amd64 (3.6.5-3) ...
Setting up idle-python3.6 (3.6.5-3) ...
Setting up idle (3.6.5-3) ...
Setting up idle3 (3.6.5-3) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Errors were encountered while processing:
linux-modules-4.15.0-22-generic
linux-image-4.15.0-22-generic
linux-modules-extra-4.15.0-22-generic
linux-image-generic
linux-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
所以我Sudo apt-get upgrade
认为这只是升级linux模块,我得到了同样的错误信息。我在网上查找错误消息,发现这篇帖子具有相同的错误消息。所以我首先运行了询问者使用的命令:sudo apt-get install -f
并收到了以下错误消息:
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.
Need to get 0 B/12.9 MB of archives.
After this operation, 0 B of additional disk space will be used.
dpkg: error processing package linux-modules-4.15.0-22-generic (--configure):
package is in a very bad inconsistent state; you should
reinstall it before attempting configuration
dpkg: dependency problems prevent configuration of linux-image-4.15.0-22-generic:
linux-image-4.15.0-22-generic depends on linux-modules-4.15.0-22-generic; however:
Package linux-modules-4.15.0-22-generic is not configured yet.
dpkg: error processing package linux-image-4.15.0-22-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.
dpkg: dependency problems prevent configuration of linux-modules-extra-4.15.0-22-generic:
linux-modules-extra-4.15.0-22-generic depends on linux-image-4.15.0-22-generic | linux-image-unsigned-4.15.0-22-generic; however:
Package linux-image-4.15.0-22-generic is not configured yet.
Package linux-image-unsigned-4.15.0-22-generic is not installed.
dpkg: error processing package linux-modules-extra-4.15.0-22-generic (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-image-generic:
linux-image-generic depends on linux-image-4.15.0-22-generic; however:
Package linux-image-4.15.0-22-generic is not configured yet.
linux-image-generic depends on linux-modules-extra-4.15.0-22-generic; however:
Package linux-modules-extra-4.15.0-22-generic is not configured yet.
dpkg: error processing package linux-image-generic (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-genNo apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
eric:
linux-generic depends on linux-image-generic (= 4.15.0.22.23); however:
Package linux-image-generic is not configured yet.
dpkg: error processing package linux-generic (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
linux-modules-4.15.0-22-generic
linux-image-4.15.0-22-generic
linux-modules-extra-4.15.0-22-generic
linux-image-generic
linux-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
我的理解与第一个有点不同,第一个说包没有配置,第二个说我应该重新安装它,因为它在配置之前处于错误状态。它给出了与提问者几乎相同的错误消息。所以我尝试了接受的答案中提到的步骤。我运行了这个命令sudo rm /etc/apt/sources.list
,然后运行了这个命令,sudo software-properties-gtk
我收到了这个错误消息:
WARNING:root:could not open file '/etc/apt/sources.list'
WARNING:root:could not open file '/etc/apt/sources.list'
所以我再次编写了第二个命令,它打开了 software-properties-gtk 并将其写入终端:
Gtk-Message: 20:43:48.389: GtkDialog mapped without a transient parent. This is discouraged.
所以我使用了这些设置。我点击了Revert,什么也没发生。我再次击中它,仍然没有发生任何事情。所以,我点击关闭并收到此错误消息/通知。我意识到我无法按照该教程进行操作,因为他只是清除了 chrome 而我无法清除 linux 模块。所以,我重新运行sudo apt-get -f install
,现在它显示了一条更短的错误消息:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: The package linux-modules-4.15.0-22-generic needs to be reinstalled, but I can't find an archive for it.
我试过sudo apt-get clean
了,终端上什么也没有显示,然后我尝试使用我在这篇文章中看到的这个命令:sudo apt-get install --reinstall linux-modules-4.15.0-22-generic
我不知道这是否是要重新安装的包的名称,但值得一试。我得到了同样的错误信息。
我弄坏了什么吗?我需要重新格式化我的系统吗?
编辑:输出ls -la /etc/apt/sources.list
是-rw-r--r-- 1 root root 84 May 26 20:43 /etc/apt/sources.list
的输出uname -a
是Linux Oussema 4.15.0-20-generic #21-Ubuntu SMP Tue Apr 24 06:16:15 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
从评论中我可以读到你已经清理了你的 sources.list 文件,所以让我们首先通过将以下块复制到你的终端来解决这个问题:
现在我们可以开始修复您的安装,它似乎最终处于一种奇怪的状态。
在运行更新以更新正确的包档案后,首先删除可移动包:
到目前为止,这应该删除所有可移动的包,除了那些设法弄乱的包,然后我们可以通过安装它然后正确地删除它来删除它:
现在通过运行清理档案:
现在我们可以在运行完整的更新过程后正确重新安装软件包:
使用以下行:
这应该已将您的系统再次修复为完整的工作状态。玩得开心,欢迎来到 Linux 社区。
如果上述所有解决方案都不起作用并且在执行“sudo apt autoremove --purge”或大多数与“sudo dpkg --configure -a”类似的apt或dpkg相关命令时遇到问题,并且以下原因粘贴确切的真实场景问题: >
即使在给予完全许可后拒绝使用
即使那样仍然面临许可被拒绝的问题,而不是许可问题,因为即使由于 grub 问题而给予许可,请遵循以下步骤
执行以下操作:>
(如果没有找到任何问题 menu.lst)
否则继续以下操作:>
如果提示无法选择需要安装引导加载程序的位置,请安装维护者版本继续不选择磁盘如果使用 scsi 磁盘 sd(a,b,c) 分区磁盘带有 1,2,3 附加的 gui 将提示警告如果使用 HDD,则内部的分区数 hd(a,b,c) 分区磁盘带有 1,2,3 附加在 ex:hda1,hda2,hdb1 中的分区数
sda 或 hda 这将安装在为引导分配的磁盘的主分区或根分区中。
如果更新没有问题,请检查以下命令,您已获得最新的引导加载程序,并且与更新相关的所有问题都将被删除,apt 和 dpkg 命令将正常工作。
我已经用这个图像的两个不同版本两次遇到这个问题。在这里查看我的修复:https ://askubuntu.com/a/1141915/954416
在进行了 apt update 和 apt upgrade 之后,我今天在两台不同的机器上遇到了这个问题,除了我的是针对 linux-image-4.15.0-48-generic 的。(Ubuntu 18.04.2)
我的修复是这样的(在两台机器上复制):
然后重新安装软件包:
这会将包设置为手动安装并替换 *.postinst 文件。