Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a set of packages that I wish to install along-side the minibase variant in debootstrap. I'm having the hardest time figuring out how to customize variants so that more than just the base is installed in a chroot when debootstrap is run. Any way to achieve this?

share|improve this question
up vote 7 down vote accepted

It's pretty easy to add your own variant with additional custom packages to debootstrap.

The debootstrap configuration/runtime scripts are located in /usr/share/debootstrap/scripts. Let's create an allmybase variant which includes everything in minbase along with the packages htop and traceroute.

  1. Open /usr/share/debootstrap/scripts/precise in your editor.

    • Note that this, along with many Ubuntu releases, is a symbolic link to /usr/share/debootstrap/scripts/gutsy; if you want to affect only a specific release, break the link and make it a copy of the gutsy script instead.
  2. Around line 22, find the line beginning with variants and add your custom variant at the end:

    variants - buildd fakechroot minbase allmybase
  3. Find the work_out_debs() function around line 34, and look at the default settings for the base variable for your "base" variant (here, minbase):

        elif doing_variant fakechroot || doing_variant minbase; then
  4. Append your own variant with custom packages at the end of the function:

        elif doing_variant allmybase; then
                base="apt htop traceroute"
  5. Save, exit, and test it out with the --print-debs "simulation" flag, e.g.

    sudo debootstrap --print-debs --variant=allmybase precise /tmp/prec-chroot
    • In this example, the output will show that the htop and traceroute packages will be included in the allmybase chroot.
share|improve this answer
Wow, I guess this seems almost as dirty as just installing a variant and mounting the chroot + apt-get. Thanks for the information! – Marco Ceppi Jul 26 '12 at 2:20
Well, a little pain once will gain you a lot if you install the same variant repeatedly ;) – izx Jul 26 '12 at 2:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.