新安装(Ubuntu 16.04 LTS)后,我无法通过apt更新或安装任何东西。我可以成功运行apt update,但如果我接着运行apt upgrade或apt dist-upgrade,它总是(我尝试了无数次重启后,以及从恢复模式下尝试)导致以下结果:
如果我运行它,它总是做以下的事情,并且无限期地停滞不前:
这是一个全新安装,所以我不担心任何可能导致数据丢失的“核选项”(即我没有要丢失的数据)。我尝试过使用boot-repair,但它从未完成(它说可能需要几分钟,但我让它运行了几个小时)。
我意识到这个问题与E: dpkg was interrupted... run 'sudo dpkg --configure -a'和dpkg --configure -a hangs when found initrd image之间存在相似之处,但没有一个答案对我有帮助。
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
如果我运行它,它总是做以下的事情,并且无限期地停滞不前:
Setting up grub-efi-amd64 (2.02~beta2-36ubuntu3.12) ...
Installing for x86_64-efi platform.
Installation finished. No error reported.
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.10.0-35-generic
Found initrd image: /boot/initrd.img-4.10.0-35-generic
Found linux image: /boot/vmlinuz-4.10.0-28-generic
Found initrd image: /boot/initrd.img-4.10.0-28-generic
uname -r
显示正在运行的版本为4.10.0-35-generic
,所以我可以放心删除4.10.0-28-generic
,因为它总是出现问题,但是我无法清除它,因为当执行apt purge
到Found initrd image: /boot/initrd.img-4.10.0-28-generic
时就会挂起。
我已经尝试了每种可能的排序,但都没有成功。
sudo dpkg --configure -a
sudo apt install -f
sudo apt clean
sudo apt update
sudo apt upgrade|dist-upgrade|full-upgrade
这是一个全新安装,所以我不担心任何可能导致数据丢失的“核选项”(即我没有要丢失的数据)。我尝试过使用boot-repair,但它从未完成(它说可能需要几分钟,但我让它运行了几个小时)。
我意识到这个问题与E: dpkg was interrupted... run 'sudo dpkg --configure -a'和dpkg --configure -a hangs when found initrd image之间存在相似之处,但没有一个答案对我有帮助。
apt
而不是apt-get
,使用full-upgrade
而不是dist-upgrade
来执行任何16.04+的操作系统。现在,请重新启动计算机。然后运行sudo apt update
,再运行sudo apt full-upgrade
,如果出现任何错误,请编辑并发布完整的错误信息。 - user692175apt
和apt-get
之间没有区别,但尽管如此,我一直在使用apt
。上面的代码块中的apt-get是从一个帖子中复制过来的,但我会编辑它以显示apt
。至于full-upgrade
,它导致了与upgrade
或dist-upgrade
相同的错误(在我问题的顶部显示的“dpkg被中断…”)。 - frostmatthew