How to build a Ubuntu chroot environment

As with Debian, you can use debootstrap to create your base Ubuntu system. You will then have to mount both your dev and proc filesystem for your chroot environment to work properly. Follow these steps for details.

  1. Create a chroot folder
    $ mkdir chroot-ubuntu
  2. Create a base Ubuntu system using debootstrap.
    $ sudo debootstrap --variant=buildd gutsy chroot-ubuntu http://archive.ubuntu.com/ubuntu/


    Change gutsy to any Ubuntu release that you want. E.g. hardy or feisty.

  3. Mount proc and dev filesystem on to the base system.
    $ sudo mount -o bind /dev chroot-ubuntu/dev
    $ sudo mount -o bind /proc chroot-ubuntu/proc
  4. Chroot .
    $ sudo chroot chroot-ubuntu /bin/bash
  5. Unmount both dev and proc filesystem once exiting chroot.
    $ sudo umount chroot-ubuntu/dev chroot-ubuntu/proc