]> code.delx.au - refind/blobdiff - docs/refind/installing.html
Version supports Secure Boot/MOK verification of binaries.
[refind] / docs / refind / installing.html
index 5c71b28c29e7f495ecb0188e84b12c9b8583799d..0a2f8480542483142f4c706dfee15a9070c51c2d 100644 (file)
@@ -15,7 +15,7 @@
 href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 
 <p>Originally written: 3/14/2012; last Web page update:
-8/12/2012, referencing rEFInd 0.4.5</p>
+11/15/2012, referencing rEFInd 0.4.7</p>
 
 
 <p>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!</p>
@@ -99,7 +99,11 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 
 <p class="sidebar"><b>Warning:</b> If you're using a Macintosh, you should run <tt>install.sh</tt> from Mac OS X rather than from Linux. If run from Linux, rEFInd is unlikely to be fully installed. Worse, it's conceivable that running <tt>install.sh</tt> from Linux will damage your firmware, requiring that it be re-flashed. The reason is that Apple uses non-standard methods to enable a boot loader, and the Linux functions in <tt>install.sh</tt> assume standard EFI installation methods.</p>
 
-<p>If you're using Linux or Mac OS X, the easiest way to install rEFInd is to use the <tt>install.sh</tt> script. Under Linux, this script installs rEFInd to your disk's ESP. Under Mac OS X, the script installs rEFInd to your current OS X boot partition by default; but you can install to your ESP instead by passing the script the <tt>esp</tt> option.</p>
+<p>If you're using Linux or Mac OS X, the easiest way to install rEFInd is to use the <tt>install.sh</tt> script. This script automatically copies rEFInd's files to your ESP or other target location and makes changes to your firmware's NVRAM settings so that rEFInd will start the next time you boot. If you've booted to OS X or in EFI mode to Linux on a UEFI-based PC, <tt>install.sh</tt> will probably do the right thing, so you can get by with the quick instructions. If your setup is unusual, though, or if you want to create a USB flash drive with rEFInd on it, you should read the <a href="#extra_installsh">extra instructions</a> for this utility.</p>
+
+<h3>Quick <tt>install.sh</tt> Instructions</h3>
+
+<p>Under Linux, the <tt>install.sh</tt> script installs rEFInd to your disk's ESP. Under Mac OS X, the script installs rEFInd to your current OS X boot partition by default; but you can install to your ESP instead by passing the script the <tt>--esp</tt> option.</p>
 
 <p>Before running this script under Linux, you should ensure that your ESP is mounted at <tt>/boot</tt> or <tt>/boot/efi</tt>, as described in more detail in the <a href="#linux">Installing rEFInd Manually Using Linux</a> section. (If you installed Linux in EFI mode, chances are your ESP is properly mounted.) This precaution isn't necessary under OS X.</p>
 
@@ -135,15 +139,16 @@ WARNING: If you have an Advanced Format disk, *DO NOT* attempt to check the
 bless status with 'bless --info', since this is known to cause disk corruption
 on some systems!!
 
-NOTE: If you want to boot an OS via BIOS emulation (such as Windows or some
-Linux installations), you *MUST* edit the ///EFI/refind/refind.conf
-file's 'scanfor' line to include the 'hdbios' option, and perhaps
-'biosexternal' and 'cd', as well.
-
 
 Installation has completed successfully.</pre>
 
-<p>In either case, the details of the output differ depending on your existing configuration and how you ran the program. Some details that can affect how the script runs include the following:</p>
+<p>In either case, the details of the output differ depending on your existing configuration and how you ran the program. Unless you see an obvious warning or error, you shouldn't be concerned about minor deviations from these examples. If you run into such a situation, or if you want to install in an unusual way, read on....</p>
+
+<a name="extra_installsh">
+<h3>Extra <tt>install.sh</tt> Instructions</h3>
+</a>
+
+<p>Some details that can affect how the script runs include the following:</p>
 
 <ul>
 
