So.. My trusted 5 old Seagate HDD crashed on me during a reboot. Grub was installed on its MBR and hence I couldnt even boot to my Windows 8 partition and Gentoo without reinstalling Grub.
While trying to do it from a Ubuntu LiveCD, I found that it wouldnt boot at all. I found a Debian LiveCD and managed to boot to terminal based Rescue mode and run e2fsck on the HDD. But surprise, surprise..No errors on the Seagate HDD were found. Only my Hitachi containing Gentoo was present on it. Ubuntu was on Seagate. I had just upgraded to Kubuntu 12.10 yesterday after a painful upgrade process. Painful because of my slow internet speeds.
Anyway, I got Debian and fixed the disk. I then tried to fix the Grub2 with Debian, but it seemed to have issues even doing a chroot. Finally I booted off the Ubuntu LiveCD and initially having i get stuck at boot.
The solution to boot the Ubuntu LiveCD was to do a acpi=off, noapic, nolapic option. To get this, press any key during boot when the pink Ubuntu screen shows up with a small icon at the bottom. Now you get a full fledged boot menu, Hit F6 after choosing your language and choose the options mentioned. Now it ought to boot.
Once booted, type “Terminal” in Unity, and get to the shell. Alternately, you can Hit Ctrl-F1-6 for shell. Hit Ctrl-F7 to get back.
Now, locate the disk where your boot partition is located with:
sudo parted -l
Find the ext4 partition(s), mount it, chroot to it.
sudo mount /dev/sda7 /mnt
ls -l /mnt will show you whether /mnt/boot is present. If not, you chose the wrong disk.
sudo mount --bind /dev /mnt/dev sudo mount --bind /proc /mnt/proc sudo chroot /mnt
Note: For a split boot an / partition, you need to first mount your partition containing /, to /mnt; then mount the partition for /boot, to /mnt/boot.
Now you’re in your old linux installation. You can now install Grub.
sudo grub-install /dev/sda
Note that this is the main disk and not an individual partition. You need to install it to MBR (in my case).
After rebooting, you will find grub installed. However Windows might be lost from grub menu. You can readd it with the following commands:
sudo su - os-prober update-grub
After rebooting, you’ll get Windows back on the grub2 list. If you need Windows to always come first in the menu, do this.
Since my distro was Gentoo, I found an issue. It gave me an error:
/dev/root: Not found or not a block device.[/code] To fix, I had to do an additional command:grep -v rootfs /proc/mounts > /etc/mtab
Details here
The command actually sends the entire list of partition info to the file mtab.
Now repeat the command and it works:
sudo grub-install /dev/sdaRead more:
http://howtoubuntu.org/how-to-repairrestorereinstall-grub-2-with-a-ubuntu-live-cd/
http://www.gentoo.org/doc/en/grub-error-guide.xml
http://askubuntu.com/questions/88384/how-can-i-repair-grub-how-to-get-ubuntu-back-after-installing-windows
Joel G Mathew, known in tech circles by the pseudonym Droidzone, is an opensource and programming enthusiast.
He is a full stack developer, whose favorite languages are currently Python and Vue.js. He is also fluent in Javascript, Flutter/Dart, Perl, PHP, SQL, C and bash shell scripting. He loves Linux, and can often be found tinkering with linux kernel code, and source code for GNU applications. He used to be an active developer on XDA forums, and his tinkered ROMS used to be very popular in the early 2000s.
His favorite pastime is grappling with GNU compilers, discovering newer Linux secrets, writing scripts, hacking roms, and programs (nothing illegal), reading, blogging. and testing out the latest gadgets.
When away from the tech world, Dr Joel G. Mathew is a practising ENT Surgeon, busy with surgeries and clinical practise.