]> code.delx.au - refind/blobdiff - docs/refind/linux.html
Properly initialise variable to fix detection of non-Arch kernel versions
[refind] / docs / refind / linux.html
index 274f234046ed39c8468c039dc0bdda065daae69b..3f240024101b2bcbdc7fc1a567920d1ac732f848 100644 (file)
@@ -17,7 +17,7 @@
 href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 
 <p>Originally written: 3/19/2012; last Web page update:
-9/19/2015, referencing rEFInd 0.9.2</p>
+3/4/2017, referencing rEFInd 0.10.5</p>
 
 
 <p>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!</p>
@@ -43,8 +43,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 <input type="hidden" name="amount" value="1.00">
 <input type="hidden" name="item_name" value="rEFInd Boot Manager">
 <input type="hidden" name="bn" value="PP-DonationsBF:btn_donate_LG.gif:NonHostedGuest">
-<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
-<img alt="Donate with PayPal" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
+<input type="image" src="donate.png" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
 </form>
 </td>
 
@@ -58,8 +57,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 <input type="hidden" name="amount" value="2.50">
 <input type="hidden" name="item_name" value="rEFInd Boot Manager">
 <input type="hidden" name="bn" value="PP-DonationsBF:btn_donate_LG.gif:NonHostedGuest">
-<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
-<img alt="Donate with PayPal" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
+<input type="image" src="donate.png" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
 </form>
 </td>
 
@@ -74,8 +72,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 <input type="hidden" name="amount" value="5.00">
 <input type="hidden" name="item_name" value="rEFInd Boot Manager">
 <input type="hidden" name="bn" value="PP-DonationsBF:btn_donate_LG.gif:NonHostedGuest">
-<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
-<img alt="Donate with PayPal" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
+<input type="image" src="donate.png" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
 </form>
 </td>
 
@@ -89,8 +86,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 <input type="hidden" name="amount" value="10.00">
 <input type="hidden" name="item_name" value="rEFInd Boot Manager">
 <input type="hidden" name="bn" value="PP-DonationsBF:btn_donate_LG.gif:NonHostedGuest">
-<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
-<img alt="Donate with PayPal" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
+<input type="image" src="donate.png" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
 </form>
 </td>
 
@@ -104,8 +100,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 <input type="hidden" name="amount" value="20.00">
 <input type="hidden" name="item_name" value="rEFInd Boot Manager">
 <input type="hidden" name="bn" value="PP-DonationsBF:btn_donate_LG.gif:NonHostedGuest">
-<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
-<img alt="Donate with PayPal" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
+<input type="image" src="donate.png" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
 </form>
 </td>
 
@@ -118,8 +113,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 <input type="hidden" name="currency_code" value="USD">
 <input type="hidden" name="item_name" value="rEFInd Boot Manager">
 <input type="hidden" name="bn" value="PP-DonationsBF:btn_donate_LG.gif:NonHostedGuest">
-<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
-<img alt="Donate with PayPal" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
+<input type="image" src="donate.png" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
 </form>
 </td></tr>
 </table>
@@ -186,7 +180,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 
 <p>This method requires that your <tt>/boot</tt> directory, whether it's on a separate partition or is a regular directory in your root (<tt>/</tt>) filesystem, be readable by the EFI. At the moment, all EFI implementations can read FAT and Macs can read HFS+. By using <a href="drivers.html">drivers,</a> 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 <tt>/boot</tt>, 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 <tt>/boot</tt> partition. You must also have a 3.3.0 or later Linux kernel with EFI stub support, of course.</p>
 
-<p>If you installed rEFInd 0.6.0 or later with its <tt>install.sh</tt> 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:
+<p>If you installed rEFInd 0.6.0 or later with its <tt>refind-install</tt> (formerly <tt>install.sh</tt>) 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:
 
 <ul>
 
@@ -196,7 +190,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
     Partition (ESP). You may need to create this subdirectory, too.</li>
 
 <li>Create a <tt>refind_linux.conf</tt> file in your <tt>/boot</tt>
-    directory. The <tt>mkrlconf.sh</tt> script that comes with rEFInd
+    directory. The <tt>mkrlconf</tt> script that comes with rEFInd
     should do this job, or you can do it manually as described <a
     href="#efistub">later.</a> Starting with version 0.6.12, rEFInd can
     create minimal boot options from <tt>/etc/fstab</tt>, if <tt>/boot</tt>
@@ -234,7 +228,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 
 <li>Copy the <tt>/boot/refind_linux.conf</tt> file to the same directory to
     which you copied your kernel. If this file doesn't exist, create it by
-    running (as <tt>root</tt>) the <tt>mkrlconf.sh</tt> script that came
+    running (as <tt>root</tt>) the <tt>mkrlconf</tt> script that came
     with rEFInd. This step may not be strictly necessary if <tt>/boot</tt>
     is an ordinary directory on your root (<tt>/</tt>) partition.</li>
 
@@ -298,7 +292,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
     <tt>/boot/refind_linux.conf</tt> and populate it with kernel options,
     as described <a href="#refind_linux">later.</a> If this file doesn't
     already exist, the easiest way to create it is to run the
