2

I was updating my system as usual and sudo apt update showed me some packages to be updated. I ran sudo apt upgrade and it downloaded the packages. But while packages were being configured during the installation, the computer was turned off due to low battery. When I booted and tried to update using sudo apt update I got this message:

E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.

When I executed sudo dpkg --configure -a I got this:

@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

As a side effect(?) to this my system became read-only. I had to reboot it to be able to move files, add or copy files from the system.

uname -r gives me 4.4.0-93-generic

How can I delete this un-configured package (linux-image-4.4.0-96- generic) or configure it properly?

Fabby
  • 34,259

2 Answers2

2

Now that you've resolved the read-only mount and repaired the file system. You can clean up the mess and try again. Before doing so it would be wise to check the SMART status of your drive as an impending hardware failure can make all your efforts useless. If the drive is reported to be in good shape, it should be safe to continue.

sudo apt-get purge linux-signed-image-generic will purge the unconfigured, not fully installed package.

sudo apt install linux-signed-image-generic will install the currently supported version.

Elder Geek
  • 36,023
  • 25
  • 98
  • 183
1

The easy way of recovering from an interrupted kernel upgrade due to battery running out of juice is to:

  • ensure the laptop is connected to mains power now and every kernel upgrade you do in the future!

  • hold the Shift while booting and on the following screen: Ubuntu advanced boot screen

  • take "advanced options"

  • boot into the second-to-last kernel

  • do sudo apt dist-upgrade again.

Done! :-)

Fabby
  • 34,259