All Unkept
Posted in: Linux  —  August 14, 2007 at 10:12 PM

Sharing internet connection to chroot

by Luke Plant

UPDATE: Solved! I had forgotten about resolve.conf. Script below updated


I have my computer's hard disk in an external USB hard drive enclosure, and I'm running it off someone else's hardware. I've done this before, and usually I just boot the entire system off the USB device, and it works great.

On this PC, however, it won't boot from my hard drive, but it will boot from other USB keys. So, the closest I've got so far is to use KNOPPIX on a USB key, and then, once KNOPPIX is running, create a chroot for my main system. It looks like this:

# boot knoppix down to single user mode:
telinit 2
# Mount main partition from my computer's hard drive
mkdir /media/mycomputer
mount -t auto -o acl /dev/disk/by-uuid/blahblah...  /media/mycomputer
# Share some things from running system, to keep various applications
# and the kernel happy.
mount --bind /dev /media/mycomputer/dev
mount --bind /tmp /media/mycomputer/tmp
mount --bind /proc /media/mycomputer/proc
mount --bind /etc/resolv.conf /media/mycomputer/etc/resolv.conf
chroot /media/mycomputer

# Now everything works:
/etc/init.d/kdm start
# (use gdm if you don't have kdm)

My system is Feisty, which is very close to Knoppix, and this is probably a big factor in this just working (especially the /dev filesystem). For a while I forgot to do the /etc/resolv.conf bind mount, so the internet did not appear to work.

Comments §

blog comments powered by Disqus