Subscribe to this blog


I wanted to experiment with more up-to-date software while preserving my stable working environment. Of course a frequent desire. Therefore I build a Debian unstable chroot and tried to get X running. But I didn't want to run chroot manually. In this article, I want to show you how I start my chroot with X support at log-in-time on a separate console. It should be mentioned that other tutorials already discuss this topic, but they didn't work for me.

Most tutorials mention that you have to bind-mount /dev, but you should mount /proc and /sys as well. All directories must be mounted with the option “--bind”. I assume that you replace \$CHROOT:

mount --bind /dev $CHROOT/dev
mount --bind /proc $CHROOT/proc
mount --bind /sys $CHROOT/sys
mount --bind /sys $CHROOT/sys

If you want to use your host's infrastructure, in Debian e.g. x11-common and dbus, you should bind-mount also the following:

mount --bind /run $CHROOT/run
mount --bind /tmp $CHROOT/tmp

Really handy is now to enter the mount points in the fstab, to execute them right at system boot:

/dev $CHROOT/dev none bind 0 0
...

Now a simple chroot is not that uncommon. It might be cool if you could log into the system like you log in on the console at the host. So let's adjust the /etc/inittab-file for this. In this file, there might be a line like:

1:2345:respawn:/sbin/getty 38400 tty1

and similar lines for each console which is activated (on Debian 6 tty's). I now changed line 5 to:

5:23:respawn:/usr/sbin/chroot $CHROOT /sbin/getty 38400 tty5

Note: if your doing that on a non-Debian system, chroot might be located elsewhere, try whereis chroot for the correct path. Furthermore it can happen that your system doesn't use getty but agetty instead (like Arch). Here the example for my Arch chroot:

6:23:respawn:/usr/sbin/chroot $CHROOT /usr/bin/agetty 38400 tty6 linux

Reload the inittab file afterwards with telnit Q.

Now I have got the possibility to switch on console 5 to do my packaging work in Debian unstable and have a look at the latest developments in Debian.

I have tried to get X running with startx in Arch, as I did in Debian unstable. Unfortunately this is impossible with Debian as host system. You need for GNOME 3.8 the latest dbus. Dbus in turn needs ConsoleKit or loginctl (on arch the latter). Loginctl is a systemd service, not available on Debian currently.



Comments