Friday 31 March 2017

Recovering Ubuntu boot disk after failure to boot

Ubuntu system fails to boot

After a series of power cuts my Ubuntu server was unable to complete the boot process and displayed the following messages:

Begin: Will now check root file system ... fsck from util-linux 2.27.1
[     5.4120241] usb 4-1: device not accepting address 4, error -71
[/sbin/fsck.ext4 (1) -- /dev/mapper/ubuntu--vg-root] fsck.ext4 -a -C0 /dev/mapper/ubuntu--vg-root
/dev/mapper/ubuntu--vg-root contains a file system with errors, check forced.
[     5.524020] usb 4-1: new full-speed usb device number 5 using uhci_hcd
Inodes that were part of a corrupted orphan linked list found.

/dev/mapper/ubuntu--vg-root: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
        (i.e. without -a or -p options)
fsck exited with status code 4
done.
Failure. File system check of the root filesystem failed
the root filesystem on /dev/mapper/ubuntu--vg-root requires a manual fsck
[     5.940027] usb 4-1: device not accepting addres 5, error -71
[     5.940061] usb usb4-port1: unable to enumberate USB device

LVM Root Installation

I was confused as to how to run fsck on the boot drive. This was because the Ubuntu installation I had done was using LVM2 logical volume management. This meant that the boot drive is not listed as /dev/sdx, instead it is /dev/mapper/ubuntu--vg-root.

Rescue USB boot drive

I created a SystemRescueCD USB boot drive and was then able to repair the drive using:

fsck /dev/mapper/ubuntu--vg-root

The article below helped me to finally pin this down:

http://askubuntu.com/questions/781315/ubuntu16-04-boots-into-initramfs