#198 rEFIt does not chainload external drive's bootloader

open
nobody
5
2011-05-04
2011-05-04
Anonymous
No

Hi,

I have a MacBookPro5,2 running OS X 10.6.7, Win 7 and Ubuntu 11.04 in hybrid GPT/MBR conf on internal HD. Booting these works great with rEFIt. However, rEFIt fails to chainload any boot loader (tested LILO, GRUB and FreeBSD's boot0) on external HD (tested HD and USB flash). While the OS icon appears in the menu, after selection rEFIt seems to struggle and after a few screen flashes defaults to Ubuntu's GRUB (installed on Ubuntu partition). I tested both MBR drive, as well as GPT drive with grub_boot partition. When CD is present and external HD's system is selected in menu, rEFIt defaults to CD boot. I did confirm integrity of external HD bootloaders by chainloading them (set root=(hd1) followed by chainloader +1) from within Ubuntu's GRUB (which works fine). I have also managed to chainloaded extertnal HD bootloaders using blessed GRUB EFI on another external HD. So this really seems to be rEFIt issue. And YES, I have read the http://refit.sourceforge.net/help/usb_disk.html section. Basing on successful chainloading using GRUB EFI, I conclude it's not an Apple issue.

Please let me know if you encountered such issues and have an idea of what might be wrong.

Discussion

  • kami
    kami
    2011-09-10

    Hi,

    i have got the same Problem. If my MBR looks like this:

    rEFIt - Partitioning Tool

    Starting gptsync.efi

    Current GPT partition table
    # Start LBA End LBA Type
    1 40 409639 EFI System (FAT)
    2 409640 195722135 Apple RAID (Offline)
    3 195722136 196991671 Mac OS X Boot
    4 196993024 234932223 Basic Data
    5 234932224 236976127 Linux Swap

    Current MBR partition table
    # A Start LBA End LBA Type
    1 1 236978175 EE EFI Protective

    I can boot the USB-External devices, but refit cant boot the internal linux partition. If i updated my MBR like gptsync wants it:

    rEFIt - Partitioning Tool

    Starting gptsync.efi

    Current GPT partition table
    # Start LBA End LBA Type
    1 40 409639 EFI System (FAT)
    2 409640 195722135 Apple RAID (Offline)
    3 195722136 196991671 Mac OS X Boot
    4 196993024 234932223 Basic Data
    5 234932224 236976127 Linux Swap

    Current MBR partition table
    # A Start LBA End LBA Type
    1 1 236978175 EE EFI Protective

    Status: MBR table must be updated.

    Proposed new MBR partition table
    # A Start LBA End LBA Type
    1 40 409639 EE EFI Protective
    2 409640 195722135 AC Apple RAID
    3 195722136 196991671 AB Mac OS X Boot
    4 * 196993024 234932223 Linux

    I can boot the internal Linux and Lion Partition without any problems, but i cant boot any External devices because they are not known by the system. They are listed in Refit but if i try to chainload them with Grub, they are not found. Can anyone help me ? Can i add a device to the GRub-List?

    cu kami

     
  • Joe van Tunen
    Joe van Tunen
    2011-09-11

    rEFIt is an EFI program that tells the Mac's EFI to run another EFI program (such as Mac OS X's boot.efi) or to boot into BIOS a selected disk that has BIOS boot code on the first block (the MBR).

    rEFIt does not perform or affect chainloading for legacy OS's (OS's that use BIOS like Windows or Linux to boot). That's all up to the boot code in the first block of the disk or the partitions (e.g. grub or Windows Boot Manager) since the first block usually just jumps to the boot code on the partition that has its boot flag set in the MBR. It could be possible to change rEFIt so it works with chain loaders by modifying config files depending on the selection but that would be a new feature.

    Currently, rEFIt can only boot legacy OS's from drives that the Mac can boot legacy OS's from. The only feature that rEFIt adds for legacy OS's is the ability to have multiple legacy OS's on the same hard disk (by setting in the MBR the boot flag of the selected partition).

    So, to test if rEFIt can boot from an external disk, do the following:

    1) Make sure the first block has boot code (note: change disk1 to the proper number for your disk):
    sudo dd if=/dev/rdisk1 bs=512 count=1 skip=0 | xxd

    2) Make sure the boot flag of the boot partition is set (if the disk has partitions):
    sudo fdisk /dev/rdisk1

    2b) If the disk has partitions, make sure the first block of the boot partition has boot code (change # to the start block number):
    sudo dd if=/dev/rdisk1 bs=512 count=1 skip=# | xxd

    3) Use the Startup Disk preferences panel to select the external disk. I think Startup Disk might only show volumes that contain a file: /Windows/System32/ntdll.dll
    You could add those folders and a blank ntdll.dll file to make the disk appear in the Startup Disk preferences panel or you can manually select the disk using:
    sudo bless --device /dev/disk1 --setBoot --legacy --legacydrivehint /dev/disk1

    When you exit out of Start Disk preferences panel or execute the bless command manually, the NVRAM gets modified with your new startup preferences. You can see the NVRAM settings with one of the following commands (I like output of the 2nd one better):
    nvram -p
    ioreg -w 0 -n AppleEFINVRAM | sed -n -E "/^[ \|]+[ ]+(\".*)$/s//\1/p;"

    The important parts are "efi-boot-device-data" and "BootCampHD". "efi-boot-device" is a decoded version of "efi-boot-device-data".

    4) Restart your Mac - you shouldn't see rEFIt since the startup disk is no longer set to your Mac OS X disk.

    5) If the selected external drive boots properly, then it means that rEFIt should be able to boot from it also. In that case, probably the only reason why rEFIt can't boot from it is that it is calculating the wrong "efi-boot-device-data" or "BootCampHD" settings.

    Instead of #3, you could reboot your Mac, and hold down the option key to get into the Startup Manager. Then see if one of the Windows options will boot your external disk (there's one Windows option per hard disk that contains an MBR).
    http://support.apple.com/kb/ht1310

     
  • kami
    kami
    2011-09-12

    Hi,

    thanks a lot for you help. But i think that is not really my Problem.
    So here are the facts:
    - The Linux-Live-USB Stick is working fine. It can be used as a bootable stick. And i know that it is working with my refit.
    - Before the update of gptsync with this settings in the MBR:
    Current MBR partition table
    # A Start LBA End LBA Type
    1 1 236978175 EE EFI Protective
    my USB-Stick was booting and my Linux-Partition fails to load.
    But both of them were shown in the refit menu selection.

    - After updating my gptsync to this:
    # A Start LBA End LBA Type
    1 40 409639 EE EFI Protective
    2 409640 195722135 AC Apple RAID
    3 195722136 196991671 AB Mac OS X Boot
    4 * 196993024 234932223 Linux

    My Linux Partition is booting really fine, but my Live-USB-Stick is not working.
    I can see both things in the refit selection menu. If i try to make a chainloading with Grub it cant find the USB-Stick?

    So maybe there is something wrong?

    Thanks a lot.

    Cu kami

     
  • Joe van Tunen
    Joe van Tunen
    2011-09-12

    With the MBR setup to boot your Linux Partition, test if you can boot your USB stick without rEFIt using any of the following methods that I explained before:

    A) Startup Disk preferences panel (may require a /Windows/System32/ntdll.dll file be created).
    B) bless command (using the Terminal.app).
    C) Startup Manager (press option at startup to bypass rEFIt and get to the Startup Manager).

    If any of those methods works, then rEFIt can probably be fixed to do the same thing.