Skip navigation

Base boxes

Help

Base boxes

Aegir-up base boxes

We maintain 3 base boxes for the Aegir-up project, which we build using veewee (ver. 2.3, installed via Ruby gem). The principal reason for maintaining our own base boxes is our use of NFS to mount /var/aegir on the host system. For NFS to work properly, the aegir user's UID (in the VM) must match that of the user on the host machine. On a standard *nix workstation, the primary user's uid is very likely to be 1000, which is the uid normally assigned to the vagrant user by veewee. This collision can be fixed by assigning vagrant a different uid when the base box is initially built, which is what we do (in aegir-up/lib/definitions/debian/preseed.cfg).

The first base box ('debian') is a basic install (via veewee, anyway) of the latest stable version of Debian. This allows us to have a clean base from which to start, so we can test installing from scratch, as well as providing a template to build additional base boxes later.

The second adds the basic requirements for Aegir (LAMP-stack, php-cli, &c.), but we may add a couple more utilities. This makes building Aegir much quicker, which is particularly useful when developing the Aegir and Drush Puppet modules, or developing custom Aegir makefiles.

The third is identical to the LAMP server above, only 32-bit. Some systems (even 64-bit ones!) can only host 32-bit VMs. For anyone with such a system, we maintain this box.

Customization Techniques

We've split the veewee default postinstall.sh into postinstall-setup.sh and postinstall-cleanup.sh, which we call by adding them to the :postinstall_files array in definition.rb. Additional configuration can be added by creating scripts and adding them to the :postinstall_files array.

In our 'debian' base box, we added debian-config.sh, in which we set the GRUB timeout to 0, install Git, clone the Aegir-up repo, and run the debian.pp Puppet manifest. Similarly, in the 'debian-LAMP' base box (both 64- and 32-bit), we run a script to apply the debian-LAMP.pp. When testing, remember that any changes to Puppet manifests called from a shell script in this way will have to be pushed to the d.o Aegir-up repo before building the base box.

Instructions

To build a base box, follow these instructions:

(N.B. All commands should be run from the lib/ directory.)

  1. Ensure that aegir-up/definitions/debian-LAMP/definition.rb contains the latest stable release of Debian. If it's out-of-date, use something like the this to fix it:
    VM=debian-LAMP
    OLD_DEBIAN_VER=6.0.3
    NEW_DEBIAN_VER=6.0.4
    sed "s/$OLD_DEBIAN_VER/$NEW_DEBIAN_VER/" -i ./definitions/$VM/definition.rb
  2. Then initiate the build with:
    vagrant basebox build "$VM"
  3. After a couple minutes, it'll be done and we can ensure that the installation worked properly by running:
    vagrant basebox validate "$VM"
  4. Assuming everything comes out green, we can create the .box file by running:
    vagrant basebox export "$VM"
  5. Append the current Debian version and datestamp to the name of the base box:
    mv $VM.box $VM-`date +%F`.box
  6. Upload it to the server.
    rsync -zP $VM-`date +%F`.box <username>@<server>:~/boxes
  7. SSH into the server and update the symlink for the public download:
    ssh <username>@<server>
    sudo su
    rm /var/aegir/platforms/<platform>/<site>/files/boxes/$VM-current.box
    ln -s /home/<username>/$VM-`date +%F`.box /var/aegir/platforms/<platform>/<site>/files/boxes/$VM-current.box

To build the basic 'debian' or i386 varieties the above instructions, substituting 'debian' or 'debian-LAMP-i386' for 'debian-LAMP' in Step (0), e.g.:

VM=debian-LAMP-i386

Troubleshooting

  • Sometimes a VirtualBox VM doesn't get fully deleted by VBox. In that case, look for the offending VM in '~/VirtualBox\ VMs/', where it can be deleted manually.
  • Sometimes a VirtualBox disk-image (.vdi) can appear to become corrupted, and refuse to close. You can see this when running the VirtualBox GUI by launching the Virtual Media Manager (CTRL+D or 'File >> Virtual Machine Manager'). Under Debian, you can look in ~/.VirtualBox/. More specifically in VirtualBox.xml. In purging all VMs, I've been able to fix this by simply emptying the ~/.VirtualBox/ directory.
  • Some CPUs won't support 64-bit virtualization. Try running
    egrep '(vmx|svm)' /proc/cpuinfo
    If you don't see any output, that's a pretty good indication that this applies to you. We maintain a 3rd base box (debian-LAMP-i386) to help in just such situations. Modify your settings.rb file thusly:
    Basebox   = "debian-LAMP-i386-2012-03-29"
    Box_url   = "http://ergonlogic.com/files/boxes/debian-LAMP-i386-current.box"
    

Further ideas

The base box files still tend to be rather large:

$ du -s -m *.box 
284     debian-6.0.4.box
371     debian-LAMP-6.0.4.box

Here are some ideas to further reduce their size:

  • Removing the source-code entries from /etc/apt/sources.list.
  • 'apt-get purge tasksel nano aptitude at eject info usbutils xscreensaver bluetooth wireless-tools discover radeontool wpasupplicant.
  • Installed ( and then remove) debconf-english & localepurge
  • Delete *Sources from /var/lib/apt/lists, then run 'apt-get autoremove --purge'.
  • Use deborphan, as described in this blog post:
    apt-get install deborphan
    dpkg --purge $(deborphan)
    dpkg --purge $(COLUMNS=132 dpkg -l | grep ^rc | awk '{ print $2; }')
  • Remove translation files from /usr/share/man and /usr/share/locale
  • Delete kernel modules for sound, usb, telephony, video, bluetooth, firewire, parport from /lib/modules/
  • Delete documentation (rm -rf /usr/share/doc-base/*; rm -rf /usr/share/doc/*)
  • http://wiki.debian.org/DebianLive/HowTo/SmallSizeImage

Some may be redundant, and others dangerous, but still may be worth exploring at some point.

Need help?

Notebook

The notebook section provides a way for you to store and share information with your group members. With the book feature you can:

  • Add book pages and organize them hierarchically into different books.
  • Attach files to pages to share them with others.
  • Track changes that others have made and revert changes as necessary.
  • Archive books that are no longer of interest to the group. Archived books can be reactivated later if needed.