Originally written: 3/19/2012; last Web page update:
-9/19/2015, referencing rEFInd 0.9.2
+3/4/2017, referencing rEFInd 0.10.5
This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!
This method requires that your /boot directory, whether it's on a separate partition or is a regular directory in your root (/) filesystem, be readable by the EFI. At the moment, all EFI implementations can read FAT and Macs can read HFS+. By using drivers, you can make any EFI read HFS+, ISO-9660, ReiserFS, ext2fs, ext3fs, ext4fs, Btrfs, or other filesystems. Thus, if you use any of these filesystems on a regular partition (not an LVM or RAID configuration) that holds your kernels in /boot, you qualify for this easy method. The default partition layouts used by Ubuntu, Fedora, and many other distributions qualify, because they use one of these filesystems (usually ext4fs) in a normal partition or on a separate /boot partition. You must also have a 3.3.0 or later Linux kernel with EFI stub support, of course.
-
If you installed rEFInd 0.6.0 or later with its install.sh script from your regular Linux installation, chances are everything's set up; you should be able to reboot and see your Linux kernels as boot options. If you installed manually, from OS X, or from an emergency system, though, you may need to do a couple of things manually:
+
If you installed rEFInd 0.6.0 or later with its refind-install (formerly install.sh) script from your regular Linux installation, chances are everything's set up; you should be able to reboot and see your Linux kernels as boot options. If you installed manually, from OS X, or from an emergency system, though, you may need to do a couple of things manually:
@@ -196,7 +190,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com
Partition (ESP). You may need to create this subdirectory, too.
Create a refind_linux.conf file in your /boot
- directory. The mkrlconf.sh script that comes with rEFInd
+ directory. The mkrlconf script that comes with rEFInd
should do this job, or you can do it manually as described later. Starting with version 0.6.12, rEFInd can
create minimal boot options from /etc/fstab, if /boot
@@ -234,7 +228,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com
Copy the /boot/refind_linux.conf file to the same directory to
which you copied your kernel. If this file doesn't exist, create it by
- running (as root) the mkrlconf.sh script that came
+ running (as root) the mkrlconf script that came
with rEFInd. This step may not be strictly necessary if /boot
is an ordinary directory on your root (/) partition.
@@ -298,7 +292,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com
/boot/refind_linux.conf and populate it with kernel options,
as described later. If this file doesn't
already exist, the easiest way to create it is to run the
- mkrlconf.sh script that comes with rEFInd 0.5.1 and
+ mkrlconf script that comes with rEFInd 0.5.1 and
later.
Check your refind.conf file (presumably in
@@ -372,30 +366,63 @@ extends it as follows:
A kernel whose filename lacks a version string matches an initial RAM disk that also lacks a version string in its filename. Note that you can reliably use only one kernel and initial RAM disk per directory that lack version numbers in their filenames.
-
rEFInd looks for an initial RAM disk in the same directory as the
- kernel file. A matching initial RAM disk has a name that begins with
+
rEFInd looks for an initial RAM disk in the same directory as the kernel
+ file. A matching initial RAM disk has a name that begins with
init and that includes the same version string as the kernel.
- The version string is defined as the part of the filename from the
- first digit to the last digit, inclusive. Note that the version string
- can include non-digits. For instance, the version string for
+ The version string is defined as the part of the filename from the first
+ digit to the last digit, inclusive. Note that the version string can
+ include non-digits. For instance, the version string for
bzImage-3.19.0.efi is 3.19.0, which matches
initramfs-3.19.0.bz; and
vmlinuz-4.2.5-300.fc23.x86_64's version string is
4.2.5-300.fc23.x86_64, which matches
- initrd-4.2.5-300.fc23.x86_64.img. Many other matches are
- possible. If an initial RAM disk is identified, rEFInd passes a
- suitable initrd= option to the kernel when it boots.
+ initrd-4.2.5-300.fc23.x86_64.img. In order to support Arch Linux
+ kernel naming the strings linux and linux-lts are
+ treated as digits. So vmlinuz-linux-lts has version
+ linux-lts, which matches initramfs-linux-lts.img.
+ Many other matches are possible. If an initial RAM disk is identified,
+ rEFInd passes a suitable initrd= option to the kernel when it
+ boots. There are two variants on this rule:
+
+
+
+
As an extension to the preceding point, if multiple initial RAM disk
+ files match one kernel, the one whose filename matches the most
+ characters after the version string is used. For instance, suppose
+ the kernel filename is vmlinuz-4.8.0-32-standard, and two
+ initial RAM disk files are initrd-4.8.0-32-standard and
+ initrd-4.8.0-32-debug. The first of those files has nine
+ matching characters after the version string (-standard),
+ vs. just one matching character (-) for the second. Thus,
+ the first file will be used.
+
+
If the refind_linux.conf file (described next) is present,
+ and if an initrd= specification is present for the option
+ you're using, rEFInd will not add a pointer to the initial
+ RAM disk file that it discovers. This feature enables you to
+ override rEFInd's initial RAM disk discovery. This is most useful in
+ Arch Linux, which can be configured with two different initial RAM
+ disk files, one to be used for normal booting and one for recovery
+ situations. You can specify each initial RAM disk file on its own
+ line, which gives you the ability to control which to use at boot
+ time.
rEFInd looks for a file called refind_linux.conf in the same
- directory as the kernel file. It consists of a series of lines,
- each of which consists of a label followed by a series of kernel
- options. The first line sets default options, and subsequent lines set
- options that are accessible from the main menu tag's submenu screen. If
- you installed rEFInd with the install.sh
- script, that script created a sample refind_linux.conf file,
- customized for your computer, in /boot. This file will work
- without changes on many installations, but you may need to tweak it for
- some.
+ directory as the kernel file. It consists of a series of lines, each of
+ which consists of a label followed by a series of kernel options. The
+ first line sets default options, and subsequent lines set options that
+ are accessible from the main menu tag's submenu screen. If you installed
+ rEFInd with the refind-install script, that script created a
+ sample refind_linux.conf file, customized for your computer, in
+ /boot. This file will work without changes on many
+ installations, but you may need to tweak it for some. If the kernel
+ options string includes the substring %v, rEFInd substitutes
+ the kernel version number for that string. (If you need the actual
+ string %v in your kernel options, use %%v instead;
+ rEFInd will change this to %v.) This feature can be used to
+ match an initial RAM disk file that requires special treatment, such as
+ if you have multiple numbered kernels, each of which has two initial RAM
+ disk files.
If rEFInd can't find a refind_linux.conf file in the directory
that holds the kernel, the program looks for a file called
@@ -414,7 +441,7 @@ extends it as follows:
If rEFInd can't find a refind_linux.conf file or an
/etc/fstab file, it tries to identify the Linux root
- (/ filesystem by looking for a partition with a GUID type code
+ (/) filesystem by looking for a partition with a GUID type code
matching that specified for the root (/) filesystem in the Freedesktop.org
Discoverable Partitions Specification. These type codes are as yet
@@ -457,7 +484,7 @@ total 17943
Note that in this example, the default kernel (the one with the most recent time stamp) appears first on the list, with the labels specified in refind_linux.conf. Subsequent kernels (just one in this example) appear below it, with the same labels preceded by the kernel filename. If you were to set fold_linux_kernels false, each kernel would get its own entry on the main menu, and each one's submenu would enable options for launching it alone.
-
To assist in initial configuration, rEFInd's install.sh script creates a sample refind_linux.conf file in /boot. This sample file defines three entries, the first two of which use the default GRUB options defined in /etc/default/grub and the last of which uses minimal options. The first entry boots normally and the second boots into single-user mode. If you want to create a new file, you can use the mkrlconf.sh script that comes with rEFInd. If you pass it the --force option, it will overwrite the existing /boot/refind_linux.conf file; otherwise it will create the file only if one doesn't already exist.
+
To assist in initial configuration, rEFInd's refind-install script creates a sample refind_linux.conf file in /boot. This sample file defines three entries, the first two of which use the default GRUB options defined in /etc/default/grub and the last of which uses minimal options. The first entry boots normally and the second boots into single-user mode. If you want to create a new file, you can use the mkrlconf script that comes with rEFInd. If you pass it the --force option, it will overwrite the existing /boot/refind_linux.conf file; otherwise it will create the file only if one doesn't already exist.
From a user's perspective, the submenus defined in this way work just like submenus defined via the submenuentry options in refind.conf, or like the submenus that rEFInd creates automatically for Mac OS X or ELILO. There are, however, limitations in what you can accomplish with this method:
@@ -475,7 +502,8 @@ total 17943
All the kernels in a given directory use the same
refind_linux.conf file. If you need to set different options
for different kernels, you'll need to place those kernels in different
- directories.
+ directories. (A partial exception is the kernel version string, which
+ can be passed via the %v variable, as noted earlier.)
You must place your kernels in a directory other than the one that
holds the main rEFInd .efi file. This is because rEFInd does
@@ -495,7 +523,7 @@ total 17943
-