Sunday, June 7, 2009

Setting up Debian chroot under Ubuntu

Wanting to build for the balloon board using emdebian, I started out with the Debian instructions. However this caused my Ubuntu-based system to pick up a whole lot of changes from Debian which broke my system.

So on some advise from Wookey I tried chroot.

I ended up using a variant of the instructions from here and here.

Some important differences...

Started with:
 sudo debootstrap --arch i386 lenny /debian http://ftp.uk.debian.org/debian/
Link
That bootstraps the basic chroot debian environment in a directory called /debian

From there you can follow the instructions from here, but:
* Skip over the first buch of stuff about cdebootstrap.
* using /debian instead of /path/to/chroot
Link* Don't copy in the /etc/apt/sources from the host distro.

Ubuntu does not use /etc/inittab so to set vt8 up as a debian terminal go to /etc/event.d and
create tty8 with the following:

# tty8 - debian chroot tty
#
# This service maintains a getty on tty8 from the point the system is
# started until it is shut down again.

start on runlevel 2
start on runlevel 3

stop on runlevel 0
stop on runlevel 1
stop on runlevel 4
stop on runlevel 5
stop on runlevel 6

respawn
exec /usr/sbin/chroot /debian /sbin/getty 38400 tty8

Then execute
sudo initctl start tty8

If you F8 you should now have a debian terminal that will login with no root.