From ArchWiki
Revision as of 22:05, 21 November 2013 by Graysky (Talk | contribs) (Configuration: 3rd person and fix up)

Jump to: navigation, search

XBMC (formerly "Xbox Media Center") is a free, open source (GPL) multimedia player that originally ran on the first-generation XBox, (not the newer Xbox 360), and now runs on computers running Linux, Mac OS X, Windows, and iOS. XBMC can be used to play/view the most popular video, audio, and picture formats, and many more lesser-known formats, including:

  • Video - DVD-Video, VCD/SVCD, MPEG-1/2/4, DivX, XviD, Matroska
  • Audio - MP3, AAC.
  • Picture - JPG, GIF, PNG.

These can all be played directly from a CD/DVD, or from the hard-drive. XBMC can also play multimedia from a computer over a local network (LAN), or play media streams directly from the Internet. For more information, see the XBMC FAQ.

As of version 12, it can also be used to play and record live TV using a tuner, a backend server and a PVR plugin; more information about this can be found on the XBMC wiki.


Install xbmc from the official repositories. Optionally install xbmc-pvr-addons if users wish to use the pvr extensions of xbmc.


Autostarting at boot

It is desirable to start XBMC automatically on boot. Since version 11.0-11, the xbmc package will automatically create the xbmc group, user, and provide an xbmc.service so systemd can manage xbmc without the need for a DE.

To make XBMC start at system boot, enable the service:

# systemctl enable xbmc

Enabling shutdown, restart, hibernate and suspend

Since version 12 XBMC supports power management via systemd logind daemon. To enable it, polkit, upower and udisks are required.

In case XBMC is started using the systemd service, the session might not get initialized properly and therefore polkit may not allow the shutdown or reboot of the system. If this happens, adding the following rule file will allow users in the power and storage group to shutdown, restart, hibernate and suspend computer.

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

polkit.addRule(function(action, subject) {
    if (action.id.indexOf("org.freedesktop.udisks") == 0 && subject.isInGroup("storage")) {
        return polkit.Result.YES;
Note: There is an active bug report to have the package provide this file, but as of 21-Nov-2013 it has not been implemented.

Using a remote controller

As XBMC is geared toward being a remote-controlled media center; any PC with a supported IR receiver/remote, can use remote using LIRC or using the native kernel supported modules. To work properly with xbmc, a file will be required that maps the lirc events to xbmc keypresses. Create an XML file at ~/.xbmc/userdata/Lircmap.xml (note the capital 'L').

Note: Users running xbmc from the included service file will find the xbmc home (~) under /var/lib/xbmc and should substitute this in for the shortcut above. Also make sure that if creating this file as the root user, it gets proper ownership as xbmc:xbmc when finished.

Lircmap.xml format is as follows:

  <remote device="devicename">
  • Device Name is whatever LIRC calls the remote. This is set using the Name directive in lircd.conf and can be viewed by running $ irw and pressing a few buttons on the remote. IRW will report the name of the button pressed and the name of the remote will appear on the end of the line.
  • XBMC_button is the name of the button as defined in keymap.xml.
  • LIRC_button is the name as defined in lircd.conf. If lircd.conf was autogenerated using # irrecord, these are the names selected for the buttons. Refer back to LIRC for more information.
  • A very thorough Lircmap.xml page over at the XBMC Wiki should be consulted for more help and information on this subject as this is out of scope of this article.

MCE remote with Lirc and Systemd

Install lirc-utils and link the mce config:

# ln -s /usr/share/lirc/mceusb/lircd.conf.mceusb /etc/lirc/lircd.conf

Then, make sure the remote is using the lirc protocol:

$ cat /sys/class/rc/rc0/protocols

If not, issue:

# echo lirc > /sys/class/rc/rc0/protocols

A udev rule can be added to make lirc the default. A write rule does not seem to work, so a simple RUN command can be executed instead.

KERNEL=="rc*", SUBSYSTEM=="rc", ATTR{protocols}=="*lirc*", RUN+="/bin/sh -c 'echo lirc > $sys$devpath/protocols'"
Note: If this does not work, follow the suggestion to use tmpfiles.d as specified in the LIRC wiki to set the remote to the lirc protocol at boot time.

Next, specify the lirc device. This varies with kernel version. As of 3.6.1 /dev/lirc0 should work with the default driver.

# Parameters for lirc daemon


The default service file for lirc ignores this conf file. So we need to create a custom one.

Description=Linux Infrared Remote Control

ExecStartPre=/usr/bin/ln -sf /run/lirc/lircd /dev/lircd
ExecStartPre=/usr/bin/ln -sf /dev/lirc0 /dev/lirc
ExecStart=/usr/sbin/lircd --pidfile=/run/lirc/lircd.pid --device=${LIRC_DEVICE} --driver=${LIRC_DRIVER}


Finally, enable and start the lirc service:

# systemctl enable lirc
# systemctl start lirc

This should give a fully working mce remote.

Fullscreen mode stretches XBMC across multiple displays

For a multi-monitor setup, XBMC may default to stretching across all screens. One can restrict the fullscreen mode to one display by setting the environment variable SDL_VIDEO_FULLSCREEN_HEAD to the number of the desired target display. For example, having xbmc show up on display 0, add the following line to the xbmc user's Bashrc:

Note: Mouse cursor will be held inside screen with XBMC.

Slowing down CD/DVD drive speed

The eject program from the util-linux package does a nice job for this, but its setting is cleared as soon as the media is changed.

This udev-rule reduces the speed permanently:

KERNEL=="sr0", ACTION=="change", ENV{DISK_MEDIA_CHANGE}=="1", RUN+="/usr/bin/eject -x 2 /dev/sr0"

Replace sr0 with the device name of your optical drive. Replace -x 2 with -x 4 if you prefer 4x-speed instead of 2x-speed.

After creating the file, reload the udev rules with

# udevadm control --reload

See also

  • XBMC Wiki - Excellent resource with much information about Arch Linux specifically