Sunday, June 03, 2007

To chroot from one Linux to another

# /bin/bash
# chroot_to_gentoo.pl (from linux 1)
mount /dev/sda9 /mnt/gentoo ;
mount /dev/sda8 /mnt/gentoo/boot ;
mount -t proc none /mnt/gentoo/proc ;
mount -o bind /dev /mnt/gentoo/dev ;
/usr/sbin/chroot /mnt/gentoo /bin/bash

#source /etc/profile && env-update
#export PS1="(chroot) $PS1"
==================================
# /bin/bash
# chroot_to_gentoo2.pl (from linux 2)
#mount /dev/sda9 /mnt/gentoo ;
#mount /dev/sda8 /mnt/gentoo/boot ;
#mount -t proc none /mnt/gentoo/proc ;
# mount -o bind /dev /mnt/gentoo/dev ;
#/usr/sbin/chroot /mnt/gentoo /bin/bash

#This has to be in the gentoo side (gentoo partition).
source /etc/profile && env-update
#export PS1="(chroot) $PS1"
======================================
# /bin/bash
# chroot_to_gentoo3.pl (from linux 2)
#mount /dev/sda9 /mnt/gentoo ;
#mount /dev/sda8 /mnt/gentoo/boot ;
#mount -t proc none /mnt/gentoo/proc ;
# mount -o bind /dev /mnt/gentoo/dev ;
#/usr/sbin/chroot /mnt/gentoo /bin/bash

#source /etc/profile && env-update ;

#This has to be in the gentoo side (gentoo partition).
export PS1="(chroot) $PS1"
===============================
#/bin/bash
# exit_chroot.pl (from linux 1 after the command "exit" from linux 2)
#cd /home/acardh ;
umount /mnt/gentoo/boot /mnt/gentoo/dev /mnt/gentoo/proc /mnt/gentoo
=================================