@@ -159,28 +164,28 @@ Installation has completed successfully.</pre>
     the Terminal window. You'll need to press the Return or Enter key to
     run the script.</li>
 
-<li>Under OS X, passing the "esp" option causes the script to install
-    rEFInd to the ESP. The script finds the first ESP that's identified by
-    the <tt>diskutil</tt> program and, if it's not already mounted, mounts
-    it to install rEFInd. Thus, it's conceivable that <tt>install.sh</tt>
-    will install rEFInd to the wrong partition if you have multiple disks
-    or if a disk has multiple ESPs. If you believe this has happened, you
-    may need to re-install manually.</li>
+<li>Under OS X, passing the <tt>--esp</tt> option causes the script to
+    install rEFInd to the ESP. The script finds the first ESP that's
+    identified by the <tt>diskutil</tt> program and, if it's not already
+    mounted, mounts it to install rEFInd. Thus, it's conceivable that
+    <tt>install.sh</tt> will install rEFInd to the wrong partition if you
+    have multiple disks or if a disk has multiple ESPs. If you believe this
+    has happened, you may need to re-install manually.</li>
 
 <li>If you're using OS X 10.7's Whole Disk Encryption (WDE) feature, you
-    <i>must</i> install rEFInd to the ESP, so the <tt>esp</tt> option to
+    <i>must</i> install rEFInd to the ESP, so the <tt>--esp</tt> option to
     <tt>install.sh</tt> is required. I'm still a little bit foggy about
     what's required to boot the system once this is done; see <a
     href="https://sourceforge.net/p/refind/discussion/general/thread/5c7d0195/">this
     forum thread</a> for a discussion of the topic.</li>
 
 <li>If you're replacing rEFIt with rEFInd on a Mac, there's a chance that
-    <tt>install.sh</tt> will warn you about the presence of a file called
-    <tt>/Library/StartupItems/rEFItBlesser</tt> and ask if you want to
-    delete the file. This file is designed to keep rEFIt set as the boot
+    <tt>install.sh</tt> will warn you about the presence of a program
+    called <tt>/Library/StartupItems/rEFItBlesser</tt> and ask if you want
+    to delete it. This program is designed to keep rEFIt set as the boot
     manager by automatically re-blessing it if the default boot manager
     changes. This is obviously undesirable if you install rEFInd as your
-    primary boot manager, so it's generally best to remove this file. If
+    primary boot manager, so it's generally best to remove this program. If
     you prefer to keep your options open, you can answer <tt
     class="userinput">N</tt> when <tt>install.sh</tt> asks if you want to
     delete rEFItBlesser, and instead manually copy it elsewhere. If you
@@ -192,11 +197,31 @@ Installation has completed successfully.</pre>
     --info</tt> to check your installation status; this combination has
     been reported to cause disk corruption on some Macs!</li>
 
-<li>If you intend to boot BIOS-based OSes, such as most Windows
-    installations and some Linux installations, you <i>must</i> edit the
-    <tt>refind.conf</tt> file, as noted near the end of the installation
-    script's output. (Note that rEFInd can only boot such OSes on Macs at
-    the moment.)</li>
+<li>If you intend to boot BIOS-based OSes on a UEFI-based PC, you
+    <i>must</i> edit the <tt>refind.conf</tt> file's <tt>scanfor</tt> line
+    to enable the relevant searches. This is <i>not</i> necessary on Macs,
+    though; because of the popularity of dual boots with Windows on Macs,
+    the BIOS/legacy scans are enabled by default on Macs.</li>
+
+<li>Under both Linux and OS X, you can add the <tt>--drivers</tt> option to
+    have <tt>install.sh</tt> install all the filesystem drivers along with
+    the main rEFInd program. (The default is to <i>not</i> install any
+    drivers.)</li>
+
+<li>Under both Linux and OS X, you can add the <tt>--usedefault <tt
+    class="variable">devicepath</tt></tt> option to install rEFInd to the
+    specified device as <tt>EFI/BOOT/bootx64.efi</tt> and
+    <tt>EFI/BOOT/bootia32.efi</tt>. The specified device must be a valid
+    FAT partition. This option also tells the script to <i>not</i> make
+    changes to the computer's NVRAM. The idea is that you can easily create
+    a bootable USB flash drive with this option: Create a proper
+    FAT-formatted ESP on a disk (say, <tt>/dev/sdd1</tt>) and then type <tt
+    class="userinput">sh ./install --usedefault /dev/sdd1</tt> to turn the
+    disk into an emergency disk. This option can also be used to install
+    rEFInd to an ESP using the <a href="#naming">alternative naming
+    options</a> described later. This latter usage will result in a
+    bootable rEFInd only if no other OS has already created an NVRAM
+    variable pointing to itself.</li>
 
 </ul>
 