-    <tt>mkrlconf.sh</tt> script that comes with rEFInd 0.5.1 and
+    <tt>mkrlconf</tt> script that comes with rEFInd 0.5.1 and
     later.</li>
 
 <li>Check your <tt>refind.conf</tt> file (presumably in
@@ -372,30 +366,63 @@ extends it as follows:</p>
 
 <p class="sidebar">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 <i>one</i> kernel and initial RAM disk per directory that lack version numbers in their filenames.</p>
 
-<li>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
+<li>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
     <tt>init</tt> 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
     <tt>bzImage-3.19.0.efi</tt> is <tt>3.19.0</tt>, which matches
     <tt>initramfs-3.19.0.bz</tt>; and
     <tt>vmlinuz-4.2.5-300.fc23.x86_64</tt>'s version string is
     <tt>4.2.5-300.fc23.x86_64</tt>, which matches
-    <tt>initrd-4.2.5-300.fc23.x86_64.img</tt>. Many other matches are
-    possible. If an initial RAM disk is identified, rEFInd passes a
-    suitable <tt>initrd=</tt> option to the kernel when it boots.</li>
+    <tt>initrd-4.2.5-300.fc23.x86_64.img</tt>. In order to support Arch Linux
+    kernel naming the strings <tt>linux</tt> and <tt>linux-lts</tt> are
+    treated as digits. So <tt>vmlinuz-linux-lts</tt> has version
+    <tt>linux-lts</tt>, which matches <tt>initramfs-linux-lts.img</tt>.
+    Many other matches are possible. If an initial RAM disk is identified,
+    rEFInd passes a suitable <tt>initrd=</tt> option to the kernel when it
+    boots. There are two variants on this rule:
+
+    <ul>
+
+    <li>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 <tt>vmlinuz-4.8.0-32-standard</tt>, and two
+       initial RAM disk files are <tt>initrd-4.8.0-32-standard</tt> and
+       <tt>initrd-4.8.0-32-debug</tt>. The first of those files has nine
+       matching characters after the version string (<tt>-standard</tt>),
+       vs. just one matching character (<tt>-</tt>) for the second. Thus,
+       the first file will be used.</li>
+
+    <li>If the <tt>refind_linux.conf</tt> file (described next) is present,
+       and if an <tt>initrd=</tt> specification is present for the option
+       you're using, rEFInd will <i>not</i> 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.</li></ul>
 
 <li>rEFInd looks for a file called <tt>refind_linux.conf</tt> 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 <tt>install.sh</tt>
-    script, that script created a sample <tt>refind_linux.conf</tt> file,
-    customized for your computer, in <tt>/boot</tt>. This file will work
-    without changes on many installations, but you may need to tweak it for
-    some.</li>
+    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 <tt>refind-install</tt> script, that script created a
+    sample <tt>refind_linux.conf</tt> file, customized for your computer, in
+    <tt>/boot</tt>. 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 <tt>%v</tt>, rEFInd substitutes
+    the kernel version number for that string. (If you need the actual
+    string <tt>%v</tt> in your kernel options, use <tt>%%v</tt> instead;
+    rEFInd will change this to <tt>%v</tt>.) 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.</li>
 
 <li>If rEFInd can't find a <tt>refind_linux.conf</tt> file in the directory
     that holds the kernel, the program looks for a file called
@@ -414,7 +441,7 @@ extends it as follows:</p>
 
 <li>If rEFInd can't find a <tt>refind_linux.conf</tt> file or an
     <tt>/etc/fstab</tt> file, it tries to identify the Linux root
-    (<tt>/</tt> filesystem by looking for a partition with a GUID type code
+    (<tt>/</tt>) filesystem by looking for a partition with a GUID type code
     matching that specified for the root (<tt>/</tt>) filesystem in the <a
     href="http://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec/">Freedesktop.org
     Discoverable Partitions Specification.</a> These type codes are as yet
@@ -457,7 +484,7 @@ total 17943
 
 <p>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 <tt>refind_linux.conf</tt>. Subsequent kernels (just one in this example) appear below it, with the same labels preceded by the kernel filename. If you were to set <tt>fold_linux_kernels false</tt>, each kernel would get its own entry on the main menu, and each one's submenu would enable options for launching it alone.</p>
 
-<p>To assist in initial configuration, rEFInd's <tt>install.sh</tt> script creates a sample <tt>refind_linux.conf</tt> file in <tt>/boot</tt>. This sample file defines three entries, the first two of which use the default GRUB options defined in <tt>/etc/default/grub</tt> 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 <tt>mkrlconf.sh</tt> script that comes with rEFInd. If you pass it the <tt>--force</tt> option, it will overwrite the existing <tt>/boot/refind_linux.conf</tt> file; otherwise it will create the file only if one doesn't already exist.</p>
+<p>To assist in initial configuration, rEFInd's <tt>refind-install</tt> script creates a sample <tt>refind_linux.conf</tt> file in <tt>/boot</tt>. This sample file defines three entries, the first two of which use the default GRUB options defined in <tt>/etc/default/grub</tt> 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 <tt>mkrlconf</tt> script that comes with rEFInd. If you pass it the <tt>--force</tt> option, it will overwrite the existing <tt>/boot/refind_linux.conf</tt> file; otherwise it will create the file only if one doesn't already exist.</p>
 
 <p>From a user's perspective, the submenus defined in this way work just like submenus defined via the <tt>submenuentry</tt> options in <tt>refind.conf</tt>, 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:</p>
 
@@ -475,7 +502,8 @@ total 17943
 <li>All the kernels in a given directory use the same
     <tt>refind_linux.conf</tt> file. If you need to set different options
     for different kernels, you'll need to place those kernels in different
-    directories.</li>
+    directories. (A partial exception is the kernel version string, which
+    can be passed via the <tt>%v</tt> variable, as noted earlier.)</li>
 
 <li>You must place your kernels in a directory other than the one that
     holds the main rEFInd <tt>.efi</tt> file. This is because rEFInd does
@@ -495,7 +523,7 @@ total 17943
 
 <hr/>
 
-<p>copyright &copy; 2012&ndash;2015 by Roderick W. Smith</p>
+<p>copyright &copy; 2012&ndash;2017 by Roderick W. Smith</p>
 
 <p>This document is licensed under the terms of the <a href="FDL-1.3.txt">GNU Free Documentation License (FDL), version 1.3.</a></p>