Repairing the GRUB installation is a very usual task for many Linux users. There are many excellent articles on this topic on the net. This small article intends to be a summary of them and to serve as a small reference for those who do not care about the details. Some links to external relative articles exist in the end of this document.
Entering the Rescue Mode
The Rescue Mode, in simple terms, is an “isolated” environment, which exists in the system RAM, from where you can perform some system maintenance or repair tasks. To enter such an environment you can use any of the so called “Live CDs” or use your distribution’s installation media if they provide such an option.
For Fedora users there are a separate Fedora Rescue ISO image, which can be burned to a cd, and the first of the installation media, which can be used to enter the Rescue Mode. Since you will be booting from the cd, you will have to adjust your boot sequence in your motherboard’s BIOS. Having accomplished this, insert the proper cd into the drive and reboot.
If you use the Fedora Rescue CD, just hit the
[Enter] key. If you use the installation media, type:
> linux rescue
and hit the
Answer the questions about your language, your keyboard and if you would like to bring up the network interfaces. You will not be needing the latter, so you may answer negatively.
The last question you have to answer before you enter the Rescue Mode is if you would like to mount your Fedora system partition or not, or if you would like to mount it as read-only. I would suggest that you let this wizard mount it for you.
Re-installing GRUB on the MBR
If you have let the wizard mount your system, it can be found at the following directory:
Issue the following commands:
# chroot /mnt/sysimage/ # grub-install /dev/hdX
hdX with the proper hard drive, on whose MBR you would like GRUB installed. Usually this is
GRUB is installed.
The first command is optional, but, if you don’t issue it, you would have to provide the full path to
grub-install. For example:
# /mnt/sysimage/sbin/grub-install /dev/hdX
Creating a GRUB diskette
If you have a reason to have GRUB installed on a diskette and boot your system from there, here is the info on how to do. You can issue the following commands either from the Rescue Mode or while you use the system. If you are in the Rescue Mode, issue the following command to make your life easier:
# chroot /mnt/sysimage/
Insert a diskette into the floppy drive and type:
# dd if=/boot/grub/stage1 of=/dev/fd0 bs=512 count=1 # dd if=/boot/grub/stage2 of=/dev/fd0 bs=512 seek=1
These copy the necessary GRUB images to the diskette.
Finally install GRUB to the diskette:
# grub-install /dev/fd0
That’s it. You can adjust your boot sequence in the BIOS, so that your system boots from the diskette.
Note that this diskette is only valid for the specific kernel and partition configuration. If you modify any of these you will have to repeat the last command.
Some exceptional articles on this topic:
- The GRUB Documentation.
- Grub From the Ground Up by Steve Litt
- How to install GRUB on the MBR by Gonzalo
GRUB repair plus installation to floppy by George Notaras, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Copyright © 2006 - Some Rights Reserved