[multiboot-guide] master: How to chroot (5108b73)

immanetize at fedoraproject.org immanetize at fedoraproject.org
Mon Jan 26 21:47:51 UTC 2015


Repository : http://git.fedorahosted.org/cgit/docs/multiboot-guide.git

On branch  : master

>---------------------------------------------------------------

commit 5108b73ac438f280e6350ff4f357919dbaebe638
Author: Pete Travis <immanetize at fedoraproject.org>
Date:   Mon Jan 26 14:45:20 2015 -0700

    How to chroot
    
    If GRUB is trashed, or a Fedora installation gets damaged, setting up a
    chroot from a live image can be an invaluable tool.  The rather lengthy
    procedure makes it a large derivation from the content, however.  Rather
    than make it overly simple, I'll put it in an appendix for now and refer
    to it as needed.


>---------------------------------------------------------------

 en-US/Common_Operations.xml      |  172 ++++++++++++++++++++++++++++++++++++++
 en-US/Fedora_Multiboot_Guide.xml |    1 +
 2 files changed, 173 insertions(+), 0 deletions(-)

diff --git a/en-US/Common_Operations.xml b/en-US/Common_Operations.xml
new file mode 100644
index 0000000..c7be032
--- /dev/null
+++ b/en-US/Common_Operations.xml
@@ -0,0 +1,172 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "Fedora_Multiboot_Guide.ent">
+ %BOOK_ENTITIES;
+ ]>
+
+ <appendix id="common_operations_appendix">
+   <title>Common Operations</title>
+   <para>
+     This section includes common operations you might have to perform when following various instructions in this guide.
+   </para>
+   <section id="common-chroot_from_live">
+     <title>Setting up a chroot from a live image</title>
+     <para>
+       To operate on a Fedora installation that will not boot, you must use a <literal>chroot</literal>.  The process initially uses a Fedora live image, but sets up an environment that uses the files, executables, and libraries from the installed system.
+     </para>
+     <para>
+       The Fedora Netinstall image has a system recovery option that will set up the chroot for a Fedora system automatically.  Use the instructions here for a live image.
+     </para>
+     <para>
+       Be consistent about your booting methods.  If you have Fedora installed Fedora in UEFI mode, boot the live image in the same way.
+     </para>
+     <procedure>
+       <title>Creating chroot of a Fedora installation</title>
+       <step>
+         <para>
+           Boot a Fedora live image and open a root terminal window.
+         </para>
+       </step>
+       <step>
+         <para>
+           Create a directory to work in.
+         </para>
+         <screen>
+<prompt>#</prompt> <command>mkdir /mnt/sysimage</command>
+         </screen>
+       </step>
+       <step>
+         <para>
+          List the available partitions.  We'll use this list to identify all the partitions your Fedora installation needs. 
+         </para>
+         <screen>
+           <prompt>#</prompt> <command>blkid</command>
+           <computeroutput>
+/dev/sda1: LABEL="WINRE_DRV" UUID="C812A5BC12A5AFBC" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="3f4f9bb5-6551-4411-9cea-d06dd1d10aff"
+/dev/sda2: LABEL="SYSTEM_DRV" UUID="32A7-BBCC" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="f540b7b9-782a-48d2-89b4-4f0a720121cf"
+/dev/sda3: LABEL="LRS_ESP" UUID="F2C1-30B7" TYPE="vfat" PARTLABEL="Basic data partition" PARTUUID="cdbadfc7-e84b-4fe0-935c-28419b0082f7"
+/dev/sda4: PARTLABEL="Microsoft reserved partition" PARTUUID="bb3d61f2-652b-4793-a8e9-8b42e819f6bb"
+/dev/sda5: LABEL="Windows8_OS" UUID="7898C3F398C3ADC6" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="111e1bb0-dafd-439b-8af3-9d6b86bff9e9"
+/dev/sda6: LABEL="LENOVO" UUID="16E2DDF6E2DDD9D7" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="45dc466a-929d-4862-91ed-396afe2e4f59"
+/dev/sda7: LABEL="PBR_DRV" UUID="40A4E1E7A4E1E000" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="29b2cac6-ff56-4cf2-b62e-d04230a72294"
+/dev/sda8: UUID="5958dcb4-dfeb-4f6c-ba07-8b2ada8b1602" TYPE="ext4" PARTUUID="cacf80f0-3376-443d-bfb5-5d3fe689885e"
+/dev/sda9: UUID="PRueOy-TXAC-mKDV-NRLC-k4gt-C63H-D0zfYd" TYPE="LVM2_member" PARTUUID="555251b9-438f-4f16-9011-754620526ebe"
+/dev/mapper/fedora-swap: UUID="28d71a2c-1b34-4115-aa19-083373ec4d8a" TYPE="swap"
+/dev/mapper/fedora-root: UUID="125425e2-dd7b-46e9-8c64-6d2c5b192c76" TYPE="ext4"
+/dev/mapper/fedora-home: UUID="1cec1d42-8750-4746-bd36-145c1ebb2d89" TYPE="ext4"
+            </computeroutput>
+          </screen>
+        </step>
+        <step>
+          <para>
+            Identify Fedora's root partition.
+          </para>
+          <screen>
+<prompt>#</prompt> <command>mount /dev/sda8 /mnt/sysimage</command>
+<prompt>#</prompt> <command>cat /mnt/sysimage/etc/fedora-release</command>
+<computeroutput>
+  cat: /mnt/sysimage/etc/fedora-release: No such file or directory
+</computeroutput>
+<prompt>#</prompt> <command>ls /mnt/sysimage</command>
+<computeroutput>
+  config-3.17.7-300.fc21.x86_64
+  config-3.17.8-300.fc21.x86_64
+  config-3.19.0-0.rc5.git2.1.fc22.x86_64
+  efi
+  elf-memtest86+-5.01
+  extlinux
+  grub2
+  initramfs-0-rescue-39995d7d26a74b1784e7bd9a7bfefdf1.img
+  initramfs-3.17.7-300.fc21.x86_64.img
+  initramfs-3.17.8-300.fc21.x86_64.img
+  initramfs-3.19.0-0.rc5.git2.1.fc22.x86_64.img
+  initrd-plymouth.img
+  lost+found
+  memtest86+-5.01
+  System.map-3.17.7-300.fc21.x86_64
+  System.map-3.17.8-300.fc21.x86_64
+  System.map-3.19.0-0.rc5.git2.1.fc22.x86_64
+  vmlinuz-0-rescue-39995d7d26a74b1784e7bd9a7bfefdf1
+  vmlinuz-3.17.7-300.fc21.x86_64
+  vmlinuz-3.17.8-300.fc21.x86_64
+  vmlinuz-3.19.0-0.rc5.git2.1.fc22.x86_64
+</computeroutput>
+<prompt>#</prompt> <command>umount /dev/sda8</command>
+          </screen>
+          <para>
+            <filename class="partition" >/dev/sda8</filename> wasn't the root partition, since it did not contain the <filename>/etc/fedora-release</filename> file, but we did find other things inside.  The <filename>vmlinuz</filename> and <filename>initramfs</filename> files are the kernels and initramfs, and they always live on <filename class="partition">/boot</filename>.  Remember that for later.
+          </para>
+          <screen>
+<prompt>#</prompt> <command>mount /dev/mapper/fedora-root /mnt/sysimage</command>
+<prompt>#</prompt> <command>cat /mnt/sysimage/etc/fedora-release</command>
+<computeroutput>Fedora release 21 (Twenty One)</computeroutput>
+          </screen>
+          <para>
+            That's the Fedora root partition, so we will leave it mounted there.  Because the other filesystems use mount points inside the root partition, we mount it first.
+          </para> 
+        </step>
+        <step>
+          <para>
+            Next, identify and mount the <filename class="directory">/boot</filename> partition.  We found it as <filename class="partition" >/dev/sda8</filename> already, but we can confirm by checking Fedora's <filename>/etc/fstab</filename>, the file that tells the system where to mount filesystems.
+          </para>
+          <screen>
+<prompt>#</prompt> <command> grep boot /etc/fstab</command>
+<computeroutput>
+  UUID=5958dcb4-dfeb-4f6c-ba07-8b2ada8b1602 /boot                   ext4    defaults        1 2
+  UUID=32A7-BBCC          /boot/efi               vfat    umask=0077,shortname=winnt 0 0
+</computeroutput>
+          </screen>
+          <para>
+            <filename>/etc/fstab</filename> uses <literal>Universally Unique Identifiers</literal> to identify partitions.  This makes sure that the right partitions get mounted in the right place, even if drive orders change.  The UUID listed for <filename class="directory">/boot</filename> matches what <command>blkid</command> reports for <filename class="partition">/dev/sda8</filename>, so we know we have the right partition.
+          </para>
+          <screen>
+<prompt>#</prompt> <command>mount /dev/sda8 /mnt/sysimage/boot</command>
+          </screen>
+        </step>
+        <step>
+          <para>
+            If this is a UEFI installation, mount the EFI system partition next.  In this example, we found it in the previous step, and can match the UUID with <command>blkid</command> output.  You can confirm by looking at the contents once mounted.
+          </para>
+          <screen>
+<prompt>#</prompt> <command>mount /dev/sda2 /mnt/sysimage/boot/efi</command>
+<prompt>#</prompt> <command>ls /mnt/sysimage/boot/efi</command>
+<computeroutput>
+  /boot/efi/BOOTSECT.BAK
+
+  /boot/efi/EFI:
+  BOOT  fedora  Microsoft
+</computeroutput>
+          </screen>
+        </step>
+        <step>
+          <para>
+            Next mount the virtual filesystems that the system uses to communicate with processes and devices.  These are always the same, so we can do it in one command.
+          </para>
+          <screen>
+<prompt>#</prompt><command>for dir in /dev /proc /sys; do mount --bind $dir /mnt/sysimage/$dir ; done</command>
+          </screen>
+        </step>
+        <step>
+          <para>
+            Enter the chroot to continue, and begin working on your Fedora installation.
+          </para>
+          <screen>
+<prompt>#</prompt> <command>chroot /mnt/sysimage</command>
+          </screen>
+        </step>
+        <step>
+          <para>
+            When you are finished, use the <command>exit</command> command to leave the chroot.
+          </para>
+        </step>
+      </procedure>
+    </section>
+
+
+  
+
+
+
+
+ </appendix>
+
diff --git a/en-US/Fedora_Multiboot_Guide.xml b/en-US/Fedora_Multiboot_Guide.xml
index 7ec1547..d3a4ef4 100644
--- a/en-US/Fedora_Multiboot_Guide.xml
+++ b/en-US/Fedora_Multiboot_Guide.xml
@@ -14,6 +14,7 @@
 	<xi:include href="BIOS.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
   <xi:include href="UEFI.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
   <xi:include href="boot_arguments.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+  <xi:include href="Common_Operations.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
 	<xi:include href="Revision_History.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
 	<index />
 </article>



More information about the docs-commits mailing list