oio11: (Default)
[personal profile] oio11

chroot - access another Linux from your current Linux.

If you need to access one Linux distribution from another chroot is an excellent choice. A couple common usage examples are resetting a forgotten password and reinstalling the bootloader.

I have also used a chroot environment in order to install neccesary packages in order to get the operating system where it is X capable, This is very useful in more advanced Linux systems such as Arch Linux or Gentoo where you start in a command line interface, allowing you access to useful graphical tools such as web browsers to look up information while you work on the system.

Here is a bash script that needs to be run as root, administrator or superuser, it tells you what it is doing while it is doing it. Copy and Paste this into a text file and save. Upon saving the file you need to make it executable, run chmod a+x as root.

Then to run the script sh ./


#!/bin/bash
#Written by Edge226.

#Mount Guest Linux Partitions
#modify  with the / partition of the guest system. 

echo "Mounting Guest Operating System."
mount  /mnt/chroot 

#Mount the home partition 

echo "Mounting Home Drive."
mount -o bind /home /mnt/chroot/home 

#Mount Operating system devices.

echo "Mounting System Devices." 
mount -o bind /proc /mnt/chroot/proc 
mount -o bind /dev /mnt/chroot/dev 
mount -o bind /sys /mnt/chroot/sys 
mount -t devpts devpts /mnt/chroot/dev/pts

#Enable Network Access. 

echo "Enabling Network Access." 
cp /etc/resolv.conf /mnt/chroot/etc/resolv.conf
  
#Enter the Chroot Environment. 

echo "Entering the chroot environment." 
env NAME=chroot chroot /mnt/chroot /bin/bash

#Clean up after exiting the environment. 
#Unmount devices.

echo "Unmounting System Devices." 
umount /mnt/chroot/dev/pts
umount /mnt/chroot/sys 
umount /mnt/chroot/dev
umount /mnt/chroot/proc
echo "Done."

echo "Unmounting Home drive."
umount /mnt/chroot/home
echo "Done." 

echo "Unmounting Guest Operating System."
umount /mnt/chroot
echo "Returned to Host System Successfully!"


#################################################################################################

http://www.linux.org/article/view/chroot-access-another-linux-from-your-current-linux-

Translation(s): Deutsch - English - Français - Italiano - Español


chroot on Unix-like operating systems is an operation that changes the apparent root directory for the current running process and its children.(Read more ...)



http://wiki.debian.org/chroot#A.2Fdev.2Fpts

October 2025

S M T W T F S
   1234
567891011
12131415161718
19202122 232425
262728293031 

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Feb. 5th, 2026 01:07 am
Powered by Dreamwidth Studios