dpkg --configure -a 由于电池电量耗尽而失败

dpkg --configure -a 由于电池电量耗尽而失败

我像往常一样更新系统,并向sudo apt update我展示了一些需要更新的软件包。我运行sudo apt upgrade并下载了软件包。但是在安装过程中配置软件包时,计算机因电池电量不足而关闭。当我启动并尝试使用更新时,sudo apt update我收到以下消息:

E:dpkg 中断,您必须手动运行“sudo dpkg --configure -a”来解决问题。

当我执行时sudo dpkg --configure -a我得到了这个:

@mike-bravo:~$ sudo dpkg --configure -a
Setting up linux-image-4.4.0-96-generic (4.4.0-96.119) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
initrd.img(/boot/initrd.img-4.4.0-96-generic
) points to /boot/initrd.img-4.4.0-96-generic
 (/boot/initrd.img-4.4.0-96-generic) -- doing nothing at 
/var/lib/dpkg/info/linux-image-4.4.0-96-generic.postinst line 491.
vmlinuz(/boot/vmlinuz-4.4.0-96-generic
) points to /boot/vmlinuz-4.4.0-96-generic
 (/boot/vmlinuz-4.4.0-96-generic) -- doing nothing at 
/var/lib/dpkg/info/linux-image-4.4.0-96-generic.postinst line 491.
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-
96-generic /boot/vmlinuz-4.4.0-96-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-96-
generic /boot/vmlinuz-4.4.0-96-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-96-generic
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.4.0-96-generic 
/boot/vmlinuz-4.4.0-96-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 
4.4.0-96-generic /boot/vmlinuz-4.4.0-96-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-96-
generic /boot/vmlinuz-4.4.0-96-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.4.0-96-
generic /boot/vmlinuz-4.4.0-96-generic
/usr/sbin/grub-mkconfig: 252: /usr/sbin/grub-mkconfig: cannot create 
/boot/grub/grub.cfg.new: Read-only file system
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return 
code 2
Failed to process /etc/kernel/postinst.d at /var/lib/dpkg/info/linux-
image-4.4.0-96-generic.postinst line 1052.
dpkg: error processing package linux-image-4.4.0-96-generic (--
configure):
 subprocess installed post-installation script returned error exit 
status 2
dpkg: dependency problems prevent configuration of linux-signed-
image-4.4.0-96-generic:
 linux-signed-image-4.4.0-96-generic depends on linux-image-4.4.0-96-
generic (= 4.4.0-96.119); however:
  Package linux-image-4.4.0-96-generic is not configured yet.

dpkg: error processing package linux-signed-image-4.4.0-96-generic (-
-configure):
 dependency problems - leaving unconfigured
Setting up linux-libc-dev:amd64 (4.4.0-96.119) ...
dpkg: unrecoverable fatal error, aborting:
 unable to flush updated status of 'linux-libc-dev:amd64': Read-only 
file system

作为副作用(?),我的系统变得只读。我必须重新启动它才能移动文件、添加或复制系统文件。

uname -r给我4.4.0-93-通用

我怎样才能删除这个未配置的包(linux-image-4.4.0-96-通用)或者正确配置它?

答案1

现在您已经解决了只读挂载问题并修复了文件系统。您可以清理混乱并重试。在这样做之前,明智的做法是检查驱动器的 SMART 状态因为即将发生的硬件故障可能会使您的所有努力都白费。如果报告驱动器状况良好,则应该可以安全地继续。

sudo apt-get purge linux-signed-image-generic将清除未配置、未完全安装的包。

sudo apt install linux-signed-image-generic将安装当前支持的版本。

答案2

由于电池电量耗尽而中断的内核升级的简单恢复方法是:

  • 确保笔记本电脑现在已连接到主电源以及您将来进行的每次内核升级!

  • 启动时按住Shift并出现以下屏幕: Ubuntu 高级启动屏幕

  • 选择“高级选项”

  • 启动到倒数第二个内核

  • 再做sudo apt dist-upgrade一次。

完毕! :-)

相关内容