1

I'm in OS X. In the refind-install script, there's a bless command that is running, but doesn't seem to work:

   elif [[ "$TargetDir" != "/EFI/BOOT" ]] ; then
      bless --setBoot --folder "$InstallDir/$TargetDir" --file "$InstallDir/$TargetDir/$Refind"
      echo BLESS COMMAND: bless --setBoot --folder "$InstallDir/$TargetDir" --file "$InstallDir/$TargetDir/$Refind"
   fi

I added the extra echo line to see what the command looks like, and this is the output:

BLESS COMMAND: bless --setBoot --folder /Volumes/efi///EFI/refind --file /Volumes/efi///EFI/refind/refind_x64.efi

I'm running the install script like this:

sudo ./refind-install --root /Volumes/efi

where /Volume/efi contains the root of a custom EFI System Partition on disk0s6, not my MacBook's default disk0s1 ESP.

Any idea why it doesn't work and how to get rEFInd to boot by default?

EDIT:

Alright, I think I might know what's wrong. So, I was able to make it work by replacing the --root option to refind-install with the --usedefault option, like this:

sudo ./refind-install --usedefault /dev/disk0s6

Now, what happens next is that the script ignores /dev/disk0s6 and goes ahead and install rEFInd to /dev/disk0s1, the main OS X ESP (which isn't what I desired, but it works).

The script then goes ahead and runs the other bless command:

   if [[ $InstallToEspOnMac == "1" ]] ; then
      bless --mount "$InstallDir" --setBoot --file "$InstallDir/$TargetDir/$Refind" --shortform
   elif [[ "$TargetDir" != "/EFI/BOOT" ]] ; then

After rebooting, this works, and rEFInd boots by default. I have a hunch that this is working due to rEFInd being installed to the default /EFI/BOOT/bootx64.efi inside the OS X ESP partition.

But this isn't what I want. I'd like to have refind installed on /dev/disk0s6, in /EFI/refind/ instead of /EFI/BOOT.

EDIT:

Also note that when using the --usedefault option, the install script installs refind_aa64.efi into /EFI/BOOT of the OS X ESP (disk0s1) but when using the --root option to install to disk0s6 the script instead installs refind_x86.efi

Also, I'm not sure if perhaps having the --mount option in one bless command but not the other is what made the difference.

EDIT:

I was able to copy over /EFI/BOOT from disk0s1 to disk0s6, then run the same --mount bless command as in the script, and that worked.

EDIT:

Alright, we're getting closer. I modified the script, and changed

   elif [[ "$TargetDir" != "/EFI/BOOT" ]] ; then
      bless --setBoot --folder "$InstallDir/$TargetDir" --file "$InstallDir/$TargetDir/$Refind"
   fi

to

   elif [[ "$TargetDir" != "/EFI/BOOT" ]] ; then
      bless --mount "$InstallDir" --setBoot --file "$InstallDir/$TargetDir/$Refind"
   fi

and now that works as I want: refind installed to /EFI/refind on the partition whose mount point I specify with the --root option. Although this gives me the result I was looking for, there is now one small problem: it takes around 30 seconds or more to finally arrive at rEFInd when booting, which is really slow for some reason. I'm going to reset NVRAM and try again...

EDIT

Aha! Before resetting NVRAM, I tried adding the --shortform option to the bless command, and that fixed the lag issue in the previous edit!

Why is the second bless command in --folder mode? It seems to work better in --mount mode.

So, for now, the solution was to modify the second bless command in the script to be exactly like the first, so that part of the script looks like this:

   if [[ $InstallToEspOnMac == "1" ]] ; then
      bless --mount "$InstallDir" --setBoot --file "$InstallDir/$TargetDir/$Refind" --shortform
   elif [[ "$TargetDir" != "/EFI/BOOT" ]] ; then
      bless --mount "$InstallDir" --setBoot --file "$InstallDir/$TargetDir/$Refind" --shortform
   fi

and I used the --root option for refind-install to specify the mount point of the target partition.

mkdir /Volumes/efi
sudo mount -t msdos /dev/disk0s6 /Volumes/efi
sudo ./refind-install --root /Volumes/efi
3
  • We're sorry, but this site is all about Ubuntu and its official derivatives as posted on wiki.ubuntu.com/UbuntuFlavors so Apple stuff is off-topic here as well. However, on Ask Different, a sister site to Ask Ubuntu, they're very good at all fruity varieties, so you might be better off there. ;-) – Fabby Jan 4 '16 at 22:46
  • 1
    rEFInd is a boot manager for EFI-based computers. Presumably trusktr is trying to dual-boot with Ubuntu, but the preferred way of installing rEFInd on a Mac is from OS X. This question is thus similar to the numerous questions from people who have problems with computers that boot straight to Windows after installing Ubuntu, in that the fix to get Ubuntu to boot may involve a non-Ubuntu OS. – Rod Smith Jan 4 '16 at 22:55
  • That was exactly my reason for posting here. – trusktr Jan 5 '16 at 3:51
