Boot Failure When Fedora 12 Grub Installs to non-MBR Partition
I prefer to keep Windows on the MBR. So I install
grub to a separate partition. I then allow the Windows Loader to chainload grub (example).
I noticed a problem with the Fedora 12 Anaconda Installer. If I chose to install
grub to the First sector of boot partition instead of the MBR, I get an un-bootable system.
It is easy to see the problem if you compare
fdisk output. (I reduced the output for clarity)
Before I installed Fedora 12 32-bit to
Device Boo Start End Blocks Id System /dev/sda1 * 1 2089 16779861 7 HPFS/NTFS /dev/sda4 6268 36479 242677890 f W95 Ext'd (LBA) /dev/sda10 23762 25589 14683378+ 83 Linux /dev/sda14 34076 36192 17004771 83 Linux /dev/sda15 36193 36478 2297263+ 82 Linux swap / Solaris
After I installed Fedora 12:
Device Boot Start End Blocks Id System /dev/sda1 1 2089 16779861 7 HPFS/NTFS /dev/sda4 6268 36479 242677890 f W95 Ext'd (LBA) /dev/sda10 * 23762 25589 14683378+ 83 Linux /dev/sda14 34076 36192 17004771 83 Linux /dev/sda15 36193 36478 2297263+ 82 Linux swap / Solaris
The boot flag is set to the wrong partition.
To fix this problem
Just boot with a CD/DVD, choose “Rescue” mode and run
fdisk at the shell to change the boot flag. If you need more help, details follow:
- Boot with the system using your Fedora DVD or CD#1.
- Select “Rescue installed system”. (Select the proper settings, networking is not necessary)
At the “Rescue” screen, you can “Skip” the mounting of your installed system.
At the “First Aid Kit quickstart” menu, Select “shell”.
3. At the shell prompt, use
fdisk (BE CAREFUL!)
bash-4.0# fdisk /dev/sda Command (m for help): a (_toggle bootable flag_) Partition number (1-15): 10 (_the partition you installed Fedora_) Command (m for help): a (_command needs to be run twice_) Partition number (1-15): 1 (_the partition with MBR_) Command (m for help): p (_verify everything looks correct_) Command (m for help): w (_write table to disk and exit_) The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disk.
I doubt this will affect many people since most people choose to install Fedora directly to the MBR. However I am reporting here in case someone else might find this useful. I noticed this a few days ago on Fedora 12-Beta 64-bit, but I had been too busy to check the bug reports. Will do that soon.
If you run into this problem (or similar) please leave a comment or contact me.
UPDATE: Should be fixed for Fedora 13. Bug 533658
chuck on December 3, 2009 - 01:13 PM
I have a disk with 5 distros multibooting. Also, I have an Intel Mobo with a BIOS that can’t see farther than 2GB. So I have a boot partition at the beginning of the drive to handle GRUB and all booting issues (mostly chainloading). And it is in a location that the BIOS can find. That partition is the one where the boot flag should be set.
My upgrade of my Fedora partition from F11->F12 on that disk resulted in the problem you mention here. The I would have probably trashed the entire drive and lost all 5 distros had I not seen this article. Great contribution. Thanks much.
Ankit on December 10, 2009 - 07:07 AM
This is really good link, I have also faced the same issue but bott failure doesn’t come every time. It comes some time only otherwise by default I can boot my system in XP.
Mark A on December 16, 2009 - 12:12 PM
It may be a preference, but I lean on grub more than XP for booting through MBR, since it is more flexible and easily controlled by just editing a file. This way I can even install XP in any partition.
christian sam on December 25, 2009 - 09:09 AM
you saved my day, thank you very much!
btw. for all windows users which happen to have two primary partitions (e.g. c: - system partition and d:). in my case i had to activate sda2, not sda1.
S.Sivalingam on January 7, 2010 - 09:09 AM
Guy, U Really Rocks.
clavan on January 23, 2010 - 03:03 AM
Thanks a lot, you have saved my FC-12 install.
I ’ll put this link on my site
Muhammad Tahaa on January 25, 2010 - 09:09 AM
Dual Boot Windows Xp and Fedora Grub Editor
if fedora boot loader fails to boot xp then modify the grub.conf file located in /etc/grub.conf
and add the following lines in your grub.conf
title Windows XP Pro
# root (hd0,6)
# kernel /boot/vmlinuz-version ro root=/dev/sda7
# initrd /boot/initrd-[generic-]version.img
title Fedora (188.8.131.52-174.2.3.fc12.i686)
kernel /boot/vmlinuz-184.108.40.206-174.2.3.fc12.i686 ro root=UUID=384010b1-f896-462a-9819-998cad825f79 LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet
# If missing and fail to boot xp then add the following commands to grub.conf
title Windows XP Pro
save and exit.
Mauriat on January 26, 2010 - 09:21 PM
You are correct that editing grub.conf can allow you to boot windows, but the problem here is that Fedora does not boot at all.
c. datta on February 26, 2010 - 05:05 AM
I had upgraded to Fedora 12 from Fedora 11. I have a dual boot system (Win XP and fedora). Maybe due to nouveau-nVidia clash, I was not able to get a graphical login in Fedora 12. While trying out a few suggestions (like adding nouveau.blacklist=1 as kernel option), i have totally lost the /etc/grub.conf file. My question is : can i verbatim create a /etc/grub.conf file as given by Muhammed Tahaa, save it, and reboot ? Can the UUID as given be used or will I be making more trouble for myself ? Thanks for any advice in advance.
aiace on March 14, 2010 - 07:19 PM
I spent 2 days finding a solution, which was eventually supplied to me by a pal in a forum.
It goes first as you also suggest, that is, booting from DVD, Rescue mode.
Then # chroot /mnt/sysimage, then # grub-install /dev/sda.
The first command switches to root user, the second one writes GRUB to the MBR of the specified disk.
BEWARE: if there is more than a single hard disk (or more logical disks), special care must be taken with the exact wording of the hard disk, as it can change with every new boot.
However, the command /mnt/sysimage uses to list all Fedora installation on the machine, giving their relative /dev/sd(X), and of course it does help a lot!
HungNV on March 15, 2010 - 03:03 AM
Thank you! I have fix my similar problem. I have 2 HDDs and the boot flag set into wrong partition
Keith on April 13, 2010 - 11:11 AM
Thanks and good catch. I believe another way to fix this on XP is to use the windows GUI (control panel->Performance and Maintenance->Admin tools->Computer Management->Disk Management->right-click->Mark Partition as Active). Apparently active partition is a reference to the boot flag.