I have a problem: From OSX I installed rEFInd 0.6.8 to the ESP of my Macbook Air. I kept the old ESP partition (where rEFInd resides) but removed OSX completely and installed Linux Mint on the rest of the internal hard drive space. Good: rEFInd is started and detects and boots Linux Mint.
Now I would like to do a backup with Clonezilla Live on an USB stick. When booting that USB stick is detected by rEFInd and shown as a boot choice, I can select it to boot but in the end it ends up booting Linux Mint from the internal SSD-which is wrong. Also the Linux Mint Live System Installation Stick ends up booting Linux Mint from the internal SSD-also wrong. What's going on? Yesterday I installed with rEFInd from that stick and that Clonezilla Stick I also booted successfully on the MacBook Air with rEFInd some time ago... Is there a problem booting between different legacy OSs/Linux installations?
Maybe the following helps finding the problem:
I tried different combinations (all are using the same rEFInd 0.6.8 installed in the MacBook Air's ESP):
OSX on internal SSD, Linux Mint Live USB stick bootable
OSX on internal SSD, Clonezilla Live USB stick bootable
Linux Mint on internal SSD, OSX on USB hard disk bootable
Not working combinations:
Linux Mint on internal SSD, Linux Mint Live USB stick not bootable, boots Linux Mint on internal SSD
Linux Mint on internal SSD, Clonezilla Live USB stick not bootable, boots Linux Mint on internal SSD
So it seems to be a Linux only problem...
Also I was surprised that the text below the USB stick's Legacy OS icon with the little USB icon says "Boot Legacy OS from HD". I was expecting it to say "Boot Legacy OS from USB" matching the USB icon ("trifork")...
Can anyone help? Thanks in advance.
Joe van Tunen
I seem to remember (but I could be mistaken and can't find any info) that booting a legacy OS (either Windows or Linux) from USB is only possible if the HD doesn't have a legacy OS boot already.
You will probably encounter this problem even if you bypassed rEFInd by using the Mac's built-in Startup Manager (but you should try that anyway). The Mac's built-in startup manager is sufficient when you only have one Legacy OS per hard drive. Otherwise, you want to use rEFInd.
Do you find that running rEFInd from the ESP (which uses a FAT file system) performs as well as on an HFS+ partition? On my Mac Pro 2008, rEFInd takes 30 seconds longer to appear when it's on a FAT file system.
The "Boot Legacy OS from HD" label appears to be a compromise in the code since it doesn't distinguish between USB and FireWire though I believe that can be changed. The code does appear to use the correct "USB" load option though for external disks. Booting a Legacy OS from FireWire isn't possible so using the USB option for FireWire disks isn't a bad thing.
Roderick W. Smith
Joe van Tunen is correct: Booting a BIOS/CSM/legacy-mode OS is a tricky thing for rEFInd to do. The relevant code is inherited from rEFIt with few changes because I find the code hard to understand. I want to improve it, but it's going to take some study -- and a good chunk of time -- on my part to do so.
In the meantime, you might try booting the Linux USB flash drives in EFI mode instead of in BIOS mode. If the USB drives include EFI boot loaders, rEFInd should pick them up and present them as options automatically. If not, you may be able to add EFI boot loaders, or perhaps use rEFInd's also_scan_dirs option so that rEFInd picks up the USB drives' kernels directly. (The latter might require manually adding boot options by pressing Insert or F2 twice or by creating a refind_linux.conf file in the kernels' directory.)
@Joe van Tunen: Thanks for the links but the Mac alt/option boot menu is not able to load legacy OSs from USB at all. In the Mac alt boot menu the legacy Linux on the internal SSD is offered as boot choice "Windows". Apart from that there is only a second choice called "EFI boot" that starts rEFInd. Both connected legacy Linux USB sticks were not offered as a boot choice there. Booting legacy OSs from USB seems to be something that only rEFInd could/can do. Maybe that is the trick Roderick W. Smith mentioned above...
(CC: @Roderick W. Smith) Coming back to your question: With rEFInd 0.6.8 installed in ESP I also had that "30 secs pause" before the rEFInd menu shows up. With rEFInd 0.6.4 installed in the same ESP the rEFInd menu shows up almost immediately. So that seems to be related to some code change introduced after 0.6.4 that causes this long pause...
@Roderick W. Smith: As you speak of doing a code refactoring. As a professional Java developer not having programmed C for almost 20 years I find the rEFInd code base also hard to understand... Especially the lack of a TDD style makes it hard for me to see what is going on. Maybe it would be good to build an end to end integration test harness before starting major refactorings. The way I understood what rEFInd basically does: Functionally there is a lot of scanning functionality which detects OSs on various medias (internal, external, optical, USB). Then there is GUI/menu functionality and somewhere there must be a call to the EFI firmware which should the tell the EFI firmware "boot partition X on drive Y" (maybe over-simplification). In a TDD style system I could mock the detection part and simulate a scenario like "disk0: partition 1 = EFI, partition 2 = Linux swap, partition 3 = Linux. disk 1: partition 1 = iso9660". Then I could mock the menu rEFInd menu/GUI functionality and simulate a scenario like e. g. "disk1/partition1 selected". And then I could mock the EFI interface component and make an assert if my program really tells the EFI component that disk1/partition1 needs to be booted...
Roderick W. Smith
The 30-second delay has been reported in rEFIt as well as in numerous versions of rEFInd, including in versions before 0.6.4. Furthermore, some people have reported not having the problem, and it then appearing when re-installing the same version of rEFInd. These observations rule out a new bug being introduced between version 0.6.4 and 0.6.8. Rather, the pattern of results suggests to me that there's a bug or design limitation in Apple's firmware that causes programs launched from a FAT ESP to be delayed under some circumstances. Unfortunately, since I've never encountered the problem myself, I can't really investigate this further or even test my hypothesis. If you (or somebody else) with the problem cares to try, I recommend installing gummiboot or GRUB 2 in place of rEFInd (ideally by copying the new binary over the old one in Linux) and seeing if it also takes a while to come up. If not, then perhaps something can be done in rEFInd's code to improve matters; but if, as I suspect, another boot loader would also be delayed, then that suggests the problem lies elsewhere. Perhaps a different installation procedure would help -- but again, as I've never encountered the problem myself, I'm not exactly in a position to experiment. As described in the rEFInd documentation, several solutions to the sluggish-boot problem exist. All of these solutions come from users who have discovered them, and I've been unable to test them myself.
As to coding style and TDD, I'm afraid that your message is the first I've heard of TDD. I'm not a professional software developer, and I don't have time to keep up with every new technique to come along. Although it sounds like it may be an interesting technique, in all honesty I don't have the time to learn it, to create a suitable EFI test environment, and to restructure the rEFInd code in a TDD style. I think it's best that I focus my efforts on improving rEFInd's reliability and adding those features that seem most important, rather than making a massive change to the code base. This might eventually change, of course, but not in the near term.