2

First, the --root option is not used to specify an ESP; it's used to specify your normal installation's root (/) directory. It's intended for use when installing rEFInd from a Linux emergency system, although it could be used from an OS X system (but would likely not be very useful there, except maybe in conjunction with --notesp -- but I've not tested that). Thus, you're basically "barking up the wrong tree" in trying to use that option.

The refind-install script doesn't really have any explicit options to install rEFInd to a secondary ESP. In Linux, you can control the ESP by mounting the one you want at /boot or /boot/efi; but in OS X, the ESP isn't normally mounted, so the script tries to find the ESP, and if you have multiple ESPs, it's not guaranteed to use the one you want. In such a case, you pretty much have to fall back to manual installation, as described here:

http://www.rodsbooks.com/refind/installing.html#osx

Alternatively, you could use --ownhfs to install rEFInd to a dedicated HFS+ volume. Note that having two ESPs is not likely to be helpful. I know you say you want two ESPs, but you haven't said why you want that, and in the absence of a reason, my suggestion is that you forget about it because there's probably no benefit. The ESP is meant to be shared across OSes. There is a danger of one OS messing up another OS's files on the ESP, but keeping a backup should enable you to recover from such problems.

AFAIK, the --folder option to bless works when installing to an HFS+ volume, but not when installing to a FAT volume. Some of the details of this command don't seem to be well-documented, though -- or at least, I've not found good documentation. IIRC, when I wrote refind-install, I took examples from various sites and experimented until I got something that worked, then tweaked it over time using feedback from other users.

4
  • Thanks Rod! You said "There is a danger of one OS messing up another OS's files on the ESP, but keeping a backup should enable you to recover from such problems.". That's one of my main reasons. I just wanted to keep the official ESP clean and leave that to Apple. Plus, the refind_linux.conf file and kernel are also on the second ESP, which actually is mount as /boot in Linux, so I thought it'd be nice to have everything all together on the same partition in addition to keeping Apple stuff clean. Thanks for the input! – trusktr Jan 5 '16 at 3:55
  • Was there a specific reason to use the --folder option when not installing on Mac ESP and not to the default /EFI/BOOT? The --mount option seems to work well, and as in you mentioned will happen to work with FAT cases. Also the --shortform option seems like a good thing to use, as without it it would take approx 30 seconds before rEFInd would show up during boot. I'm not sure if this is due to some updates from OS X El Capitan, as I didn't have that lag problem before El Capitan. – trusktr Jan 5 '16 at 3:55
  • If you're mounting the ESP at /boot in Linux, then it may make sense to have two ESPs. That's a bit beyond the design limits of the refind-install script, though. Also, be aware that Ubuntu has some problems with a FAT /boot partition. Specifically, some (but not all) kernel updates will fail because they sometimes require the temporary use of links, which of course FAT does not support. Thus, you may want to re-think your strategy. As to the bless command specifics, there's one set of options for FAT and another for HFS+ because that's required -- or at least, that's my understanding. – Rod Smith Jan 5 '16 at 13:26
  • Yeah, the bless command seems under-documented sometimes. Disclaimer: I'm actually in Arch Linux where I don't think any type of linking happens when updating the kernel (at least I've had no problems so far), but I posted here because I figured you might not notice the question if I posted elsewhere. Thanks so much. By the way, hosting rEFInd on GitHub would make it easy to make a PR. I might be able to add a command line arg or two to help with certain cases like a second ESP. – trusktr Jan 6 '16 at 0:48
0

I might be wrong, but if you want to have refind showing up after boot, I believe you must choose your ESP partition for refind.

Are you trying to instal from Linux or from Mac OS X?

1
  • I just posted an edit. I was able to transplant /EFI/BOOT from one partition to the other, then bless it using the --mount mode, and that worked, so it's not limited to the default OS X ESP partition. – trusktr Jan 4 '16 at 9:34

Not the answer you're looking for? Browse other questions tagged or ask your own question.