dpkg --configure -a 找到 initrd 映像时挂起

Yer*_*ray 5 apt dpkg

我有一个带有 GitLab 的 Ubuntu 14.04 LTS“桌面”。该系统在Windows Server 2012 R2上的虚拟机中运行。

机器每天运行“重要安全更新”、“推荐更新”和“不支持更新”的自动更新。不适用于“预发布更新”。

今天我登录系统,运行“sudo apt-get update”,但它无法完成,因为某些进程正在使用 dpkg。

我已经运行了“sudo apt-get update”并且它已更新但挂在:

Found linux image: /boot/vmlinuz-3.19.0-39-generic
Found initrd image: /boot/initrd.img.3.19.0-39-generic
Found linux image: /boot/vmlinuz-3.19.0-37-generic
Found initrd image: /boot/initrd.img.3.19.0-37-generic
Found linux image: /boot/vmlinuz-3.19.0-33-generic
Found initrd image: /boot/initrd.img.3.19.0-33-generic
Found linux image: /boot/vmlinuz-3.19.0-32-generic
Found initrd image: /boot/initrd.img.3.19.0-32-generic
Found linux image: /boot/vmlinuz-3.19.0-31-generic
Found initrd image: /boot/initrd.img.3.19.0-31-generic
Run Code Online (Sandbox Code Playgroud)

我重新启动并在同一点再次挂起“sudo apt-get升级”。

然后我尝试清理未使用的内核。我跑:

uname -r
Run Code Online (Sandbox Code Playgroud)

并得到:

3.19.0-39-generic
Run Code Online (Sandbox Code Playgroud)

所以我删除了 3.19.0-31、3.19.0-32 和 3.19.0-33:

sudo rm /boot/initrd.img.3.19.0-31-generic
sudo rm /boot/initrd.img.3.19.0-32-generic
sudo rm /boot/initrd.img.3.19.0-33-generic
sudo rm /boot/vmlinuz-3.19.0-31-generic
sudo rm /boot/vmlinuz-3.19.0-32-generic
sudo rm /boot/vmlinuz-3.19.0-33-generic
Run Code Online (Sandbox Code Playgroud)

然后,我尝试清除:

sudo apt-get purge linux-image-3.19.0-31-generic linux-image-3.19.0-32-generic linux-image-3.19.0-33-generic
Run Code Online (Sandbox Code Playgroud)

但该过程也挂起。
然后,我可以“更新”,但“升级”失败:

Found linux image: /boot/vmlinuz-3.19.0-39-generic
Found initrd image: /boot/initrd.img.3.19.0-39-generic
Found linux image: /boot/vmlinuz-3.19.0-37-generic
Found initrd image: /boot/initrd.img.3.19.0-37-generic
Run Code Online (Sandbox Code Playgroud)

在某些更新/升级时,它建议我运行dpkg --configure -a,但在上面的同一点也失败了。

另外,当我重新启动时,系统卡在“点屏幕”上。我必须“关闭”虚拟机并重新启动它才能进入它。

经过一段时间的apt-get update重启后apt-get upgradedpkg --configure -a我不知道如何,但一切又恢复正常了

现在我又遇到了同样的问题:

  1. 当我跑步时apt-get updateapt-get upgrade我得到:

    E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
    
    Run Code Online (Sandbox Code Playgroud)
  2. 当我运行时,sudo dpkg --configure -a它会在以下情况后挂起:

    Found linux image: /boot/vmlinuz-3.19.0-42-generic
    Found initrd image: /boot/initrd.img-3.19.0-42-generic
    Found linux image: /boot/vmlinuz-3.19.0-39-generic
    Found initrd image: /boot/initrd.img-3.19.0-39-generic
    
    Run Code Online (Sandbox Code Playgroud)
  3. 当我重新启动时,系统也会挂在“点屏幕”上

我对linux很菜鸟。有人可以在这里照亮一些吗?

Yer*_*ray 4

暂时解决了!

经过几次重新启动并尝试apt-get updateapt-get upgradeapt-get dist-upgrade和 后dpkg --configure -a,最后一个命令最终成功结束,其余命令也开始成功运行。

在此过程中更新至 3.19.0-42-generic 内核。

所以我不确定到底是什么导致了它,也不知道到底是什么解决了它,但无论如何......:)


Dnr*_*vil 1

看起来你在某个时候升级了内核,但并没有完全完成,我将通过运行以下命令来确保内核正确:

sudo apt-get dist-upgrade
Run Code Online (Sandbox Code Playgroud)

然后更新升级:

sudo apt-get update && sudo apt-get upgrade
Run Code Online (Sandbox Code Playgroud)

接下来您可以通过运行来检查所有包是否正确

sudo apt-get -f install
Run Code Online (Sandbox Code Playgroud)