Ted Dziuba inspired me to try installing multiple concurrent Linux distributions inside of an existing distribution.  This is really handy for testing.  Go try it (it won't take long).  It's really awesome!

Ted's instructions are rather minimal, although are a great place to start.  I also found the Debian Wiki - Debootstrap page to be helpful.

In my case, I'm running Debian 6 squeeze on my desktop machine.  I've installed Debian 5 lenny and Ubuntu 10.04 lucid as chroot environments.  If after installing a Debian release, when running apt, you get errors about not being able to authenticate packages, make sure you run "apt-get update" first.  That will take care of it.

There's no "debian-minimal" package like there is for Ubuntu but (as root in the chroot environment) a quick "apt-get update && apt-get install aptitude sudo nano" got me to a place where installing the things I want is easy.

One thing to be careful of, your user is still your user inside the chroot environment and your home directory is still your home directory!  If you delete stuff in your home directory, it really will be gone, whereas if you delete / modify stuff (inside the chroot) from /etc and other system directories, it's only within the chroot.

If you'd like to use rinse to install RedHat based distributions that aren't included by default (no recent Fedoras are for Debian 6's version of rinse), take a look at the rinse Gitorious tree and grab the more up-to-date /etc/rinse/rinse.conf and *.packages files.  I'll be doing this shortly and I'll post a follow up after installing some RedHat distros.

See after the jump for list of commands I used to install both lenny and lucid...

sudo mkdir -pv /opt/chroot/lenny
sudo debootstrap --variant=buildd --arch amd64 \
 lenny /opt/chroot/lenny/ http://mirror.rit.edu/debian/
sudo mkdir -p /opt/chroot/lucid
sudo debootstrap --variant=buildd --arch amd64 \
 lucid /opt/chroot/lucid http://mirror.rit.edu/ubuntu/

Comments

Andrew
For Ubuntu lucid, when in the chroot, you may get some errors when running apt (or other programs). They'll look like this: "start: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused"

To fix these issues with upstart (which are only evident in the chroot), check out this bug report: https://bugs.launchpad.net/ubuntu/karmic/+source/upstart/+bug/430224
Andrew
If you use the Gitorious /etc/rinse/*.packages files to install Fedora 13, just be forewarned that you may have an issue when attempting to run yum. The issue will be the errror: "Error: Cannot retrieve repository metadata (repomd.xml) for repository: fedora"

In the /etc/yum.repos.d/fedora{,-updates}.repo files, simply comment out the mirrorlist line and put your favorite local Fedora mirror in for baseurl (with the actual path). This will make yum happy.

Published

28 February 2011