Converting old Mac minis into CentOS Instantbird build slaves
A while ago, I received a few retired Mozilla minis. Today 2 of them started their new life as CentOS6 build slaves for Instantbird, which means we now have Linux nightlies again! Our previous Linux build slave, running CentOS5, was no longer able to build nightlies based on the current mozilla-central code, and this is the reason why we haven't had Linux nightlies since March. We know it's been a long wait, but to help our dear Linux testers forgive us, we started offering 64bit nightly builds!
For the curious, and for future reference, here are the steps I followed to install these two new build slaves:
The Mac minis came with a GPT partition table and an hfs+ partition that we don't want. While the CentOS installer was able to detect them, the grub it installed there didn't work. The solution was to convert the GPT partition table to the MBR older format. To do this, boot into a modern linux distribution (I used an Ubuntu 13.10 live dvd that I had around), install
sudo apt-get update && sudo apt-get gdisk) and use it to edit the disk's partition table:
sudo gdisk /dev/sda
r' to start recovery/transformation, '
g' to convert from GPT to MBR, '
p' to see the resulting partition table, and finally '
w' to write the changes to disk (instructions initially from here).
Now you can check the current partition table using gparted. At this point I deleted the hfs+ partition.
The version of CentOS needed to use the current Mozilla build tools is CentOS 6.2. We tried before using another (slightly newer) version, and we never got it to work.
Reboot on a CentOS 6.2 livecd (press the '
c' key at startup to force the mac mini to look for a bootable CD).
Follow the instructions to install CentOS on the hard disk.
I customized the partition table a bit (50000MB for
/, 2048MB of swap space, and the rest of the disk for
The only non-obvious part of the CentOS install is that the boot loaded needs to be installed on the MBR rather than on the partition where the system is installed. When the installer asks where grub should be installed, set it to /dev/sda (the default is /dev/sha2, and that won't boot). Of course I got this wrong in my first attempts.
Installing Mozilla build dependencies
First, install an editor that is usable to you. I typically use emacs, so:
sudo yum install emacs
The Mozilla Linux build slaves use a specifically tweaked version of gcc so that the produced binaries have low runtime dependencies, but the compiler still has the build time feature set of gcc 4.7. If you want to use something as old as CentOS6.2 to build, you need this specific compiler.
The good thing is, there's a yum repository publicly available where all the customized mozilla packages are available. To install it, create a file named
/etc/yum.repos.d/mozilla.repo and make it contain this:
[mozilla] name=Mozilla baseurl=http://puppetagain.pub.build.mozilla.org/data/repos/yum/releng/public/CentOS/6/x86_64/ enabled=1 gpgcheck=0
baseurl to finish with
x86_64 depending on whether you are making a 32 bit or 64 bit slave.
After saving this file, you can check that it had the intended effect by running this comment to list the packages from the mozilla repository:
repoquery -q --repoid=mozilla -a
You want to install the version of gcc473 and the version of mozilla-python27 that appear in that list.
yum groupinstall 'Development Tools' 'Development Libraries' 'GNOME Software Development'
yum install mercurial autoconf213 glibc-static libstdc++-static yasm wireless-tools-devel mesa-libGL-devel alsa-lib-devel libXt-devel gstreamer-devel gstreamer-plugins-base-devel pulseaudio-libs-devel
Unfortunately, two dependencies were missing on that list (I've now fixed the page):
yum install gtk2-devel dbus-glib-devel
At this point, the machine should be ready to build Firefox.
Instantbird, because of libpurple, depends on a few more packages:
yum install avahi-glib-devel krb5-devel
And it will be useful to have ccache:
yum install ccache
Installing the buildbot slave
First, install the buildslave command, which unfortunately doesn't come as a yum package, so you need to install easy_install first:
yum install python-setuptools python-devel mpfr
python-devel and mpfr here are build time dependencies of the buildbot-slave package, and not having them installed will cause compiling errors while attempting to install buildbot-slave.
We are now ready to actually install the buildbot slave. First let's create a new user for buildbot:
Then the command to create the local slave is:
buildslave create-slave --umask=022 /home/buildbot/buildslave buildbot.instantbird.org:9989 linux-sN password
The buildbot slave will be significantly more useful if it starts automatically when the OS starts, so let's edit the crontab (
crontab -e) to add this entry:
@reboot PATH=/usr/local/bin:/usr/bin:/bin /usr/bin/buildslave start /home/buildbot/buildslave
The reason why the PATH environment variable has to be set here is that the default path doesn't contain /usr/local/bin, but that's where the mozilla-python27 packages installs python2.7 (which is required by
mach during builds).
One step in the Instantbird builds configured on our buildbot use
hg clean --all and this requires the purge mercurial extension to be enabled, so let's edit
~buidlbot/.hgrc to look like this:
$ cat ~/.hgrc
Finally, ssh needs to be configured so that successful builds can be uploaded automatically. Copy and adapt
~buildbot/.ssh from an existing working build slave. The files that are needed are
id_dsa (the ssh private key) and
known_hosts (so that ssh doesn't prompt about the server's fingerprint the first time we upload something).
Here we go, working Instantbird linux build slaves! Figuring out all these details for our first CentOS6 slave took me a few evenings, but doing it again on the second slave was really easy.