Setting-up a HTPC with XBMC and ArchLinux

This tutorial will guide you through an installation of XBMC on top of ArchLinux and thus using a GPT partition and GRUB2 on a BIOS enabled PC (see Wiki for EFI).

Prepare USB stick

Based upon 2013.03.01 ISO image or later from

# dd if=/dev/zero of=/dev/sdx  bs=1k count=1
# dd if=archlinux-xxxxx.iso of=/dev/sdx

Replace sdx by your thumbdrive reference.

Install from USB

Boot & select x86_64 (or i686 if you want to stay with i686 architecture, max. 3GB SRAM)

Change keyboard layout

# loadkeys fr

Get IP address

2012.08.04 image and above should automatically starts the network and get an IP address via DHCP so the following step is not required.

Assuming you are on ethernet with a DHCP server.

# dhcpcd

Manually partition hard drives

# gdisk /dev/sda

Remove old partitions then create the following partitions: * 2MB, type EF02 (BIOS partition). This is used by GRUB2/BIOS-GPT. (/dev/sda1) * 100MB, type 8300 (Linux). This will store /boot (/dev/sda2) * 2GB, type 8200 (swap). This is our dedicated swap partition (not part of lvm). (/dev/sda3) * Remaining space, type 8300 (Linux). Store both / and /home. (/dev/sda4).

Configure block devices, filesystems, and mountpoints

Format /boot, /root and /home

# mkfs.ext2 /dev/sda2
# mkfs.ext4 /dev/sda4
# mkswap /dev/sda3

Mount the partitions

# mount /dev/sda4 /mnt
# mkdir /mnt/boot
# mount /dev/sda2 /mnt/boot

Select installation mirror is throttled to 50KB/s.

Before installing, you may want to edit /etc/pacman.d/mirrorlist such that your preferred mirror is first. This copy of the mirrorlist will be installed on your new system by pacstrap as well, so it’s worth getting it right.

Install the base system

# pacstrap /mnt base base-devel base-devel

Install a bootloader

Folllowing will install GRUB2. If you want EFI please refer to Wiki.

# pacstrap /mnt grub-bios

Generate fstab

