X-Git-Url: https://code.delx.au/refind/blobdiff_plain/2569172b598d42a95c1aeb3bde752358f0b43689..e366a10e438344bd1331f2de89d177079a91ba76:/docs/refind/linux.html diff --git a/docs/refind/linux.html b/docs/refind/linux.html index 18768f5..13cfd7e 100644 --- a/docs/refind/linux.html +++ b/docs/refind/linux.html @@ -8,6 +8,8 @@ + +

The rEFInd Boot Manager:
Methods of Booting Linux

@@ -15,10 +17,10 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com

Originally written: 3/19/2012; last Web page update: -3/18/2013, referencing rEFInd 0.6.8

+9/19/2015, referencing rEFInd 0.9.2

-

I'm a technical writer and consultant specializing in Linux technologies. 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 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!

@@ -26,49 +28,87 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com

+ - - - - + + -
Donate $2.50 Donate $5.00 Donate $10.00Donate $20.00 Donate another value
- + +
+ + - + + - + + + +Donate with PayPal -
- + +
+ + - + + - + + + +Donate with PayPal -
- + + +
+ + - + + - + + + +Donate with PayPal -
- + +
+ + - + + - + + + +Donate with PayPal + +
+ + + + + + + + + +Donate with PayPal +
@@ -82,7 +122,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com

Donate with PayPal
+
@@ -128,7 +168,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com

Using a Traditional Linux Boot Loader

-

I consider ELILO, GRUB Legacy, and GRUB 2 to be traditional Linux boot loaders. These programs all exist independent of the Linux kernel, but they can load a kernel and hand off control to it. All three programs have their own configuration files that reside in the same directory as the boot loader itself (or optionally elsewhere, in the case of GRUB 2).

+

I consider ELILO, GRUB Legacy, GRUB 2, and SYSLINUX to be traditional Linux boot loaders. These programs all exist independent of the Linux kernel, but they can load a kernel and hand off control to it. All four programs have their own configuration files that reside in the same directory as the boot loader itself (or optionally elsewhere, in the case of GRUB 2).

Ordinarily, rEFInd will detect these traditional boot loaders and provide main menu entries for them. If the boot loader exists in a directory with a name that matches a Linux distribution's icon filename, you'll automatically get a distribution-specific icon to refer to the boot loader.

@@ -138,31 +178,39 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com

Using the EFI Stub Loader: Three Configuration Options

-

The EFI stub loader is basic and reliable, but it requires some setup to use it on some computers. It also requires that you run a kernel with the same bit width as your EFI. In most cases, this means running a 64-bit kernel, since 32-bit EFI-based computers are so rare. I describe three methods of using the EFI stub loader: an easiest method for those with compatible partition and filesystem layouts, a quick test configuration for those without such a layout, and a long-term setup for those without the ideal setup.

+

The EFI stub loader is basic and reliable, but it requires some setup to use it on some computers. It also requires that you run a kernel with the same bit width as your EFI. In most cases, this means running a 64-bit kernel, since 32-bit EFI-based computers are so rare. I describe three methods of using the EFI stub loader: an easiest method for those with compatible partition and filesystem layouts, a quick test configuration for those without such a layout, and a long-term setup for those without the ideal setup.

For Those With Foresight or Luck: The Easiest Method

-

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, or ext4fs. 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.

+

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, or Btrfs. 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: -

    +
+ -

When you reboot, you should see rEFInd options for your Linux kernels. If they work, your job is done, although you might want to apply some of the tweaks described in the maintenance-free setup section. If you have problems, you may need to adjust the refind_linux.conf file, as described in the detailed configuration section.

+

When you reboot, you should see rEFInd options for your Linux kernels. If they work, your job is done, although you might want to apply some of the tweaks described in the maintenance-free setup section. If you have problems, you may need to adjust the refind_linux.conf file, as described in the detailed configuration section.

Preparing a Test Configuration

