Home > computers > linux > chroot > ChrootIntoClonedMachine | About

When you chroot into another root partition (another distro on /dev/sda8, or a machine you just cloned with rsync into /var/clone/), you can't really do anything useful because no device is created. Some crucial files and directories need to be borrowed from the "host" (live|running) system, you can do this with the following commands (thanks to drmagoo for this tip).

If you are chrooting into a cloned machine in your /target/ directory :

mount --bind /dev /target/dev
mount --bind /proc /target/proc
# This one is needed for ssh access
mount --bind /dev/pts /target/dev/pts
mount --bind /sys /target/sys
chroot /target

Now most commands should work. Make sure though that files belong to the good owner. Use rsync –no-numeric-ids if necessary when cloning a machine.

If you are accessing another distribution in some partition you only need to bind /dev/ from your live system then create /proc and /sys after you have chrooted to the other root partition

mount -o bind /dev/ /target/dev
chroot /target
mount -t proc proc /proc
mount -t sysfs sys /sys

contact : @ychaouche yacinechaouche at yahoocom

QR Code
QR Code chrootintoclonedmachine (generated for current page)