Skip to main content

Alpine Linux and Xen

By March 4, 2013March 4th, 2019Announcements

I’ve started working on Alpine Linux and Xen integration some time ago, when I was working as a research assistant at UPC, my college. We had just bought some blades and we needed to deploy Xen on them easily. We realized this blades contained a SD and USB slot, which could be used as a boot device. As it happened, just at this time there was a thread on xen-users about booting Dom0 from a USB stick. This was quite interesting to us because we needed something that we could replicate easily amongst a set of identical servers, apart from the fact that being able to run your Dom0 from RAM has several advantages, as described on the thread.
This is when I started working on getting a Xen Dom0 on a USB/SD card using Alpine Linux. Most of the initial changes focused on getting the toolstack to build and work using uclibc, the libc used by Alpine Linux (which indirectly lead to the adoption of autoconf in the Xen project, but that’s another story…). After some patching on the Xen side, my work focused on modifying Alpine Linux configuration scripts (alpine-conf) and the image builder (alpine-iso). This added a new target to the Alpine build system, a Xen Dom0 LiveCD/USB. The first official release of this new “flavour” debuted in Alpine Linux 2.4, and contained Xen 4.1. Since then the Xen package has been updated to 4.2, and the configuration scripts have seen several improvements that make running a Dom0 from RAM even easier.
Since I’m no longer working for my college, so I’m also no longer maintaining any servers, I’ve decided to ask some Alpine Linux users to give their opinions on why is Alpine a great choice for virtualization. Here are some of the most notable benefits of Alpine Linux as compared to more traditional distributions:
From Der Tiger:

Even the base system installation of any major Linux distribution (e.g. Fedora, Ubuntu) creates much more overhead and requires higher performance hardware, than a smaller OS like Alpine Linux or Voyage Linux, without any considerable benefit. The implementation and distribution of bug fixes fo any non-kernel related problem takes forever in most popular Linux and FreeBSD distributions, while Alpine Linux has a very active XEN users and developers group supplying both, maintenance to XEN and some degree of support through the Alpine Wiki and this mailing list.

From Florian Heigl:

  1. Size: It has a lean codebase, a very vanilla and modern kernel, which makes it realistic to apply changes without risk of introducing new issues. Examples that are relevant for me were: OpenVswitch. Another example is Flashcache (for example Flashcache is still in Catchup on resilience features like ssd loss handling. There might be a nice and tiny patch that does all I want. It is thus really important to be able to add some patches to flashcache with smaller means than “yum -y upgrade”. On a distro that is mostly outdated plus important patches plus backports, this can be much, much harder, resulting in more frustration on my side, not to mention the difference in “OPEX” for doing those changes. Another example would be taming the monster named ixgbe + vnics. This or NPIV are highly relevant functions for virtualization if you want abstraction “done right”. They’re practically impossible to use on major distros without replacing drivers.
  2. Unique features: I found out about Alpine not as a Xen distro – I found it because I was looking for something that goes beyond the commonly available networking options, be it very old (bridging) or newer (openvswitch+gre as the current practice). I want to be able to run a really virtualized infrastructure and after months found out there is only one distro that offers DMVPN. Next I found out that distro is made with a very network-engineeric mindset, being able to run from RAM and actually designed to make that easy. I’ve in the past made CentOS and later OracleVM (google: xen black magic) run “almost stateless” from a readonly root with a lot of ram-backed tmpfs, and it was as far as you can take those RHEL-based distros. You’ll also be just as far from any idea of vendor support with such a setup. Just imagine my surprise when I found Alpine comes with this designed in and commonly run in a ram-backed mode.
Why is that so important?
Because, let’s be honest, dom0 is not important. Important are those VMs I’m running for other people and that pesky dom0 should be incredibly indestructible and immortal so it can always serve them. No matter if all my disks failed, the networking died or the sun is sending nasty rays upsetting my ECC memory (Yes, Alpine helps me with that too because it has a current kernel and so it can read the MCE data passed from Xen).
This is just a small abstract of all the points given, so I would recommend everyone to give a try to Alpine Linux, each release starting from 2.4 comes with a Xen Dom0 LiveCD/USB that can be found at the downloads page. After all you don’t even need to install it to your hard drive 🙂