Thursday, December 1, 2016

Ubuntu 16.04 stucked on boot logo after an upgrade from 14.04

Yesterday I finally decided to let Ubuntu autoupgrade system update my 14.04 into 16.04. After some time, my laptop got really hot, which seems to be caused by some CPU-intensive operations of the upgrade. It got too hot until a point that the firmware decided to shut my laptop down forcefully. Crap! I'm in the middle of an update!

Yes, as you can already guess, my laptop now stucked on boot logo! What's even worse, the boot logo didn't even animate, which means it hung and I can't use emergency mode or tty2!

I almost thought I had to re-install the entire OS from scratch, which would have been much painful considering all the programming tools and libraries I've painstakingly installed throughout the past year! Fortunately, many people out there shared how they recovered their systems!

[SOLUTION]
There really are two things that need to be done:
1. Complete the unfinished upgrade
2. After (1), turned out my system still wouldn't boot, so need to diagnose and debug this.


1. Complete the unfinished upgrade
This can be done via "chroot"-ing onto the broken system via Live CD. For those unfamiliar, "chroot" is a mechanism to "get into" another Linux installation from a currently running one. In this case, the currently running is one from Live CD and the other one is mine that wouldn't boot. It's done as follow:

a. fdisk -l #Figure out the disk where your other Linux is installed
b. mount /mnt/ /dev/sdX #'/dev/sdX' would be from step (a)
c. for i in /sys /proc /run /dev /dev/pts; do sudo mount --bind "$i" "/mnt$i"; done # This is so the chroot-ed system has access to current Linux's hardware nodes that are necessary, for example for internet connection
d. sudo chroot /mnt/ #After this, you're shell is under the other Linux!

It's time to complete/fix the upgrade that has been halted.
a. sudo apt-get update # Update the list of cached components
b. sudo apt-get upgrade # Upgrade the system


2. After (1), turned out my system still wouldn't boot, so need to diagnose and debug this.
For me, there's still a problem that causes my Linux to get stuck on boot loop. After a while, the system got into emergency mode, where there's an option to go into root shell to do something. 

On the emergency mode:
1. journalctl
The shell immediately prompted me to run this command, so I did and found out the culprit:
"timeout waiting for device dev-disk-by..... " and several line below that, it seems that the failure is due to the system trying to mount /dev/disk/by-uuid/XXX that didn't exist. Turned out this was the path to my Windows partition, which changed after an upgrade to 16.04


2. vim /etc/fstab
I commented out the line that tried to mount the no-longer-existing path. And voilla! It worked like a charm!

Credit: 
http://www.webupd8.org/2014/01/how-to-fix-non-bootable-ubuntu-system.html
http://forums.debian.net/viewtopic.php?f=10&t=118828

No comments:

Post a Comment