@@ -187,7 +235,8 @@ 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 - with rEFInd.
  • + with rEFInd. This step may not be strictly necessary if /boot + is an ordinary directory on your root (/) partition.
  • Reboot. You should now see a new entry for launching the Linux kernel that you copied. Try the option. If it works, great. If not, you may @@ -206,7 +255,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com

    If You Need to Reconfigure Your Partitions....

    -

    If your /boot directory happens to be on an XFS, JFS, or Btrfs partition that the EFI can't read, or it's tucked away in an LVM or RAID configuration that the EFI can't read, you won't be able to use the easiest solution. Fortunately, this problem can be overcome with relatively little fuss. Several variant procedures are possible, but I begin by describing one that will almost always work, although it's got some important caveats (described at the end). You should perform the following steps as root, or precede each of these commands with sudo:

    +

    If your /boot directory happens to be on an XFS or JFS partition that the EFI can't read, or it's tucked away in an LVM or RAID configuration that the EFI can't read, you won't be able to use the easiest solution. Fortunately, this problem can be overcome with relatively little fuss. Several variant procedures are possible, but I begin by describing one that will almost always work, although it's got some important caveats (described at the end). You should perform the following steps as root, or precede each of these commands with sudo:

      @@ -269,9 +318,9 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com

      Once this task is done, updates to your kernel will automatically be stored in the root directory of your ESP, where rEFInd will automatically detect them. Thus, the boot configuration becomes maintenance-free. The procedure as just described has some drawbacks, though. By placing your kernels in the root directory of your ESP, you render them vulnerable to any other OS with which you might be dual-booting. Your ESP must also be large enough to hold all your kernels. If you dual-boot with multiple Linux distributions, they might conceivably overwrite each others' kernels, and distinguishing one from another becomes more difficult.

      -

      For these reasons, a variant of this procedure is desirable on some systems. Most of the steps are similar, but in this variant, you create a separate /boot partition that's independent of the ESP. This partition can use FAT, HFS+, ReiserFS, ext2fs, ext3fs, or ext4fs; but if you use any of the last five filesystems (four on Macs), you must install the matching EFI filesystem driver that ships with rEFInd. Creating the filesystem will normally require you to shrink an existing partition by a suitable amount (200–500MiB). Mount your new /boot partition at a temporary location, copy or move the current /boot files into it, unmount it, and add it to /etc/fstab as /boot.

      +

      For these reasons, a variant of this procedure is desirable on some systems. Most of the steps are similar, but in this variant, you create a separate /boot partition that's independent of the ESP. This partition can use FAT, HFS+, ReiserFS, ext2fs, ext3fs, ext4fs, or Btrfs; but if you use any of the last six filesystems (five on Macs), you must install the matching EFI filesystem driver that ships with rEFInd. Creating the filesystem will normally require you to shrink an existing partition by a suitable amount (200–500MiB). Mount your new /boot partition at a temporary location, copy or move the current /boot files into it, unmount it, and add it to /etc/fstab as /boot.

      -

      If your distribution already uses a separate /boot partition, but if it uses XFS or some other unsuitable filesystem, you can back it up, create a fresh FAT, HFS+, ReiserFS, ext2, ext3, or ext4 filesystem on it, and restore the original files. You'll probably need to adjust the UUID value in /etc/fstab to ensure that the computer mounts the new filesystem when you boot. If you use a separate non-ESP /boot partition, you'll probably want to continue mounting the ESP at /boot/efi.

      +

      If your distribution already uses a separate /boot partition, but if it uses XFS or some other unsuitable filesystem, you can back it up, create a fresh FAT, HFS+, ReiserFS, Btrfs, ext2, ext3, or ext4 filesystem on it, and restore the original files. You'll probably need to adjust the UUID value in /etc/fstab to ensure that the computer mounts the new filesystem when you boot. If you use a separate non-ESP /boot partition, you'll probably want to continue mounting the ESP at /boot/efi.

      EFI Stub Loader Support Technical Details

      @@ -293,7 +342,9 @@ on BIOS. The most reliable solution under BIOS is to chainload one boot loader to another. The same solution is possible under EFI, but rEFInd offers another possibility.

      -

      rEFInd 0.2.1 and later supports semi-automatic Linux EFI stub loader detection. This feature works as part of the standard boot loader scan operation, but it extends it as follows:

      +

      rEFInd supports semi-automatic Linux EFI stub loader detection. This +feature works as part of the standard boot loader scan operation, but it +extends it as follows:

        @@ -309,6 +360,17 @@ offers another possibility.

        rEFInd won't scan for kernels that lack .efi filename extensions. +
      1. If a file's name ends in .efi.signed, any other file with an + otherwise-identical name that lacks this extension is excluded. + This peculiar rule exists because Ubuntu has begun delivering two + copies of every kernel, one with and one without this extension. The + one with the extension is signed with a Secure Boot key; the one + without it is not so signed. Thus, if both files are present, the one + without the key won't boot on a computer with Secure Boot active, and + either will boot if Secure Boot is inactive. Thus, rEFInd excludes the + redundant (unsigned) file in order to help keep the list of boot + options manageable.
      2. +
      3. rEFInd looks for an initial RAM disk in the same directory as the @@ -324,11 +386,8 @@ offers another possibility.

        initial RAM disk is identified, rEFInd passes a suitable initrd= option to the kernel when it boots.
      4. - -
      5. rEFInd looks for a file called refind_linux.conf in the same - directory as the kernel file. This file is a practical requirement for - booting from an auto-detected kernel. It consists of a series of lines, + 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 @@ -338,6 +397,21 @@ offers another possibility.

        without changes on many installations, but you may need to tweak it for some.
      6. +
      7. If rEFInd can't find a refind_linux.conf file in the directory + that holds the kernel, the program looks for a file called + /etc/fstab on the partition that holds the kernel. If this + standard Linux file is present, rEFInd uses it to identify the root + (/) filesystem and creates two sets of Linux kernel boot + options: One set launches the kernel normally, but with minimal + options, and the other set launches the kernel into single-user mode. + This step can get a computer to boot without any rEFInd-specific + configuration files, aside from refind.conf in rEFInd's own + directory, but only if /boot is not a separate partition. The + intent is to facilitate the use of rEFInd as an emergency boot manager + or to help users who must install rEFInd from OS X or Windows. Note + that rEFInd uses /etc/fstab only if refind_linux.conf + is not found.
      8. +

      The intent of this system is that distribution maintainers can place their kernels, initial RAM disks, and a refind_linux.conf file in their own subdirectories on the ESP, on EFI-accessible /boot partitions, or in /boot directories on EFI-accessible Linux root (/) partitions. rEFInd will detect these kernels and create one main menu entry for each kernel. Each entry will implement as many options as there are lines in the refind_linux.conf file. In this way, two or more distributions can each maintain their boot loader entries, without being too concerned about who maintains rEFInd as a whole.

      @@ -406,19 +480,21 @@ total 17943 -

      Ordinarily, a kernel booted in this way must reside on the ESP, or at least on another FAT partition. On a Macintosh, though, you can use HFS+ to house your kernel files. In fact, that may be necessary; my Mac Mini hangs when I try to boot a Linux kernel via an EFI stub loader from the computer's ESP, but it works fine when booting from an HFS+ partition. If you use EFI drivers, though, you can place your kernel on any filesystem for which an EFI driver exists. This list is currently rather limited (ext2fs/ext3fs, ReiserFS, ISO-9660, and HFS+), but even just one or two options might help a lot if you've got an undersized ESP or if copying your kernel file to the ESP is a hassle you'd rather avoid.

      +

      Ordinarily, a kernel booted in this way must reside on the ESP, or at least on another FAT partition. On a Macintosh, though, you can use HFS+ to house your kernel files. In fact, that may be necessary; my Mac Mini hangs when I try to boot a Linux kernel via an EFI stub loader from the computer's ESP, but it works fine when booting from an HFS+ partition. If you use EFI drivers, though, you can place your kernel on any filesystem for which an EFI driver exists. This list is currently good (ext2fs/ext3fs, ext4fs, ReiserFS, Btrfs, ISO-9660, and HFS+), so chances are you'll be able to use this method to boot your kernel from your root (/) partition or from a /boot partition.

      rEFInd sorts boot loader entries within each directory by time stamp, so that the most recent entry comes first. Thus, if you specify a directory name (or a volume label, for loaders stored in a volume's root directory) as the default_selection, rEFInd will make the most recent loader in the directory the default. This can obviate the need to adjust this configuration parameter when you add a new kernel; chances are you want the most recently-added kernel to be the default, and rEFInd makes it so when you set the default_selection in this way. If you don't want the latest kernel to become the default, you can use touch to give the desired kernel (or other boot loader) in the directory a more recent time stamp, or you can set default_selection to a value that uniquely identifies your desired default loader. One caveat you should keep in mind is that the EFI and Windows interpret the hardware clock as local time, whereas Mac OS X uses Coordinated Universal Time (UTC). Linux can work either way. Thus, time stamps for boot loaders can be skewed by several hours depending on the environment in which they were created or last modified.

      +

      Prior to rEFInd 0.9.0, each Linux kernel appeared as a separate entry in the main rEFInd menu. This could make for a very crowded menu if you kept many old kernels and/or if you have several Linux distributions installed. rEFInd 0.9.0 adds a "folding" feature, in which multiple kernel entries in a single directory appear as a single entry in the main menu. Selecting that entry launches the kernel with the most recent time stamp. To launch an older kernel, you must press F2 or Insert; older kernels appear in the submenu shown earlier, but with the kernel filename prepended to the description. If you want to launch an older kernel by default, you can touch it in Linux, as in touch /boot/vmlinuz-3.6.0 to make /boot/vmlinuz-3.6.0 the default. (You must type this command as root or using sudo.) If you want to see all your kernels separated on the main menu, as in earlier versions of rEFInd, you should edit refind.conf: Uncomment the fold_linux_kernels option and set it to false, off, or 0.

      + -

      On the whole, this method of configuration has a lot going for it. For distribution maintainers, if you place your Linux kernel files (with EFI stub support) on the ESP, with suitable filenames, matching initial RAM disk files, and a refind_linux.conf file, then any rEFInd 0.2.3 or later installation should detect your files, even if the user installs another distribution with another rEFInd that takes over from yours. (If the user, or this other rEFInd installation, disables auto-detection, this won't work.)

      +

      On the whole, auto-detecting kernels and passing boot options using refind_linux.conf has a lot going for it. For distribution maintainers, if you place your Linux kernel files (with EFI stub support) on the ESP, with suitable filenames, matching initial RAM disk files, and a refind_linux.conf file, then any rEFInd 0.2.3 or later installation should detect your files, even if the user installs another distribution with another rEFInd that takes over from yours. (If the user, or this other rEFInd installation, disables auto-detection, this won't work.)

      For end users, this method is simpler than maintaining manual configurations in refind.conf (or equivalents for ELILO or GRUB). To install a new kernel, you need only copy it and its initial RAM disk, under suitable names, to a scanned directory on the ESP. There's no need to touch any configuration file, provided you've already set up refind_linux.conf in your kernel's directory. You will, however, have to adjust refind_linux.conf if you make certain changes, such as if your root directory identifier changes.


      -

      copyright © 2012 by Roderick W. Smith

      +

      copyright © 2012–2015 by Roderick W. Smith

      This document is licensed under the terms of the GNU Free Documentation License (FDL), version 1.3.