rEFInd
Related articles
rEFInd is a UEFI boot manager. It is a fork of the no-longer-maintained rEFIt and fixes many issues with respect to non-Mac UEFI booting. It is designed to be platform-neutral and to simplify booting multiple OSes.
Contents
Installation
Install refind-efi from the Official repositories.
Scripted configuration
rEFInd package includes the /usr/bin/refind-install
script to simplify the process of setting rEFInd as your default EFI boot entry. The script has several options for handling differing setups and UEFI implementations, but for many systems it should be sufficient to simply run
# refind-install
This will attempt to find and mount your ESP, copy rEFInd's files to /EFI/refind/
on the ESP, and add rEFInd as the default EFI boot entry using UEFI#efibootmgr.
You can also install rEFInd to the default/fallback boot path /EFI/BOOT/BOOT*.EFI
. This is helpful for bootable USB flash drives or on systems that have issues with the NVRAM changes made by efibootmgr:
# refind-install --usedefault /dev/sdXY
Where /dev/sdXY is the partition of your ESP. Read the comments in the install script for an explanation of each option.
After installing rEFInd's files to the ESP, verify that rEFInd has created refind_linux.conf
containing the required kernel parameters (e.g. root=
) in the same directory as your kernel. If it has not created this file, you will need to set up #Passing kernel parameters manually or you will most likely get a kernel panic on your next boot.
By default, rEFInd will scan all of your drives (that it has drivers for) and add a boot entry for each EFI bootloader it finds, which should include your kernel (since Arch enables EFISTUB by default). So you may have a bootable system at this point.
Manual configuration
If the refind-install
script does not work for you, rEFInd can be set up manually.
First, copy the executable to the ESP:
# cp /usr/share/refind/refind_x64.efi $esp/EFI/refind/
Then use UEFI#efibootmgr to create a boot entry in the UEFI NVRAM (change X and Y to match the device and partition of your ESP). If you are installing rEFInd to the default UEFI path /EFI/BOOT/BOOTX64.EFI
, you can probably skip this step.
# efibootmgr -c -d /dev/sdX -p Y -l /EFI/refind/refind_x64.efi -L "rEFInd Boot Manager"
At this point, you should be able to reboot into rEFInd but it will not be able to boot your kernel. If your kernel does not reside on your ESP, rEFInd can mount your partitions to find it - provided it has the right drivers:
# mkdir $esp/EFI/refind/drivers # cp /usr/share/refind/drivers_x64/myrootfs_x64.efi $esp/EFI/refind/drivers
Now rEFInd should have a boot entry for your kernel, but it will not pass the correct kernel parameters. Set up #Passing kernel parameters. You should now be able to boot your kernel using rEFInd. If you are still unable to boot or if you want to tweak rEFInd's settings, many options can be changed with a config file:
# cp /usr/share/refind/refind.conf-sample $esp/EFI/refind/refind.conf
The sample config is well commented and self-explanatory.
Unless you have set textonly
in the config file, you should copy rEFInd's icons to get rid of the ugly placeholders:
# cp -r /usr/share/refind/icons $esp/EFI/refind/
You can try out different fonts by copying them and changing the font
setting in refind.conf
:
# cp -r /usr/share/refind/fonts $esp/EFI/refind/
File system drivers
rEFInd currently has read-only drivers for these file systems:
Installing drivers for rEFInd
rEFInd automatically loads all drivers from the subdirectories drivers
and drivers_arch
(e.g. drivers_x64
) in its install directory.
# cp /usr/share/refind/drivers_x64/drivername_x64.efi $esp/EFI/refind/drivers_x64/
Using drivers in UEFI shell
To use rEFInd's drivers in UEFI shell load them using command load
and refresh mapped drives with map -r
.
# load FS0:\EFI\refind\drivers\ext4_x64.efi # map -r
Now you can access your file system from UEFI shell.
Passing kernel parameters
There are two methods for setting the kernel parameters that rEFInd will pass to the kernel.
For kernels automatically detected by rEFInd
If rEFInd automatically detects your kernel, you can place a refind_linux.conf
file containing the kernel parameters in the same directory as your kernel. You can use /usr/share/refind/refind_linux.conf-sample
as a starting point. The first uncommented line of refind_linux.conf
will be the default parameters for the kernel. Subsequent lines will create entries in a submenu accessible using +
, F2
, or Insert
.
Alternatively, try running:
# refind-mkrlconf
Which will attempt to find your kernel in /boot
and automatically generate refind_linux.conf
. The script will only set up the most basic kernel parameters, so be sure to check the file it created for correctness.
If you do not specify an initrd=
parameter, rEFInd will automatically add it by searching for common RAM disk filenames in the same directory as the kernel. If you need multiple initrd=
parameters (e.g. for Microcode) you must specify them manually in refind_linux.conf
.
Manual boot stanzas
If your kernel is not autodetected, or if you simply want more control over the options for a menu entry, you can manually create boot entries using stanzas in refind.conf
. Ensure that scanfor
includes manual
or these entries will not appear in rEFInd's menu. Kernel parameters are set with the options
keyword. rEFInd will append the initrd=
parameter using the file specified by the initrd
keyword in the stanza. If you need additional initrds (e.g. for Microcode), you can specify them in options
(and the one specified by the initrd
keyword will be added to the end).
$esp/EFI/refind/refind.conf
... menuentry "Arch Linux" { icon /EFI/refind/icons/os_arch.png volume Boot loader /boot/vmlinuz-linux initrd /boot/initramfs-linux.img options "root=PARTUUID=XXXXXXXX rootfstype=XXXX rw add_efi_memmap" submenuentry "Boot using fallback initramfs" { initrd /boot/initramfs-linux-fallback.img } }
It is likely that you will need to change volume
to match either a filesystem's LABEL, a PARTLABEL, a PARTUUID, or a volume number (e.g. 0:
) of the partition where the kernel image resides. See Ext3#Assigning a label as an example of assigning a volume label.
Using rEFInd with an existing UEFI Windows installation
rEFInd is compatible with the EFI system partition created by a UEFI Windows installation, so there is no need to create or format another FAT32 partition when installing Arch alongside Windows. Simply mount Windows' ESP and install rEFInd as usual. By default, rEFInd's autodetection feature should recognize any existing Windows/recovery bootloaders.
Upgrading rEFInd
Pacman updates the rEFInd files in /usr/share/refind
and will not copy new files to the ESP for you. If refind-install
worked for your original installation of rEFInd, you can rerun it to copy the updated files. The new config file will be copied as refind.conf-sample
so that you can integrate changes into your config file using a diff tool. If your rEFInd required #Manual configuration, you will need to copy the new files yourself.
Systemd automation
To automate this process, you need a .path file for watching for rEFInd updates and a .service file for copying the new files and updating the nvram.
/etc/systemd/system/refind_update.path
[Unit] Description=path monitor for rEFInd updates [Path] PathChanged=/usr/share/refind [Install] WantedBy=multi-user.target
/etc/systemd/system/refind_update.service
[Unit] Description=rEFInd boot manager update [Service] Type=oneshot ExecStart=/usr/bin/refind-install
Then enable refind_update.path
.
Apple Macs
mactel-bootAUR from the AUR is an experimental "bless" utility for Linux. If that does not work, use "bless" from within OSX to set rEFInd as the default boot entry. Assuming your UEFISYS partition is mounted at /mnt/efi
within OSX, do:
# bless --setBoot --folder /mnt/efi/EFI/refind --file /mnt/efi/EFI/refind/refind_x64.efi
VirtualBox
Currently, VirtualBox will only boot the default /EFI/BOOT/BOOT*.EFI
path, so refind-install
needs to be used with at least the --usedefault
option. See VirtualBox#Installation in EFI mode for more information.
Tools
rEFInd supports running various 3rd-party tools. Tools need to be installed separately. Edit showtools
in refind.conf
to choose which ones to show.
$esp/EFI/refind/refind.conf
... # Which non-bootloader tools to show on the tools line, and in what # order to display them: # shell - the EFI shell (requires external program; see rEFInd # documentation for details) # memtest - the memtest86 program, in EFI/tools, EFI/memtest86, # EFI/memtest, EFI/tools/memtest86, or EFI/tools/memtest # gptsync - the (dangerous) gptsync.efi utility (requires external # program; see rEFInd documentation for details) # gdisk - the gdisk partitioning program # apple_recovery - boots the Apple Recovery HD partition, if present # windows_recovery - boots an OEM Windows recovery tool, if present # (see also the windows_recovery_files option) # mok_tool - makes available the Machine Owner Key (MOK) maintenance # tool, MokManager.efi, used on Secure Boot systems # about - an "about this program" option # exit - a tag to exit from rEFInd # shutdown - shuts down the computer (a bug causes this to reboot # many UEFI systems) # reboot - a tag to reboot the computer # firmware - a tag to reboot the computer into the firmware's # user interface (ignored on older computers) # netboot - launch the ipxe.efi tool for network (PXE) booting # Default is shell,memtest,gdisk,apple_recovery,windows_recovery,mok_tool,about,shutdown,reboot,firmware # showtools shell, memtest, netboot, about, reboot, firmware ...
UEFI shell
See UEFI shell.
Copy shellx64.efi
to the root of EFI System Partition
Memtest86
Install memtest86-efiAUR from AUR and copy it to $esp/EFI/tools/
.
# cp /usr/share/memtest86-efi/bootx64.efi $esp/EFI/tools/memtest86.efi
iPXE
refind-efi contains the iPXE UEFI binaries, you just need to copy them to $esp/EFI/tools/
.
# cp /usr/share/refind/tools_x64/ipxe_discovery_x64.efi $esp/EFI/tools/ipxe_discovery.efi # cp /usr/share/refind/tools_x64/ipxe_x64.efi $esp/EFI/tools/ipxe.efi
See also
- The rEFInd Boot Manager by Roderick W. Smith.
-
/usr/share/refind/docs/README.txt