Sigh. Nothing stays still in the tech world, does it? :)

The Archlinux Releng team have drastically altered the method for installing Archlinux since I wrote my previous article. In particular, they have dropped AIF and resorted to simple bash commands for installation.

This actually makes our life for Foreman much easier, but I thought I should write a small blog post to tell you how to use it.

Installation Media

Not much changes here, except now you can use the default release images, from

You will still need to loop-mount the iso for NFS or HTTP access and copy out the vmlinuz and archiso.img files though.

The /dev/vda problem seems to be gone now, hooray! Default-created libvirt guests from Foreman should work fine now, assuming you keep the "sed -i mkinitcpio.conf" change in the Finish template.

The script=... parameter in your PXElinux template remains the same, but at present there is a bug in the current release which prevents it working. The installer will boot to a root shell, at which point you have to manually install wget and run the foreman script:

    pacman -Sy wget
    wget -q -O /tmp/startup_script http://foreman/unattended/provision
    bash /tmp/startup_script

Once this bug has been fixed and should be released in the next stable iso. Or you can use to build your own ISO with wget in it - worked fine for me, with no cusomizations.

New Templates for New Times

The only real changes are what data we feed to Arch - it used to be AIF profile data, now it's just a bash script. The installation is roughly 2 parts:

    1) Partitioning/mounting the disk and running pacstrap
    2) Chrooting into the install for everything else

So, as is fairly standard for Foreman, we can use a 'provision' type template for (1) and a 'finish' for (2). Let's see an example:


# Simple script to provision new style Arch install

### Disk setup / mount
<%= @host.diskLayout %>
### End disk setup

# Base install
/usr/bin/pacstrap /mnt base

# Install Grub
/usr/bin/pacstrap /mnt grub-bios

# Fstab
/usr/bin/genfstab -p /mnt >> /mnt/etc/fstab

### Create finish script
/usr/bin/wget <%= foreman_url("finish") %> -O /mnt/bin/foreman.finish
/bin/chmod +x /mnt/bin/foreman.finish
/usr/bin/arch-chroot /mnt foreman.finish
rm /mnt/bin/foreman.finish

# Finish up
umount /mnt
/usr/bin/wget --quiet --output-document=/dev/null --no-check-certificate <%= foreman_url %>

# Reboot
/sbin/shutdown -r now


/bin/echo "<%= @host.shortname %>" > /etc/hostname

/bin/ln -snf /usr/share/zoneinfo/Europe/London /etc/localtime

/bin/echo -e 'LANG="en_GB.UTF-8"\nLC_COLLATE="C"' > /etc/locale.conf
/bin/echo -e 'en_GB.UTF-8 UTF-8' > /etc/locale.gen

/bin/echo 'KEYMAP="uk"' > /etc/vconsole.conf

/bin/sed -i 's/MODULES=.*/MODULES="virtio_blk virtio_pci virtio_net"/' /etc/mkinitcpio.conf
/usr/bin/mkinitcpio -p linux

/sbin/modprobe dm-mod
/usr/sbin/grub-install --target=i386-pc --recheck /dev/vda
/bin/mkdir -p /boot/grub/locale
/bin/cp /usr/share/locale/en\@quot/LC_MESSAGES/ /boot/grub/locale/
/usr/sbin/grub-mkconfig -o /boot/grub/grub.cfg

/bin/echo 'root:<%= root_pass %>' | /usr/sbin/chpasswd -e

# Other stuff

pacman -S --noconfirm openssh
/bin/sed -i 's/DAEMONS=(\(.*\))/DAEMONS=(\1 sshd)/' /etc/rc.conf

# Yaourt repo
echo '[archlinuxfr]
Server =$arch
SigLevel = Never' >> /etc/pacman.conf

pacman -Sy --noconfirm yaourt base-devel

# Install stuff with yaourt
yaourt -Sy --noconfirm puppet

cat > /etc/puppet/puppet.conf << EOD
<%= snippets "puppet.conf" -%>
/usr/bin/touch /etc/puppet/namespaceauth.conf 
/usr/bin/puppet agent --config /etc/puppet/puppet.conf --onetime --tags no_such_tag --server <%= @host.puppetmaster %> --no-daemonize

Partition Table

# Blank the disk
/bin/dd if=/dev/zero of=/dev/vda count=1 bs=512

# Single partition
/bin/echo -e "n\np\n1\n\n\nw\n" | fdisk /dev/vda

# Format partition
/sbin/mkfs.ext4 /dev/vda1

# Mount partition
/bin/mount /dev/vda1 /mnt

Wrap up

So there you have it. You can install extra packages, configure services, etc at the end of the Finish script as per normal. Enjoy!