22 December 2018

rEFInd: EFI Boot Manager

What is rEFInd?
Refind is an EFI boot manager (based on the old unmaintained rEFIt). With simple configuration, better functionality and theme supported.


Why rEFInd?
Because most bootloaders are crap. Bootloader should be simple to install, configure and manage. And with themes (because, why not?).


Where I can find more info about it?
http://www.rodsbooks.com/refind/




How can I install it?
1) You should remove your bootmanager (and delete all the crap that it left behind, in case you use a shitty distribution that doesn't clean the mess).
2) See if your distribution have it, if not, go to the main page, download and install it.
3) Run refind-install and it'll do the magic. Check it with efibootmgr if everything is set as expected.
4) See below for extra stuff

rEFInd in a nutshell
Refind will put some files in your ESP directory to properly boot, it's quite simple to figure out, but in special, you have one specific file to take a look: EFI/refind/refind.conf. You can change it by yourself, or replace with this configuration:

# Timeout for boot the default
timeout 20
 

# Hide the elements on the screen
hideui label hints
 

# Use graphics UEFI booted
use_graphics_for linux
 

# Default resolution for UEFI. If you put an unsupported resolution, rEFInd will prompt 
# with choices for the supported ones
resolution 1280 1024
 

# Default selections, the + represents the last booted, and the next ones
# it's for the next in case refind can't detect the last booted OS
default_selection "+,Gentoo,Microsoft,ArchLinux,WhateverOtherOS"

# Show some tools if available
showtools shell, reboot, shutdown, firmware

# Include my theme. Not necessary if you don't want to use any theme and left the default as is.
include themes/yourtheme/theme.conf



The default will look like this:


Custom theme

I have my own custom theme here and it looks like this. Just follow the instructions in this repository and everything will works as expected.
Or refer here to more themes. You can also port Clover-EFI themes without too much hassle.



Using the kernel and initrd inside ESP:

That's my favorite configuration (and you can boot whatever filesystem you want on root and don't mind extra /boot for that).
1) Create a directory for your OS, something like EFI/MyOS
2) Copy your vmlinuz and initrd to EFI/MyOS
3) Create a file inside EFI/MyOS called refind_linux.conf
4) Use the follow example for your refind_linux.conf (it's your boot command-line, so your old boot command-line will work here):

Boot with standard options"  "vmlinuz.efi initrd=\EFI\MyOS\initrd.img root=/dev/rootvg/rootLV rootfstype=jfs verbose" 

5) That's it! You can add more entries for single, etc. Or even create extra directories for extra kernels/OS.

Shortcuts for rEFInd screen:
Keystroke Explanation
left arrow Moves the selection one icon to the left (or up the list in text mode)
right arrow Moves the selection one icon to the right (or down the list in text mode)
up arrow Moves the selection from the utilities row to the OS row (in text mode, moves up one entry)
down arrow Moves the selection from the OS row to the utilities row (in text mode, moves down one entry)
Page Up Scrolls the visible set of tags to the left (or up in text mode)
Page Down Scrolls the visible set of tags to the right (or down in text mode)
Home Moves the selection to the first item on the OS row
End Moves the selection to the last item on the utilities row
Esc or Backspace (Delete on Mac keyboards) Returns from a sub-menu; on the main screen, re-reads the configuration file and re-scans for boot loaders
Delete (on PCs) or minus (-) (Delete on Mac keyboards is Backspace on PC keyboards, and will not work for this) Hides a menu tag. The tag is remembered via the computer's on-board NVRAM.
Insert, F2, Tab, or + From the main menu, opens the selection's submenu, which is most useful with Mac OS X, ELILO, and Linux kernels with EFI stub loader support; in a submenu, opens a line editor enabling editing of boot options
F10 Saves an image of the current screen in the file screenshot_###.bmp, where ### is a sequence number starting with 001, in the EFI System Partition's (ESP's) root directory
F12 or (on some keyboards) Eject Ejects removable media. This feature only works on some Macs, not on UEFI-based PCs.
Enter or spacebar Launches the currently-selected OS, utility, or built-in feature
1 through 9 Launches the specified boot loader by number
A Displays the "About rEFInd" information
E Launches the first instance of ELILO in the boot list
G Launches the first instance of GRUB in the boot list
L Launches the first Linux kernel in the boot list
M Launches the first Mac OS boot loader in the boot list
P Launches gptsync
S Launches an EFI shell, if available
U Shuts down the computer (but note that this is buggy and reboots most UEFI-based PCs)
W Launches the first Windows boot loader
Other letters Launch OSes whose names begin with those letters, as described below
 Source: rEFInd homepage

How about Windows?
rEFInd just needs the Microsoft folder in your ESP, he'll detect automatically.

How about macOS?
You should leave the EFI files of macOS there, and like Windows, rEFInd should detect the files and add an entry automatically. Keep in mind that rEFInd should have priority on boot. 

refind-install doesn't put an entry on my EFI:
Add it manually:

efibootmgr -c -l //EFI//refind//refind_x64.efi -L "rEFInd Boot Manager"

Type efibootmgr to see the results, you should see something like this:

BootCurrent: 0000
Timeout: 0 seconds
BootOrder: 0000
Boot0000* rEFInd Boot Manager


Extra EFI drivers:
You should put your extra EFI drivers (if applicable) in EFI/refind/drivers_x64/
Since we're talking about pure EFI drivers, most drivers should works without problems, like some exotic FS drivers, clover stuff,etc.
Refer here and here on how to find extra EFI drivers.

Secure boot?
I'll not cover this here because I don't use it, but the official homepage have a section dedicated to it.



No comments:

Post a Comment