`dpkg --configure -a` 停顿了

9
我正在使用Ubuntu 16.04。
当我进行更新时,我收到了以下消息。
$ sudo apt-get update
....
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem. 

根据错误信息,我尝试...
$ sudo dpkg --configure -a
setting up snapd (2.14.2~16.04) ...

然后它永远挂起。 有人知道我该如何解决这个问题吗? 谢谢。
3个回答

4

这是一个已确认的错误。

https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1621336

列出了一种解决方法:

https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1621336/comments/4

由于链接似乎已经失效,根据Axel Kämpfe的解决方法,以下是操作步骤:

  1. 使用"sudo -i"命令启动rootshell。
  2. 运行echo "bash -c 'service snapd.boot-ok start'" | at now + 4 min命令。
  3. 然后运行apt install snapd命令(如果它提示取消了dpkg进程,请使用dpkg --configure -a命令)。等待至少4分钟,挂起状态应该会消失。

祝你好运! :)

/Patrik


1
死链接。在链接时,始终将链接的相关部分包含在答案本身中。 - Adam
1
好的观点。通过谷歌缓存找到了原始帖子。不用谢。 - PatrikJ
@PatrikJ 自从我有了新的Linux虚拟机,当我运行"echo "bash -c 'service snapd.boot-ok start'" | at now + 4 min"时,它显示找不到"at"命令。当我尝试安装它时,它提示我应该运行"dpkg --configure -a",但这个命令一直卡住,就像我陷入了无限循环中一样。 - the_yaz2000

2

我曾经遇到过类似的问题两次,我注意到每当系统想要升级到新内核时就会发生这种情况。以下步骤似乎总是有效:

  1. Boot into the recovery mode of your newest kernel versions.
  2. Log-in to the system as root from the drop-down menu.
  3. Edit the /etc/resolv.conf file using a text editor, I normally use vi, i.e.

    vi /etc/resolv.conf 
    

    and put in the contents below and save file;

    nameserver 208.67.222.220
    nameserver 208.67.222.222
    
  4. After the above step, Ctrl+D (exit) back into the recovery mode menu and click on networking to enable network/internet connection.

  5. Next, click on the dpkg item to fix broken packages.

就是这样,重启后你的系统应该安装了正确的内核,并修复/删除了损坏的软件包。


0
  1. 确定导致 dpkg --configure -a 卡住的应用程序。

例如: snapd

  1. 执行以下命令:

sudo apt-get remove snapd

在我的情况下,我输入了以下命令:

sudo apt-get remove mysql-server-8.0

  1. 如有必要,重新安装应用程序。

希望这也对您有所帮助。祝健康!


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接