Friday, March 27, 2009

// // Leave a Comment

COMMANDS FOR REINSTALL GRUB IN UBUNTU 8.10

Ubuntu installation CD is a live CD and so, when it loads, you can run the terminal from there.

Once you are at the terminal, you will have to access the ‘grub’ shell to change the grub configuration. So, give this command at the terminal:

$ grub

If it says that you don’t have the permission, in which case you will not have logged in as root(as in Ubuntu), give this command at the terminal:

$ sudo grub

You will get the grub-shell prompt:

grub>

Now, you will have to find out in which partition Grub had been installed before, so that you reinstall in that partition only. Give this command at the terminal:

grub> find /boot/grub/stage1

(returns value)

It returns the number of the partition in which Grub i.e your GNU/Linux had been installed.

e.g.,

grub> find /boot/grub/stage1

(hd0,2)



Sometimes, when Grub has not been installed properly, the file “/boot/grub/stage1″ may not exist. So, the output will be Error 15: File not found”. In such a case, come out of the grub-shell by pressing “Ctrl+c”. Then, at the shell prompt, give this command at the terminal:

$ fdisk -l

Again, if you are not logged in as root, give this command at the terminal:

$ sudo fdisk -l

The output will list all the partitions and it’s properties, including the file system type.

e.g.,

Device Boot Start End Blocks Id System
/dev/sda1
1 765 55623223+ b W95 FAT32
/dev/sda2 * 956 8887 12569830 7 HPFS/NTFS
/dev/sda3
1985 3698 19868597 83 Linux

The “System” attribute of your GNU/Linux operating system will be “Linux”. So note down that partition number.

e.g., sda3

Since it’s array numbering, sdaN is mapped to (hd0,N-1).

Just (hd0) will be the Master Boot Record(MBR).

sda1 will be (hd0,0) and so on.

So, sda3 will be (hd0,2)

Now, log into the grub-shell prompt again.


reinstalling Grub, you will have to notify the partition that your Grub i.e. GNU/Linux is resided in. So, give this command at the terminal:

grub> root (returned value)


grub> root (hd0,2)

Now, reinstall grub in the MBR i.e. the returned value without number part.

(hd0)

So, give this command at the terminal:

grub> setup (returned value without number part)


grub> setup (hd0)

Exit the grub-shell prompt using “Ctrl+c”.

Exit the shell prompt using “Ctrl+d”.




THATS ALL

0 comments:

Post a Comment