[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
howtos:slackware_admin:how_to_chroot_from_media [2012/10/12 23:19 (UTC)] – Typos Fixed. sycamorexhowtos:slackware_admin:how_to_chroot_from_media [2013/06/18 10:12 (UTC)] tommyc
Line 19: Line 19:
  
 For LVM volumes you need to make sure that the system can recognize and activate the volume. This is done by running the commands: For LVM volumes you need to make sure that the system can recognize and activate the volume. This is done by running the commands:
-  * ''vgscan --mknodes''    // : searches for logical volumes, this might take a while//+  * ''vgscan %%--%%mknodes''    // : searches for logical volumes, this might take a while//
   * ''vgchange -ay''    // : activates the found volumes//\\   * ''vgchange -ay''    // : activates the found volumes//\\
   * If more than one group was found, you can select which one to activate with ''vgchange -ay groupName''   * If more than one group was found, you can select which one to activate with ''vgchange -ay groupName''
Line 27: Line 27:
      
 After we make sure which partitions are needed, we need to mount them:   After we make sure which partitions are needed, we need to mount them:  
-  +
 <code>mount /dev/<location> /mnt</code> <code>mount /dev/<location> /mnt</code>
 +Here are 3 common examples. 
 +
 +1. The first is just a simple installation with everything installed under / mounted under /dev/sda1. No LVM or additional drives.
 +
 +<code>mount /dev/sda1 /mnt</code>
 +
 +2. In the next example we have two drives. The user has set up his or her Slackware system to use /dev/sdb1 for /home and /dev/sda1 for everything else.
 +
 +<code>mkdir /mnt/home # We need a directory to mount which needs to be under the directory we intend to chroot into.
 +mount /dev/sda1 /mnt
 +mount /dev/sdb1 /mnt/home</code>
 +
 +3. For the third example the user has used LVM and has already made their volume group known to the kernel. The user is using the logical volumes "root, usr, home, opt, var, srv" all under one volume group labeled "myvg". In addition, this user has used LUKS encryption and therefore has placed a small /boot under /dev/sda1.
 +
 +<code>mkdir /mnt/{boot,usr,home,opt,var,srv} # Create the necessary directories.
 +mount /dev/sda1 /mnt/boot
 +mount /dev/myvg/root /mnt
 +mount /dev/myvg/usr /mnt/usr
 +mount /dev/myvg/home /mnt/home
 +mount /dev/myvg/opt /mnt/opt
 +mount /dev/myvg/var /mnt/var
 +mount /dev/myvg/srv /mnt/srv</code>
 +
 +We could have also used a for loop for everything except /boot (/dev/sda1) and / (/dev/myvg/root) in this example:
 +<code>for dir in usr home opt var srv
 +do
 +  mount /dev/myvg/$dir /mnt/$dir
 +done
 +</code>
  
 Next, we need to prepare three virtual directories to be used by the environment. Those are ''/dev'', a directory with virtual files that represent hardware devices, ''/proc'', a directory with virtual files that represent processes and ''/sys'' which contains the kernel and other system files: Next, we need to prepare three virtual directories to be used by the environment. Those are ''/dev'', a directory with virtual files that represent hardware devices, ''/proc'', a directory with virtual files that represent processes and ''/sys'' which contains the kernel and other system files:
-  +
 <code>mount -o bind /dev /mnt/dev <code>mount -o bind /dev /mnt/dev
 mount -o bind /proc /mnt/proc mount -o bind /proc /mnt/proc
Line 41: Line 70:
 <code>chroot /mnt /bin/bash</code> <code>chroot /mnt /bin/bash</code>
      
-<note important>If LVM preparation was involved it might be necessary to re-run ''vgscan --mknodes'' and ''vgchange -ay'' as they were created inside the installation media's ramdisk and not in the mounted partition.</note>+<note important>If LVM preparation was involved it might be necessary to re-run ''vgscan %%--%%mknodes'' and ''vgchange -ay'' as they were created inside the installation media's ramdisk and not in the mounted partition.</note>
      
 The bash prompt that you see here is a bash prompt started on your system. You can now work on this environment naturally. For example editing ''/etc/lilo.conf'' and executing ''/sbin/lilo'' will happen on your system, not from the installation media. The bash prompt that you see here is a bash prompt started on your system. You can now work on this environment naturally. For example editing ''/etc/lilo.conf'' and executing ''/sbin/lilo'' will happen on your system, not from the installation media.
 howtos:slackware_admin:how_to_chroot_from_media ()