@@ -232,8 +257,10 @@ Filesystem     1K-blocks  Used Available Use% Mounted on
 
 <li>Rename the configuration file by typing <tt><b>mv refind.conf-sample refind.conf</b></tt>. Consult the <a href="configfile.html">Editing the rEFInd Configuration File</a> page for information on how to adjust your options.</li>
 
+<p class="sidebar"><b>Weird:</b> A <a href="http://mjg59.dreamwidth.org/20187.html">bug exists</a> in some Lenovo computers (and perhaps in some others, too) that causes the firmware's boot manager to refuse to boot any boot loader that doesn't have the name <tt>Windows Boot Manager</tt> or <tt>Red Hat Enterprise Linux</tt>. If you have such a system, you must pass one of those names (in quotes) rather than <tt>rEFInd</tt> to <tt>efibootmgr</tt> via its <tt>-L</tt> option. This bug was reported to Lenovo in mid-November 2012, so with any luck updated firmware without this bug will be available later this year or early in 2013. I can make no promises about this, though.</p>
+
 <a name="efibootmgr">
-<li>On a UEFI-based system, type <tt><b>efibootmgr -c -l \\EFI\\refind\\refind_x64.efi -L rEFInd</b></tt> to add rEFInd to your EFI's list of available boot loaders, which it stores in NVRAM. (Adjust the path to the binary as required if you install somewhere else.) You may need to install this program on some systems; it's a standard part of most distributions' repositories.</li>
+<li>On a UEFI-based system, type <tt><b>efibootmgr -c -l \\EFI\\refind\\refind_x64.efi -L rEFInd</b></tt> to add rEFInd to your EFI's list of available boot loaders, which it stores in NVRAM. Adjust the path to the binary as required if you install somewhere else. You may also need to include additional options if your ESP isn't on <tt>/dev/sda1</tt> or if your configuration is otherwise unusual; consult the <tt>efibootmgr</tt> man page for details. You may need to install this program on some systems; it's a standard part of most distributions' repositories.</li>
 </a>
 
 <li>If other boot loaders are already installed, you can use <tt>efibootmgr</tt> to adjust their boot order. For instance, <b><tt>efibootmgr -o 3,7,2</tt></b> sets the firmware to try boot loader #3 first, followed by #7, followed by #2. (The program should have displayed a list of boot loaders when you added yours in the preceding step.) Place rEFInd's number first to set it as the default boot program.</li>
@@ -327,6 +354,12 @@ $ <b>ioreg -l -p IODeviceTree | grep firmware-abi</b>
     unless you're certain you do <i>not</i> have an Advanced Format hard
     disk.</li>
 
+<li>If you don't want to reboot immediately after installing rEFInd, you
+    may optionally unmount the ESP by typing <tt class="userinput">sudo
+    umount /dev/disk0s1</tt> or <tt class="userinput">sudo umount
+    /Volumes/esp</tt>. This step isn't strictly required, but if you want
+    to keep the ESP out of your directory tree, it can be useful.</li>
+
 </ol>
 
 <p>When you reboot, your Mac should bring up the rEFInd menu, and should continue to do so thereafter. If you make changes that break this association, you can re-run the <tt>bless</tt> command (if necessary, restoring the rEFInd files first). This might be necessary after installing system updates from Apple or if you upgrade rEFInd to a newer version.</p>
