Menu principal

· · · «a Verdade é uma terra sem caminho» –Jiddu Krishnamurti · · ·

Create a debian chroot inside ubuntu

OK, quick way to create that which is stated in the title. Loosely based on this, with some simplifications. Extremely useful to build/test software with lots of possibly experimental or otherwise dangerous dependencies or features, without polluting the mainhost package management system. Can be a real life (and time) saver.

Here we’ll install a lenny (current Debian stable) chroot, modify the accordingly the commands below if you choose to use some other version.

The name of the chroot in our example will be mychroot

/var/chroot/ is the place where you want the chroot to be created (a folder named (in this case) mychroot will be automagically created inside /var/chroot/ )

1. Install debootstrap: $ aptitude install debootstrap;
(install the one that comes from the repositories, no need to download any deb’s manually)

9. Modify the prompt to tell you that you’re in a chrooted environment. VERY useful if you work with multiple shells (who doesn’t thes days?), both from the chroot and the mainhost. You can call it whatever you want.

$ sudo chroot /var/chroot/
$ echo mychroot > etc/debian_chroot
$ exit

10. Now from the mainhost, (no need to be root) do the command below and you’re in a working chroot environment:

$ dchroot -c mychroot -d

The end.
(*) The locale stuff needs some fine tunning, maybe in a future update.