Emerald Reverie

Gwmngilfen's blog - Tech, cooking, walking and other randomness from the heart of Scotland

Automated Archlinux Installs With Foreman - Part 1

The Foreman developers have just merged a small patch which allows the UI to detect and correctly display Archlinux hosts. This means it’s now possible to configure Foreman to do automated installs of Archlinux, just as you would for Debian or RedHat. This makes me happy, as people who know me might guess!

The problem

The thing is, Archlinux isn’t easy to net-install. It pains me to say it (because I’m a big fan of Arch), but their approach to automated installs just doesn’t fit with how super-smooth the rest of the distro is. Here’s a rough rundown of the steps you have to perform:

* Install  TFTP/DHCP (Foreman has us covered there :P)
* Download the Archlinux netinst iso (~200Mb, bleah)
* Loop-mount it and copy out the kernel and initrd
* Set up an network mount of the loop-mounted ISO
* Set up the templates for PXE and AIF (Arch Installer Framework) in Foreman

So yeah, we have to download a 200Mb CD, unpack it, and copy out the initrd/kernel. Not cool, guys (although if any of the ArchLinux guys want to point me at a better way of doing this, I’ll happily update the Arch Wiki in return :P). This is compared to Debian, where you can simply wget a 6Mb initrd and 2Mb kernel from ftp.debian.org, feed a preseed, and watch it fly.

It’s not all bad though, and it does work, as you will shortly see :)


Ok, I’m going to assume you have a working Foreman install - Puppet, TFTP, DHCP, etc. If you’ve not got that far, then worry not! I plan to blog about the more basic setup in a few weeks, or you can checkout @fitzdsl’s excellent blog post here

I also assume you have a machine (virtual or otherwise) that you want to install Archlinux on - no surprises, eh? :)

Getting started

Commandline configuration

So, we need the CD. Unfortunately, the Arch Releng guys don’t make a symlink to the latest CD that always works, so you have to go to http://releng.archlinux.org/isos/ and pick a date (latest is probably best), and then grab the netinstall CD. We’re also going to need a directory to serve it from, so we’ll loop mount the ISO. For example:

The last two lines are because Foreman will attempt to download the Archlinux initrd/kernel when you click “Build” on your (yet-to-be-created) Arch guest. However the Foreman codebase doesn’t yet know *how* to get those files, so we need to get ahead of Foreman and put the files there ourselves.

Finally, we need to arrange a way for the Arch installer to download the rest of it’s ISO image. There are three ways to achieve this: NBD, NFS, or HTTP. I used to use NBD, but the version of nbd-client in the current Archlinux installer is incompatible with the version of nbd-server in Debian Squeeze. So, that leaves two methods, and I’ll detail both.

*Note* in both cases, we’re serving the contents of the iso via loop-mount. If that bothers you, you could copy it out into a ‘real’ filesystem. Adjust the paths in the rest of the document if you do.


This is my preferred option as it doesn’t require downloading the whole CD into memory on your guest (at ~200Mb, it would struggle to cope on a small VM). The setup is simple enough:

Remember to adjust your network range to suit your setup.

*Note* I had some issues initially with the installer just hanging when mounting the NFS share. These went away before I could find out what was happening, but if you hit this you can always use the HTTP version below.


This is easier, in some ways, since we already have apache2 running for Foreman. However, since Foreman occupies port 80, we’ll need to configure another one. I’ll use 23575:

End of Part 1

That’s all for the configuration side - you now have a server which is capabale of building Archlinux installs. Join me in Part 2, where we’ll see how to configure Foreman to take advantage of the new configuration!