Generate an fstab file with the following command. UUIDs can be be used because they have certain advantages (see fstab#Identifying filesystems), replace the -L option with -U. Note: If you encounter errors running genfstab or later in the install process, do not run genfstab again; just edit the fstab file.

# genfstab -L -p /mnt >> /mnt/etc/fstab

Mount Flags

Edit /mnt/etc/fstab

tmpfs       /tmp    tmpfs   nodev,nosuid    0   0
/dev/sda4 / ext4 rw,noatime,data=ordered 0 1
/dev/sda2 /boot ext2 rw,noatime 0 2
/dev/sda3  swap swap    defaults 0 0

Chroot into our newly installed system

# arch-chroot /mnt

Configure system

Root password

Set a root password with:

# passwd


Add your hostname in /etc/hostname.


Set it to your liking. This is the name of your computer.

Add also your hostname in /etc/hosts, coinciding with the one specified in /etc/hostname as an alias, so that it looks like this:   localhost.localdomain   localhost myhostname
::1         localhost.localdomain   localhost myhostname

Note: ::1 is the IPv6 equivalent of

Console fonts and keymap

Set keymap and font name in /etc/vconsole.conf.



Edit the file /etc/timezone and write your Zone/Subzone. Available time zones and subzones can be found in the /usr/share/zoneinfo// directories. Example:


Additionaly, create a symbolic link /etc/localtime to the same /usr/share/zoneinfo// using this command:

# ln -s /usr/share/zoneinfo/Europe/Paris /etc/localtime


Enable locales

Edit /etc/locale.gen and uncomment:

en_US.UTF-8 UTF-8
fr_FR.UTF-8 UTF-8
fr_FR ISO-8859-15
fr_FR@euro ISO-8859-15

Generate locales

# locale-gen

Setting up system-wide locale

Add your language to /etc/locale.conf.


Export current language for initramfs creation

We will be adding keymap to mkinicpio.conf therefore we need to environment variable LANG.

# export LANG=fr_FR.UTF-8

Hardware clock time

When using UTC launch the following command:

# hwclock --systohc --utc

Configure the network

If not using DHCP or network manager, please see wiki for rc.conf configuration.

Prepare initramfs build

Add keymap to kernel for non-US keyboard on boot.

Edit /etc/mkinitcpio.conf and insert “keymap” on the HOOKS line

add keymap before filesystems.

HOOKS="base udev autodetect modconf block keymap filesystems keyboard fsck"

Create an initial ramdisk environment

# mkinitcpio -p linux

Configure the bootloader

Install GRUB2 to hard-drive

# grub-install /dev/sda

To prevent a (harmless) error message at boot time execute:

# cp /usr/share/locale/en\@quot/LC_MESSAGES/ /boot/grub/locale/

Change GRUB timeout

nano /etc/default/grub


Generate GRUB2 configuration

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

Unmount the partitions

If you are still in the chroot environment then type exit or Ctrl+D in order to exit chroot. Since the partitions are mounted under /mnt, we use the following command to unmount them.

# exit
# umount /mnt/boot
# umount /mnt


Execute the following command and remove the installation media.

# reboot

Start and enable DHCP by default

Type ip addr to see the different network cards and use the right one.

Enable DHCPD

# systemctl start dhcpcd@enp4s0

Enable DHCPD on boot

# systemctl enable dhcpcd@enp4s0

Add additional repositories

Most people will want to use [core], [extra] and [community].


If you installed Arch Linux x86_64, it’s recommended that you enable the [multilib] repository, as well (to be able to run both 32 bit and 64 bit applications), in /etc/pacman.conf

SigLevel = PackageRequired
Include = /etc/pacman.d/mirrorlist

yaourt + multilib + other repos


Required for installing yaourt & virtualbox and many other packages

Add as root the following into /etc/pacman.conf:

For 32-bit (i686) installations:

SigLevel = Optional TrustAll
Server =

For 64-bit installations:

SigLevel = Optional TrustAll
Server =

Refresh software list with:

# pacman -Syy

Package management with Yaourt rather than pacman

Add nice colors when browsing packages

# pacman -S yaourt pacman-color colordiff

Search both binary repo but also AUR

# yaourt mc

Complete update and upgrade, even for packages coming from AUR

# yaourt -Syu --aur

Install Xorg

Core Xorg install

# pacman -S xorg-server xorg-xinit xterm

NVidia video driver

The following is for an ION Nvidia based graphic card (Ion).

pacman -S nvidia libvdpau xf86-video-nv

Configure NVidia graphic card

This step might be optional but you can run it just to make sure. The NVIDIA package includes an automatic configuration tool to create an Xorg server configuration file (/etc/xorg.conf) and can be run by:

# nvidia-xconfig

Enable hardware acceleration for HD content

# echo "" > /etc/X11/XvMCConfig 

Keyboard & mouse

Udev should be capable of detecting your hardware without problems. The evdev driver (xf86-input-evdev) is the modern hot-plugging input driver for almost all devices, so in most cases, installing input drivers is not needed (xf86-input-keyboard xf86-input-mouse)

Set the keyboard layout (if you do not use a standard US keyboard).

To change your keyboard layout, edit /etc/X11/xorg.conf.d/10-evdev.conf and add a XkbLayout line so it looks like:

Section "InputClass"
        Identifier "evdev keyboard catchall"
        MatchIsKeyboard "on"
        MatchDevicePath "/dev/input/event*"
        Option  "XkbLayout" "fr"
        Option  "XkbVariant" "latin9"
        Driver  "evdev"


In order to properly load the NVidia drivers.

Test X

Install the default environment:

# pacman -S xorg-twm xorg-xclock xterm

Start X # startx

Install XBMC

# pacman -S xbmc lirc unrar libxvmc

Migrating old library to XBMC 12.0

New path for xbmc home directory is /var/lib/xbmc. The best way to migrate your old library to the new installation is:

Make sure that XBMC is not started yet!!

Archive the initial xbmc directory # mv -r /var/lib/xbmc /var/lib/xbmc-initial

Copy the old library from a backup # cp -r /path/to/backup/xbmc /var/lib

Change ownership and permissions # chmod 700 /var/lib/xbmc # chown -R xbmc:xbmc /var/lib/xbmc

Create symbolic link to match your old library path: # cd /home # ln -s /var/lib/xbmc xbmc # ln -s /var/lib/xbmc xbmc-start

Enabling shutdown, restart, hibernate and suspend

Since version 12 XBMC supports power management via systemd logind daemon. To enable it you should have polkit (and also upower) installed on your system.

# pacman -S polkit upower udisks

Add the following rule file which will allow users added to power group shutdown, restart, hibernate and suspend computer.


polkit.addRule(function(action, subject) {
        if("org.freedesktop.login1.") && subject.isInGroup("power")) {
        return polkit.Result.YES;

Autostarting at boot

To use XBMC on HTPC you may want to start XBMC automatically on boot. Since version 11.0-11 xbmc package includes the xbmc group, user, and service file necessary to do this.

To start XBMC from the command line # systemctl start xbmc

To make XBMC start at system boot you should simply enable the service: # systemctl enable xbmc

Other tricks in case of problem

Configure sound

This step was not required. Use only if you encounter issues.

Install the alsa-utils package:

# pacman -S alsa-utils

As normal, non-root user, invoke /usr/bin/alsamixer:

# su - xbmc
# alsamixer

Unmute the Master and PCM channels by scrolling to them with cursor left/right and pressing M. Increase the volume levels with the cursor-up key. (70-90 Should be a safe range.) Some machines, (like the Thinkpad T61), have a Speaker channel which must be unmuted and adjusted as well. Leave alsamixer by pressing ESC.

Ensure your speakers are properly connected, and test your sound configuration as normal user using :

# speaker-test -c 2

You should hear a very eloquent woman say, “Front, center.”

FOLLOWING… NOT SURE !!! Exit your normal user shell and run /usr/sbin/alsactl as root to save settings:

# exit
# alsactl store

Not sure about the following one… doens’t save anything. This will create the file ‘/etc/asound.state’, saving the alsamixer settings.

Getting SPDIF Output to work

Not required.

If the optical/coaxial digital output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try running (as root): # iecset audio on

Older trick:

Edit /var/lib/alsa/asound.state. This file is where alsasound stores your mixer settings. Find a line that says: ‘IEC958 Playback Switch’. Near it you will find a line saying value:false. Change it to value:true. Now find this line: ‘IEC958 Playback AC97-SPSA’. Change its value to 0. Restart ALSA.

Alternative way to enable SPDIF output automatically on login (tested on SoundBlaster Audigy):

add following lines to /etc/rc.local:

 # Use COAX-digital output
 amixer set 'IEC958 Optical' 100 unmute
 amixer set 'Audigy Analog/Digital Output Jack' on

You can see the name of your card’s digital output with:

 $ amixer scontrols

additional polkit rule required for hibernate ??

polkit.addRule(function(action, subject) {
    if ("org.freedesktop.udisks") == 0 && subject.isInGroup("storage")) {
        return polkit.Result.YES;
Share Comments
comments powered by Disqus