Software Development with Linux

Creating a Debian or Ubuntu chroot from Ubuntu 10 04

WED, 01 SEP 2010

The reasons for having a Debian or Ubuntu chroot environment available are many.  I often use them to test build procedure in a clean environment (like building a binary Ubuntu package from its source package).  But whatever are your reason for doing so, they are all good.

You want to create your own Debian or Ubuntu chroot environment and you are using Ubuntu 10.04 but don't know how to do it?  That's quite easy.


  1. Install dchroot and debootstrap.

  2. sudo apt-get install dchroot debootstrap
  3. Edit /etc/schroot/schroot.conf and add a section like this one.

  4. [lucid]
    type=directory
    description=Ubuntu Lucid
    directory=/home/laurent/chroot/lucid
    priority=3
    users=laurent
    groups=laurent
    root-groups=root
  5. Create the chroot directory.

  6. mkdir -p ~/chroot/lucid
  7. Bootstrap the Ubuntu Lucid (10.04) environment.

  8. sudo debootstrap --variant=buildd --arch amd64 lucid
    /home/laurent/chroot/lucid/ http://mirror.csclub.uwaterloo.ca/ubuntu/


That's it!  You can bootstrap any Ubuntu or Debian distribution this way, by using the correct distribution codename instead of Lucid.

Now, if you want to use it :
sudo schroot -c lucid
No need to do any mount bind, schroot handle all that stuff for you.  If you want to change what gets mounted where, edit /etc/schroot/mount-defaults.