[Solved] Power failure during "sudo apt-get dist-upgrade' - booting to :( face only now

Unfortunately my little Raspberry Pi suffered a power failure mid-way running the ‘sudo apt-get dist-upgrade’ command. I now only boot into the GUI with a sad face :frowning:

I still have SSH access and it looks like the root / file system is being mounted in read-only mode.

I tried re-running the command ‘sudo apt-get dist-upgrade’ but get the following output:

osmc@osmc:~$ sudo apt-get dist-upgrade
W: Not using locking for read only lock file /var/lib/dpkg/lock
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.

I then tried the suggested command ‘sudo dpkg --configure -a’ with the following output:

osmc@osmc:~$ sudo dpkg --configure -a
dpkg: error: unable to access dpkg status area: Read-only file system

Then tried remounting using:

sudo umount /
sudo umount /dev/mmcblk0p8
sudo mount -t ext4 -o rw,remount -force /dev/mmcblk0p8 /

But the system still complains about the file system being read-only.

I have tried looking in /var/log for error logs, but ‘messages’ doesn’t exist - is there somewhere else I can look?

Being new to Linux, I would be most grateful if anyone could give me a few pointers to help steer me in the right direction :smiley:

I would recommend copying /home off of the sd card as a backup of your settings.

That way, if a full reinstall is required, you can get back up and running as quickly as possible.

(Given this update was a major version change for Kodi, and the database version was bumped as well, if you do have to do a full reinstall, you may be better off installing the June version, restoring your settings and then upgrading to the July version manually once that’s done.)

Thanks for the reply and advice - I’ve managed to get it working again - thankfully a simple fix! :grinning:

Steps taken:

Checked dmesg boot log for errors:

sudo dmesg

I noticed there were entries about the file system having corruption on /dev/mmcblk0p8 - I then unmounted the file system and device to be able to run a system file check on (might not be required, still learning here :blush:):

sudo umount /
sudo umount /dev/mmcblk0p8

I then run the system file check with the following command:

sudo fsck.ext4 /dev/mmcblk0p8 -y

After it had repaired file system errors (and the wife now out the way :smile:) I was then able to re-run ‘sudo dpkg --configure -a’ followed by ‘sudo apt-get dist-upgrade’ successfully.

All seems to be working fine from what I can tell. :thumbsup: