December 8

Linux: Grub repair tips

One of the most common problems when you have a dual boot option is a dreaded Grub error message at boot up…this can happen for instance if you resize a partition using programs like Gparted in linux…thing is you cannot resize your linux partition if your using it…so to do this you have to “Boot to the Live” distro to make changes to existing partitions.

So ok we resized or deleted partition and allocated free space to expand your drive…now in some cases like mine recently i had one of my systems duel boot with XP pro / Ubuntu 8.10

I decided to delete the XP pro and resize my linux…then i hit on a problem at boot up

I got the dreaded Grub loading error 22 message and could not boot to any OS on the system…so had to manually repair the grub boot loader…here is what iI did and it might help others if you have the same problem:

This is not new and a well documented linux procedure am just doing it here for GSO members who might have had the same problem like I did.

OK lets begin:

1)Boot from a live distro ie Ubuntu

2)Open a console

3)type in: sudo grub

4)type in: root (hd and hit the TAB button

this will then show you what physical drives you have and return usually as

root (hd0, or hd1

hit the TAB again and it will list possible partitions similar to this

grub> root (hd0,
Possible partitions are:
Partition num: 0, Filesystem type unknown, partition type 0�7
Partition num: 2, Filesystem type is ext2fs, partition type 0�83
Partition num: 4, Filesystem type unknown, partition type 0�7
Partition num: 5, Filesystem type is fat, partition type 0xb
Partition num: 6, Filesystem type is fat, partition type 0xb
Partition num: 7, Filesystem type unknown, partition type 0�82

The one were interested in is 2 with the ext2fs … this is the one with the linux installed to

so we type

root(hd0,2)

*caution*

providing hd0 is the main physical partition it could be hd1 remember !!

ok so after you have typed root(hd0,2)

you need to type:

setup (hd0)

close terminal exit live cd and reboot…you should have your grub loader repaired

REMEMBER this is for Linux repair… NOT… windows you need to reset MBR if you deleted linux partition and getting a grub loading error message.

By: Kenny


Copyright 2021. All rights reserved.

Posted December 8, 2011 by Timothy Conrad in category "Linux

About the Author

If I were to describe myself with one word it would be, creative. I am interested in almost everything which keeps me rather busy. Here you will find some of my technical musings. Securely email me using - PGP: 4CB8 91EB 0C0A A530 3BE9 6D76 B076 96F1 6135 0A1B