Wednesday, 15 January 2014

Standing on the shoulders of giants

This is a guide to setting up the Xen hypervisor on Arch Linux.

I've been having a whale of a time over the past 4-5 weeks learning as much as I can about virtualisation with the objective of configuring a unified server to run;

  • unRAID
  • mediaportal server (windows VM) with DVB-S2 tuner cards passed through
  • at least one mediaportal client (windows VM) with GPU & USB passed through

I've bought and built a new machine for this and I've been playing variously with Linux distros such as OpenSuSe, Manjarobox and now vanilla ArchLinux. With all of the above I've tried both Xen and KVM as virtualisation hosts.

I've been enjoying the discussion on unRAID forums around virtualisation and the possibility of running unRAID in a full distro but am hedging my bets and want to become very familiar with setting up a system like this where unRAID can run either on the host system or in a VM.

Rather than try to do everything at once, I've decided it's best to take baby steps. My objective right now now is to build an ArchLinux system with Xen. Once established, I'll play with that, get familiar with making VMs etc. and then later move on to configuring passthrough.

From my tests so far, I've settled on Xen as gpu passthrough seems to be a bit more straightforward than on KVM (or I just haven't found a good KVM guide yet)

Anyway, the work of IronicBadger and GrumpyButFun on the unRAID forums has been inspirational and I've been following their threads, posts, guides and blogs with deep interest.

However, while all the steps for building such a system are there in their output, what I've found is that the required info is fragmented. Some guides are incomplete, others assume a certain level of knowledge or take shortcuts or refer to other (unlinked) documents.

What I've done here is write a consolidated meta-guide that lists all the steps in an efficient order and includes any clarifications or gotchas I've found, investigated and resolved in following the instructions from the guys. Essentially, the response of a user with basic linux skills drawing together all the bits and pieces,(and a reference for myself for when I want to re-do this at some point in the future).

So, below I reproduce yagxup v0.2 (yet another guide for xen and unraid with passthrough).

pre-install notes

Things change. This guide can only be up to date at the time of writing. Caveat emptor.


before attempting this you should;

  1. be familiar with issuing linux commands in CLI
  2. be familiar with editing files in nano

STEP 1 - Install ArchLinux

Follow IronicBadger's ArchLinux install guide which utilises ArchBoot with a visual installer (as opposed to cli espoused on ArchWiki beginners guide).

This gets you to the stage of booting ArchLinux and allowing root login.

The ISO image link in the guide is broken. This appears to be the current ISO link;

STEP 2 - Post Install Setup

2.1 Grub Update Bug Fix

issue this command;

nano /etc/default/grub

In nano, add this to the file

(From Newer versions of the ArchLinux netbook ISO (Jan 2014 and later) don't need this fix but were not available at the time of writing).

2.2 Configure pacman & update

Edit /etc/pacman.conf in nano.

Uncomment [multilib] block and add the following underneath;
SigLevel = Never
Server =$arch
save and then update pacman with the following

pacman -Syyu

2.3 Install SSH

Set up SSH and get it to start on boot;

pacman -S openssh
systemctl enable sshd.service
systemctl start sshd.service

2.4 Create a user

useradd -m -g users -s /bin/bash <username>
usermod -a -G wheel <username>
passwd <username>

2.5 Configure nano as default

in /etc/bash.bashrc add;
export EDITOR=nano

2.6 Configure sudo

pacman -S sudo
EDITOR=nano visudo

uncomment this line;

2.7 Install utilities

pacman -S unzip
pacman -S wget

STEP 3 - Install Xen

3.1 Download precompiled Xen

navigate to a suitable directory and download IronicBadgers Xen package;


OR download the same file as linked by GrumpyButFun;

3.2 Install Xen

unzip *.zip
pacman -U xen-4.3.1-2-x86_64.pkg_.tar.xz

3.3 Update grub

grub-mkconfig -o /boot/grub/grub.cfg

This adds the Xen kernel to the grub boot menu.

3.4 Set Up services

systemctl enable xenstored.service
systemctl enable xenconsoled.service
systemctl enable xendomains.service

3.5 Reboot


You should select the Xen option from the grub menu during restart

STEP 4 - Post-Xen install

4.1 Set up network bridge

Follow grumpybutfun's guide at the start of this post;

4.2 Set up libvirt

Follow grumpybutfun's guides to enabling libvirt and configuring ssh/tcp;

You should now have a working installation of Xen on Arch Linux.


ArchLinux Installation guide;

ArchLinux Beginners guide;

ArchLinux Network Bridge setup guide;

IronicBadger's ''How to install ArchLinux'

IronicBadger's 'perfect media server setup with Arch Linux, Xen and XBMC'

GrumpyButFun's '[GUIDE] Virtualizing unRaid in Xen / KVM on Arch Linux'

No comments: