Creating a Chroot from an Ubuntu Live CD USB
Chroot is an operation that changes the apparent root directory for the current running process and its children. It has got many uses but most importantly, it can be used to repair a broken, non-bootable install from a Live environment. May the problem be with the boot-loader, non-configured packages etc, Chroot would at least give you an environment from where you can try to repair the broken install.
There are several other advanced uses of Chroot like testing unstable applications, creating an environment with dependency control etc. We are just discussing the simple ones here.
Creating a Chroot
If you've got a non-bootable PC and want to attempt to repair it, boot an Ubuntu Live CD/USB on that PC. Go to a Terminal and find out your '/' partition by running this command:
You need to figure the partition notation for your '/' drive which looks like 'sda1', 'sda2' etc. You can also start GParted from System > Administration menu or by searching the Dash in Unity, and try to find your partition there.
For creating the Chroot, you need to run these commands one-by-one:
Where 'sdXY' is your '/' partition.
The 4th command is meant to connect your Chroot environment to the internet but it would obviously only be successful if you've got internet access in the Live environment.
Continue Reading �
There are several other advanced uses of Chroot like testing unstable applications, creating an environment with dependency control etc. We are just discussing the simple ones here.
Creating a Chroot
If you've got a non-bootable PC and want to attempt to repair it, boot an Ubuntu Live CD/USB on that PC. Go to a Terminal and find out your '/' partition by running this command:
sudo fdisk -l
You need to figure the partition notation for your '/' drive which looks like 'sda1', 'sda2' etc. You can also start GParted from System > Administration menu or by searching the Dash in Unity, and try to find your partition there.
For creating the Chroot, you need to run these commands one-by-one:
sudo mkdir /mnt/temp
sudo mount /dev/sdXY /mnt/temp
for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt/temp$i; done
sudo cp /etc/resolv.conf /mnt/temp/etc/resolv.conf
sudo chroot /mnt/temp
sudo mount /dev/sdXY /mnt/temp
for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt/temp$i; done
sudo cp /etc/resolv.conf /mnt/temp/etc/resolv.conf
sudo chroot /mnt/temp
Where 'sdXY' is your '/' partition.
The 4th command is meant to connect your Chroot environment to the internet but it would obviously only be successful if you've got internet access in the Live environment.
alternative link download