@@ -339,6 +372,8 @@ $ <b>ioreg -l -p IODeviceTree | grep firmware-abi</b>
 <h2>Installing rEFInd Manually Using Windows</h2>
 </a>
 
+<p class="sidebar"><b>Warning:</b> Windows 8 implements a fast shutdown feature that helps speed up shutdown and startup operations on a single-boot computer. Unfortunately, this feature can cause filesystem corruption if it's used on a multi-boot computer. You can disable the feature by launching an Administrator Command Prompt window and typing <tt class="userinput">powercfg /h off</tt> in it.</p>
+
 <p>To install rEFInd under Windows, you must first find a way to access the ESP, which Windows normally hides from view. One way to accomplish this goal, and to proceed forward once the ESP is accessible, is as follows:</p>
 
 <ol>
@@ -481,6 +516,65 @@ $ <b>ioreg -l -p IODeviceTree | grep firmware-abi</b>
 
 <p>I've seen links to other versions of these tools from time to time on the Web, so if you try one of these programs and it crashes or behaves strangely, try performing a Web search; you may turn up something that works better for you than the one to which I've linked.</p>
 
+<a name="sluggish">
+<h2>Fixing a Sluggish Macintosh Boot</h2>
+</a>
+
+<p>I've received a few reports of a sluggish boot process (a delay of about 30 seconds before starting rEFInd) on some Macs after installing rEFInd. I've been unable to replicate this problem myself, and its true cause remains mysterious to me. I have found <a href="http://ubuntuforums.org/showpost.php?p=12256273&postcount=200">a Web forum post</a> describing a possible fix. Be aware, though, that this procedure involves using the <tt>efibootmgr</tt> utility on Macs, which has been known to damage the firmware on some Macs. Other reports indicate that this problem has been fixed with 3.3.0 and later kernels. Thus, I present this information cautiously and with a strong "use at your own risk" warning. If you care to proceed, I recommend you update your Linux kernel to the latest possible version and then proceed as follows:</p>
+
+<ol>
+
+<li>Boot into Linux.</li>
+
+<li>Type <tt class="userinput">efibootmgr</tt> as <tt>root</tt> to obtain a list of your boot loader entries. Each entry includes a boot number, as in <tt>Boot0003</tt> or <tt>Boot0027</tt>.</li>
+
+<li>Remove all of the boot loader entries <i>except</i> rEFInd's by using <tt>efibootmgr</tt>'s <tt>-b <tt class="variable">bootnum</tt></tt> option to specify the boot entry and <tt>-B</tt> to delete it. For instance, typing <tt class="userinput">efibootmgr -b 0027 -B</tt> as <tt>root</tt> deletes boot entry <tt>Boot0027</tt>. Issue a separate <tt>efibootmgr</tt> command for each boot entry.</li>
+
+<li>Re-install rEFInd using the install script. It's unclear from the original post if this meant installing from Linux or from OS X.</li>
+
+</ol>
+
+<a name="uninstalling">
+<h2>Uninstalling rEFInd</h2>
+</a>
+
+<p>If you decide you don't want to keep rEFInd, you can uninstall it. Doing so is a matter of removing the rEFInd files from your ESP (or from your OS X boot partition, if you installed the program there). In Linux, a command like the following, typed as <tt>root</tt>, should do the trick:</p>
+
+<pre class="listing">
+# <tt class="userinput">rm -r /boot/efi/EFI/refind</tt>
+</pre>
+
+<p>This example assumes that your ESP is mounted at <tt>/boot/efi</tt> and that rEFInd is installed in <tt>EFI/refind</tt> on that partition. If you've mounted your ESP elsewhere, or installed rEFInd elsewhere, you should adjust the command appropriately.</p>
+
+<p>The same procedure works in OS X, with the caveat that the ESP isn't normally mounted in OS X and rEFInd is installed to the OS X boot partition by default. You'll also need to use <tt>sudo</tt> to acquire <tt>root</tt> privileges. Thus, you'd probably use a command like the following in OS X:</p>
+
+<pre class="listing">
+$ <tt class="userinput">sudo rm -r /EFI/refind</tt>
+</pre>
+
+<p>Many variants of both of these commands are possible on both OS X and Linux. For instance, you'd probably use <tt>sudo</tt> on Ubuntu; and if you installed rEFInd to your ESP on a Mac, you'd need to first mount the ESP and include its path in the <tt>rm</tt> command.</p>
+
+<p>From Windows, you must reverse the directions for <a href="#windows">installing in Windows</a>&mdash;type <tt class="userinput">mountvol S: /S</tt> to mount your ESP as <tt>S:</tt>, then navigate to the <tt>S:\EFI</tt> directory and delete the <tt>refind</tt> subdirectory.</p>
+
+<p>In any of these cases, when the computer boots and cannot find the rEFInd files, it should move on to the next boot loader in its list. In my experience, some EFI firmware implementations remove boot loaders they can't find from their NVRAM lists, so nothing else will be required, provided you have another working boot loader in your firmware's list. If your firmware doesn't automatically clean up its NVRAM entries, rEFInd's entry will do little harm; however, you can delete it with the <tt>efibootmgr</tt> utility in Linux:</p>
+
+<pre class="listing">
+# <tt class="userinput">efibootmgr --verbose</tt>
+Timeout: 10 seconds
+BootOrder: 0000,0007
+Boot0000* rEFInd       HD(2,1b8,64000,f1b7598e-baa8-16ea-4ef6-3ff3b606ac1e)File(\EFI\refind\refind.efi)
+Boot0007* CD/DVD Drive BIOS(3,0,00)PATA: HP DVD Writer 1040r     .
+# <tt class="userinput">efibootmgr --delete-bootnum --bootnum 0000</tt>
+Timeout: 10 seconds
+BootOrder: 0007
+Boot0007* CD/DVD Drive</pre>
+
+<p class="sidebar"><b>Warning:</b> As noted earlier, <tt>efibootmgr</tt> has been linked to firmware corruption on some Macs, at least with pre-3.0 Linux kernels. Therefore, I don't recommend using <tt>efibootmgr</tt> on Macs.</p>
+
+<p>This example shows use of <tt>efibootmgr</tt>'s <tt>--verbose</tt> (<tt>-v</tt>) option to display boot loaders so as to identify which one is rEFInd, followed by <tt>--delete-bootnum</tt> (<tt>-B</tt>) to delete a boot program and <tt>--bootnum</tt> (<tt>-b</tt>) to identify which one to delete. Of course, in this example there's not much else left, so you'd presumably want to install another boot loader at this point! If you already have another one installed, you may want to check the <tt>BootOrder</tt> line to determine which one will take precedence when you reboot. If you don't like what it shows, you can adjust it with the <tt>--bootorder</tt> (<tt>-o</tt>) option; consult <tt>efibootmgr</tt>'s <tt>man</tt> page for details.</p>
+
+<p>If you're not using Linux, you may be able to find a utility that serves a similar function. The OS X <tt>bless</tt> utility (or its GUI equivalent, the Startup Disk item in System Preferences) should do the trick; but Macs pick up standard OS X boot loaders when they boot and find that a configured non-standard boot loader is missing, so this shouldn't be necessary on Macs. Under Windows, the <tt>bcdedit</tt> command, described in the <a href="#windows">section on installing rEFInd under Windows,</a> may work, although I've not attempted this.</p>
+
 <hr />
 
 <p>copyright &copy; 2012 by Roderick W. Smith</p>