Howto Fix Grub
This documentation is outdated. It's only useful if you are using Grub legacy. Please check current documentation at: Wizard - Restore Grub
After windows reinstallation, Linux no longer boots!
Other titles for this same problem.
- How do I restore GRUB?
- I have lost my GRUB, how do I find it again?
- I have reinstalled Windows and the Ubuntu selection menu is not there.
Rescatux
- Please check the complete Wizard at: Wizard – Restore Grub with Rescatux
- Select Restore grub / Fix Linux Boot option and click on OK button
- Select the partition where your main Linux is and click on OK button
- Select the hard disk where you want Grub to be installed (usually the first one)
- Grub was installed OK confirmation / Grub was not installed error will appear
Windows Solution
This is the less complicated and most easy solution for a Windows user. Please check: Auto Super Grub Disk.
Quick solution
- GRUB => MBR & !LINUX! (1) AUTO ;-)))
- SGD fixes GRUB automagically for you and presents your grub boot menu again.
Not So Quick solution
- GRUB => MBR & !LINUX! (>2) MANUAL |8-)
- Choose the partition where the Linux GRUB you want to recover is located.
- Choose the partition where the Linux GRUB you want to boot is located.
Classical solution
- Choose Language & HELP :-)))
- Choose the partition where the Linux GRUB you want to recover is located and SGD prompts you: SGD HAS SUCCEEDED.
Advanced solution
Sometimes the hard disk where you want to GRUB to be installed might not be the first one. If you want to install GRUB into a non-standard MBR you can choose:
- Super Grub Disk (WITH HELP) :-)))
- English Super Grub Disk
- Advanced
- Grub
- Restore Grub to MBR
- Restore Grub to MBR manually
- Select the partition where GRUB it is found (i.e. stage1 is found).
- Select the hard disk where you want GRUB installed to its MBR.
Problematic solution
Sometimes BIOS does not "show" Super Grub Disk's grub the correct hard disk boot order. It's even possible that SGD says that it's fixing grub ok and it actually fixes it but in the wrong hard disk. The hard disk that it is not the first one to boot. It's also possible that you try to boot your computer's Linux and you have some errors but when you boot normally it works without any problem.
If you only have two hard disks from the quick menu choose: EASY LIVE SWAP and then try to Fix Grub another time and SGD should succeed ok.
GRUB solution (on its own)
Find the partition where GRUB stage1 it is.
grub>find /boot/grub/stage1 grub>find /grub/stage1
Output from these commands might be:
(hd0,1) (hd0,3)
Let's suppose that you want to restore GRUB from second partition on first hard disk (hd0,1).
Just type these commands:
grub>root (hd0,1)
which prompts:
Filesystem type is ext2fs, partition type 0x83
and then:
grub>setup (hd0)
which prompts:
Checking if "/boot/grub/stage1" exists... yes Checking if "/boot/grub/stage2" exists... yes Checking if "/boot/grub/e2fs_stage1_5" exists... yes Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 15 sectors are embedded. succeeded Running "install /boot/grub/stage1 d (hd0) (hd0)1+15 p (hd0,1)/boot/grub/stage 2 /boot/grub/menu.lst"... succeeded Done.
Now you can reboot your machine with the reboot command.
grub>reboot
GRUB solution (Linux shell)
Let's suppose you know that your Linux installation is located at sda3 partition. From a live cd you should do:
$ sudo su # mkdir /mnt/test # mount -t ext3 -o dev /dev/sda3 /mnt/test # chroot /dev/sda3 # grub-install /dev/sda # exit # umount /mnt/test # reboot # This is optional.
Tip: You might have to change ext3 to fit your partition filesystem type.
GRUB2 solution (on its own)
As long as I know GRUB2 cannot recover itself on its own.
GRUB2 solution (Linux shell) (Recommended)
* Boot with either Super Grub Disk or Super Grub2 Disk your Linux distribution # sudo -i # Sudo systems like Ubuntu # su # Non sudo systems only # grub-install /dev/sda # It might be hda in some cases. # update-grub # You are done.
GRUB2 solution (Linux shell) (Maybe deprecated)
You have to type the same commands as the ones found at: #GRUB solution (Linux shell) where we suppose that you have a GRUB2 installed in the GRUB partitions and thus grub-install is not the command from GRUB but the command from GRUB2.
Tecnical explanation
When you reinstall Windows, MBR boot code points to Windows partition boot sector. Windows partition boot sector has a programa that loads Windows. When you reinstall GRUB, MBR boot code points either to GRUB's stage1_5 file (After MBR and before first partition) or to GRUB's stage2 file (found at the linux filesystem). Either stage1_5 or stage2 read the menu.lst file and present the GRUB menu to the user.
One thing you should know
- These methods only restore GRUB successfully if a stage1,stage2 (and optionally a stage1_5 file) is found. If you have deleted these files the GRUB solution (Linux shell) might help although it might be better to reinstall GRUB from a chroot environment got from a live cd.
If your Linux filesystem has errors GRUB might not be able to find its files even if they are there. So sometimes is advised to try to run the:
fsck -yc /dev/DEV
command as root where DEV is your linux partition device.
fsck -yc /dev/sda3
will fix the third partition from an scsi or sata first disk (Although it might not actually be the first one).
- OpenSolaris GRUB cannot be restored to MBR which this method. You need to boot Linux and then use the install-grub command. See man install-grub for more info.
- If menu.lst is incorrect you will be able to access your menu.lst again but maybe Linux entries might not boot.
TIP
If you cannot get to restore grub this way you can always try to boot Linux and then use the Grub Solution (on its own) method or the Grub Solution (Linux shell) method.
Problems ?
You can always check the possible problems when fixing grub from Super Grub Disk in Super Grub Disk Problems page.