Daily Ubuntu / Linux news and application reviews.

ads

Starting with Ubuntu Karmic, Grub 2 is used (for clean installs for now), so THIS how-to on recovering the GRUB no longer works for the new GRUB2.

But recovering GRUB 2 (after breaking the GRUB2 or installing Windows or some other Linux distribution like Fedora, etc.) is just as easy. Here is what you need to do

Note: This tutorial should work for any Linux distribution which uses GRUB2, not just Ubuntu.


Fix GRUB2 (after installing another OS / Linux distribution or after a GRUB failure)


To fix GRUB 2, you need an Ubuntu live CD from which you need to boot. Once you boot to the LIVE CD, open a terminal an and type these commands:

a) Firstly, you need to find out on which partition your Linux system is installed:
sudo fdisk -l
(in my case, it's "sda1")

b) Now, we must mount this partition:
sudo mount /dev/sda1 /mnt
Where "sda1" is the partition where you installed Ubuntu (or any other Linux distro). It could be "sda5", "sda6", etc. for you.

c) Install grub to the partition you've mounted:
sudo grub-install --root-directory=/mnt/ /dev/sda


Important: Please notice that it's "/dev/sda", not "/dev/sda1". "sda" is the hard disk on which your Linux distribution is installed!

d) Restart your computer. As previous Grub 2 entries are removed, run the following command to restore them:
sudo update-grub


Here is the whole process of fixing GRUB 2 (without step "d)" which takes place after restart) in a single screenshot I've just made after trying the steps below:

how to fix grub2

And a final note: I have tested this in VirtualBox by breaking my machine's GRUB 2 and then mounting a Live Ubuntu CD and it all went very smooth.


[via mundogeek]
«
Next
Newer Post
»
Previous
Older Post
-->