Chroot

From www.deloptes.org
Jump to navigation Jump to search

1. Create a mountpoint (skip for squashfs example)

Code:

mkdir squashfs-root

2. Mount /proc /sys /dev to chroot

Code:

mount -o bind /proc squashfs-root/proc/
mount -o bind /dev squashfs-root/dev/
mount -o bind /dev/pts squashfs-root/dev/pts/
mount -o bind /sys squashfs-root/sys

3. Copy resolv.conf to networking

Code:

cp /etc/resolv.conf /mount/point/etc/resolv.conf

4.Open bash in chroot

Code:

chroot /mount/point /bin/bash

5. Do what you have to do and then exit chroot

Code:

exit

6 Cleanup

Code:


umount squashfs-root/dev/pts/
umount squashfs-root/dev/
umount squashfs-root/sys
umount squashfs-root/proc/

http://ubuntuforums.org/showthread.php?t=1156240