Installing chrooted debian etch under slackware 12.0

OK, so now that I’ve installed slackware 12.0 on this TP600X I was thinking about how I might get on if I converted my T42 back to slackware. Surely there’d be a heap of packages I’d miss. Sure I could compile from source. I used to do that years ago when I ran Slackware on a few systems. The problem became that open source writers seemed hell bent on adding as many convoluted dependencies into their packages … that you could easily waste a weekend just trying to get some program to compile. Not fun.

Then I thought, why not install debian in a chroot and run the more difficult packages from the chroot.

There’s a few notes on the net about using debootstrap to install debian in a chroot, but here’s what I did:

Get the debootstrap deb from http://packages.debian.org/etch/debootstrap/all/download.
Don't be like me and get the tar.gz from debian. That didn't work for me even though
debootstrap is just a shell script

  cd /tmp
  ar x debootstrap_0.3.3.2etch1_all.deb

Extract it in your host system

   cd /
   tar xvzf /tmp/data.tar.gz

Run:

   debootstrapdebootstrap --arch i386 etch /chroot http://ftp.debian.org/debian/

   echo "proc /chroot/proc proc none 0 0" >> /etc/fstab

   mount /chroot/proc

   mount --bind /dev /chroot/dev

   cp /etc/hosts /chroot/etc

   chroot /chroot /bin/bash

   chroot# > apt-get update

   chroot#> apt-get install locales

   chroot#> dpkg-reconfigure locales
    (choose your locale. Probably should choose one of the en_US ones as well)

I want to run some X program, so I just install xterm to get all the dependencies installed:

      apt-get install xterm

To get X to work back to your parent slackware environment via a domain socket try:

mount --bind /tmp/.X11-unix /chroot/tmp/.X11-unix

You might have to create the /chroot/tmp/.X11-unix first.

The main thing is to have those mounts set up before you chroot each time.

I noticed after I did all that, that I could run xterm as root but not as a regular user. ie. After setting up all those mounts and going:

chroot /chroot /bin/bash
export DISPLAY=:0
xterm

The above worked, but something like the following did not (assuming the user kernel already exists):

chroot /chroot /bin/bash
su - kernel
export DISPLAY=:0
xterm
xterm: Error 32, errno 2: No such file or directory
Reason: get_pty: not enough ptys

It turns out you need the /dev/pts thing mounted .I originally did it inside the chroot, but its easier if you do it outside it

mount --bind /dev/pts /chroot/dev/pts
chroot /chroot /bin/bash
su - kernel
export DISPLAY=:0
xterm