Warning: Creating default object from empty value in /home/mirandam/public_html/linux/wp-includes/functions.php on line 292
Fedora, Linux and Stuff :: Boot Failure When Fedora 12 Grub Installs to non-MBR Partition

Boot Failure When Fedora 12 Grub Installs to non-MBR Partition

Tuesday, November 17th, 2009 ~ 10:53 pm by Mauriat Miranda

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 /dev/sda10

   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

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:

  1. Boot with the system using your Fedora DVD or CD#1.
  2. 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.
  4. Reboot.

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

12 Responses to “Boot Failure When Fedora 12 Grub Installs to non-MBR Partition”

  1. chuck Says:

    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.

    c.

  2. Ankit Says:

    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.

  3. Mark A Says:

    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.

  4. christian sam Says:

    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.

  5. S.Sivalingam Says:

    Guy, U Really Rocks.

  6. clavan Says:

    WooWoo !
    Thanks a lot, you have saved my FC-12 install.
    I ‘ll put this link on my site

  7. Muhammad Tahaa Says:

    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

    rootnoverify (hd0,0)

    chainloader +1

    su

    Password:

    vi /etc/grub.conf

    like

    Grub.conf

    # root (hd0,6)

    # kernel /boot/vmlinuz-version ro root=/dev/sda7

    # initrd /boot/initrd-[generic-]version.img

    #boot=/dev/sda

    default=0

    timeout=15

    splashimage=(hd0,6)/boot/grub/splash.xpm.gz

    hiddenmenu

    title Fedora (2.6.31.12-174.2.3.fc12.i686)

    root (hd0,6)

    kernel /boot/vmlinuz-2.6.31.12-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

    initrd /boot/initramfs-2.6.31.12-174.2.3.fc12.i686.img

    # If missing and fail to boot xp then add the following commands to grub.conf

    title Windows XP Pro

    rootnoverify (hd0,0)

    chainloader +1

    save and exit.

  8. Mauriat Says:

    @Muhammad

    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.

  9. c. datta Says:

    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.

  10. aiace Says:

    great, Mauriat!
    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!

  11. HungNV Says:

    Thank you! I have fix my similar problem. I have 2 HDDs and the boot flag set into wrong partition

  12. Keith Says:

    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.