How to Repair Ubuntu Linux which failed due to
computer switch off during update :)
My sister tried updating her Ubuntu to a newer version but in the
middle of the
dist-update process had to go out and hence
closed her notebook thinking the update would continue. I'm not
fully aware what happened next, maybe the battery of the notebook
went, maybe the computer entered sleep mode in the middle of some
important package update or whatever. The result at hand however
was on next opening her Ubuntu powered
Acer Aspire 5736Z
stopped booting properly.
The Ubuntu boot up occured in the middle of booting the
BootSplash (from some of the /etc/init.d ... init
scripts).
As a result the BootSplash status was failed and on the screen the
GUI cursor appeared refreshing every few seconds, whether on every
refresh the screen become blank, while the hard drive was reading
on and on, continuously. Since the screen was keeping mostly blank
I had no way to see exactly why the hard drive was scraping on and
on....
My first guess was to try to boot the Ubuntu in single user mode
(without GUI environment) and then complete the interrupted
packages
apt-get dist-upgrade.
In the old days of RedHat and probably nowdays in Fedora, I
remember entering single user mode was easy just press
I
button few times on OS boot and the system would boot in
non-interactive mode. The
I (boot single-mode) shortcut
however is not compatible with Deb based distros (as I found out by
trying it out unsuccesfully).
Actually during booting process, this notebook did not even
prompted the GRUB menu with even simple choice to choose an old
kernel or something, hence I took a quick on the net
how can I
make the GRUB menu appear on Ubuntu!.
The reason why
GRUB menu did not appear on the laptop boot
was due to very short GRUB (select) boot timeout delay set.
Hence to
make the GRUB prompt (select) prompt appear in
Ubuntu it is necessery to:
1. Hold continously the SHIFT key at
boot
Once the textmode GRUB selection screen appears, as I read in
instructions in blogs one has to:
HIT e key, over default boot-up kernel, e.g.:
Ubuntu, with Linux 3.2.0-23-generic
Now to boot Ubuntu in single user mode as I red it is necessery to
modify near line:
linux /boot/vmlinuz-3.2.0-24-generic
root=UUID=bc6f8146-1523-46a6-8b\ 6a-64b819ccf2b7 ro quiet
splash
to something like:
linux /boot/vmlinuz-3.2.0-24-generic
root=UUID=bc6f8146-1523-46a6-8b\ 6a-64b819ccf2b7 ro single quiet
splash
initrd /boot/initrd.img-3.2.0-24-generic
Then finally to load up with the changed GRUB options, I've press
Ctrl+X
Unfortunately this didn't work on my sister bugged Ubuntu. So i
continued looking for way to boot without X server, I've found
another blog recommending to change:
quiet splash words with
text in grub kernel load-up options ..
In my case none of the ways to boot without X or single user mode
worked out so I finally decided to do it the "old-fashioned"
classical way - by using Ubuntu Install CD, booting in "Try Ubuntu"
mode and using the good old
chroot cmd.
So fixing Ubuntu, came up to booting with
Ubuntu Install CD
with option:
Try Ubuntu without any change of your computer,
further on once the CD boot up, I entered console and inside
console used commands similar to one of my previous posts -
How to mount /proc, /dev and chroot in Linux
In other words fixing up the broken Ubuntu came to issuing :
# mkdir /mnt/recover
# chroot /dev/sda1 /mnt/recover
root@ubuntu:~# mount /proc
root@ubuntu:~# mount /proc/pts
root@ubuntu:~# mount -a
root@ubuntu:~# mount /dev
root@ubuntu:~# dpkg-reconfigure -a
root@ubuntu:~# apt-get update
....
root@ubuntu:~# apt-get --yes upgrade
....
root@ubuntu:~# apt-get --yes dist-upgrade
....
Onwards during the
apt-get upgrade and
apt-get
dist-upgrade few questions poped up asking me if I would like
to replace some files with their new versions on each questions I
substituted the files with the new maintainer version. Then finally
after PC restart my sis Ubuntu boot up fine with the latest Ubuntu
version
12.04.