From the base Debian, I just installed x11-apps for a small quick test of xclock and xcalc in the chroot. Yep, that works. Neat!
I put the commands all into one script called enter-chroot inside the target directory so it would automatically clean itself up on exit:
Code: Select all
#!/bin/bash
mount --bind /proc chroot/proc
mount --bind /tmp chroot/tmp
mount --bind /dev chroot/dev
mount --bind /sys chroot/sys
mount -t devpts devpts chroot/dev/pts
cp /etc/resolv.conf chroot/etc/resolv.conf
chroot chroot
export LC_ALL=C
umount chroot/tmp
umount chroot/proc
umount chroot/dev/pts
umount chroot/dev
umount chroot/sys
Exited Slacko 6.3.2 and rebooted into Tahr 6.0.5 and did the enter-chroot, and the chroot worked right where I left off.
This reminds me of David Schneider's crouton for chroot of ChromeOS with Ubuntu. I had that a few years ago on an old Chromebook, but ended up getting rid of it.
Would be interesting to see if can get this chroot to look and work like that.
Edit: Didn't see that Fred had already made one which is more complete, changed slightly and updated.