10

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?

10

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
                base="apt"
    
  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.
  • 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 ;) – ish Jul 26 '12 at 2:45
  • Maybe that option did not exist at the time of the question, but the same effect can be achieved with debootstrap --include=htop,traceroute without any modifications to debootstrap scripts. – raimue Nov 6 at 15:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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