在 16.04 上,昨晚尝试了 Ubuntu 更新程序后,它挂起了(如果我没记错的话,是在 initramfs 上)。过了很长时间,我关闭了它并寻找解决方案,我尝试了所有方法(我希望我记得所有方法):
sudo dpkg --configure -a
-> 挂起
$ sudo apt-get --purge remove linux-image-4.4.0-112-generic linux-image-extra-4.4.0-112-generic
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
$ sudo dpkg --purge remove linux-image-4.4.0-112-generic linux-image-extra-4.4.0-112-generic
dpkg: warning: ignoring request to remove remove which isn't installed
dpkg: warning: ignoring request to remove linux-image-4.4.0-112-generic which isn't installed
(Reading database... 756101 files and directories currently installed.)
Removing linux-image-extra-4.4.0-112-generic (4.4.0-112.135) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-112-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-112-generic /boot/vmlinuz-4.4.0-112-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-112-generic /boot/vmlinuz-4.4.0-112-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-112-generic /boot/vmlinuz-4.4.0-112-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-112-generic
depmod: WARNING: could not open /var/tmp/mkinitramfs_2OAOqm/lib/modules/4.4.0-112-generic/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_2OAOqm/lib/modules/4.4.0-112-generic/modules.builtin: No such file or directory
$ uname -a
Linux tnt440s 4.4.0-109-generic #132-Ubuntu SMP Tue Jan 9 19:52:39 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
我也这样做了,在互联网上的某个地方找到了:
sudo rm /var/lib/initramfs-tools/4.4.0-112-generic
我现在害怕重新启动,因为我以前遇到过内核损坏的情况(但看来我现在仍然使用内核 4.4.0-109,正在寻找一种方法来修复未完全安装的新内核并apt-upgrade
重新开始工作。
更新:
我可以删除除包之外的所有linux-image-extra
包,尝试强制安装它(apt-get install -f
)让我手动运行dpkg --configure -a
),但它再次像上面一样挂起。
因此发现在 Ubuntu 论坛上,我删除了
/var/lib/dpkg/updates
然后允许我再次强制安装该软件包 - 但它给我带来了原始错误:挂起update-initramfs
:
Selecting previously unselected package linux-image-4.4.0-112-generic.
(Reading database ... 756103 files and directories currently installed.)
Preparing to unpack .../linux-image-4.4.0-112-generic_4.4.0-112.135_amd64.deb ...
Done.
Unpacking linux-image-4.4.0-112-generic (4.4.0-112.135) ...
Setting up linux-firmware (1.157.15) ...
update-initramfs: Generating /boot/initrd.img-4.4.0-112-generic
答案1
最后,可怕的重启成功了,让我执行了
dpkg --configure -a
之后我能够通过安装内核apt-get install
,问题似乎已经解决。