XBMCbuntu Ubuntu 10.04 Howto

For the past couple of years I have been experimenting with a variety of different Media Center distributions for my media PC. I’ve played with Boxee, Moovidia, MythTV, XBMC and LinuxMCE. Since I’m from Canada, Boxee wouldn’t work to its full extent, I don’t have a tuner card, so most of MythTV’s power was lost on me and LinuxMCE seemed like it was dieing at the time. After struggling with the performance (or lack there of) of Moovidia on my old hardware, I eventually settled on XBMC.

I’ve been happy using XMBC for the past year or so and its made some good steps, especially with the release of v. 10 (code name Dharma). It was almost getting to the point where it could play 1080p video without skipping half the frames. Unfortunately I made the mistake of trying to upgrade my distribution to Ubuntu 10.10 (Maverick Meerkat), which apparently breaks my legacy embedded Intel graphics.

Despite several hours of googling I couldn’t get past the errors with the intel driver, namely:

(EE) intel(0): [drm] failed to set drm interface version.
(EE) intel(0): Failed to become DRM master.
DRM\_IOCTL\_I915\_GEM\_APERTURE failed: Bad file descriptor
(EE) intel(0): failed to get resources: Bad file descriptor
(EE) intel(0): Kernel modesetting setup failed

So I’ve decided to roll back (AKA: Wipe and re-install) Ubuntu 10.04.

This time around, rather than doing a desktop install of Ubuntu, I’ve decided to do a stream-lined XBMC-Live installation, but with a few changes to use 10.04, and pull in updated drivers for my intel chipset.

System Hardware

First Thing’s First, this is what my system hardware looks like. Basically a low-end machine from around 2004-2005


00:00.0 Host bridge: Intel Corporation 82845G/GL[Brookdale-G]/GE/PE DRAM Controller/Host-Hub Interface (rev 01)
00:02.0 VGA compatible controller: Intel Corporation 82845G/GL[Brookdale-G]/GE Chipset Integrated Graphics Device (rev 01)
00:1d.0 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #1 (rev 01)
00:1d.1 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #2 (rev 01)
00:1d.2 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #3 (rev 01)
00:1d.7 USB Controller: Intel Corporation 82801DB/DBM (ICH4/ICH4-M) USB2 EHCI Controller (rev 01)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev 81)
00:1f.0 ISA bridge: Intel Corporation 82801DB/DBL (ICH4/ICH4-L) LPC Interface Bridge (rev 01)
00:1f.1 IDE interface: Intel Corporation 82801DB (ICH4) IDE Controller (rev 01)
00:1f.3 SMBus: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) SMBus Controller (rev 01)
00:1f.5 Multimedia audio controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Audio Controller (rev 01)
01:00.0 Mass storage controller: Promise Technology, Inc. PDC40775 (SATA 300 TX2plus) (rev 02)
01:08.0 Ethernet controller: Intel Corporation 82801DB PRO/100 VE (LOM) Ethernet Controller (rev 81)

According to the guide, I was going to start with an Ubuntu Server distribution then install X, followed by XBMC. I wanted to save time on the download, so i opted for the Ubuntu Minimal Install CD and downloaded the 32 bit Ubuntu 10.04 “Lucid Lynx” Minimal CD. I then created a bootable USB Key using unetbootin.

Installing Ubuntu Base System

Booting from USB is a challenge for my system – for some reason it just wont do it. Fortunately, since I still have GRUB installed from my broken version of Ubuntu, I can tell grub to boot off of usb:

  1. Plug the USB key into the computer after loading Ubuntu Minimal on it using unetbootin, and reboot the system

  2. Press Escape when Grub first loads to enter into the grub boot loader

  3. Press “c” to enter the Grub Command Line

  4. Now its a matter of determining what root the USB key is. The easiest way to do this is to type root then hit tab. This will list the available roots. I had something like fd0 fd1 hd1 hd2 hd3

    • Unplug the USB key, and hit tab again. One of the devices should have disappeared. This device is the USB key (Mine was fd0)

    • Enter the following, substituting fd0 for your device name.

      root (fd0)
      chainloader +1
    • You should now be presented with the Ubuntu Minimal Install Menu

I allowed for many of the default options when installing Ubuntu. I created a username (that wasnt xbmc – that comes later), as the default user for the system. When it came time to select the software I wanted installed, I selected:

  • Basic Ubuntu Server
  • OpenSSH Server
  • Samba File Server

Xorg Setup

Taken partially from here

sudo add-apt-repository ppa:ubuntu-x-swat/x-updates
sudo apt-get update
sudo apt-get install xinit x11-xserver-utils

Enable modesetting for the i915 driver (You will need to reboot for this to take effect)

echo "options i915 modeset=1" >> /etc/modprobe.d/i915-kms.conf

Edit the Xorg configuration file at /etc/X11/xorg.conf.

Note that your BusID may differ. Comment it out to have it automatically detected.

Section "Device"
Identifier  "Configured Video Device"
Driver      "intel"
Option      "AccelMethod"           "uxa"
Option      "EXAOptimizeMigration"      "true"
Option      "MigrationHeuristic"        "greedy"
Option      "Tiling"            "false"
BusID           "PCI:00:02:00"

Section "Monitor"
Identifier  "Configured Monitor"

Section "Screen"
Identifier  "Default Screen"
Monitor     "Configured Monitor"
Device      "Configured Video Device"

XBMC Setup

I will be using the stable XMBC PPA’s on my system. Don’t forget to install the add-apt-repository tool by installing pkg-config.

For me, the multiverse repos were enabled by default (XMBC needs libfaad0 from them). If this isn’t the case for you, modify /etc/apt/sources.lst to enable multiverse.

sudo apt-get install python-software-properties pkg-config
sudo add-apt-repository ppa:team-xbmc
sudo apt-get update
sudo apt-get install xbmc

Add the XBMC User, and add it to the groups

sudo adduser xbmc --gecos XBMC
sudo usermod --group audio,video,fuse,cdrom,plugdev xbmc

Install XBMC-live for automated startup

sudo apt-get install xbmc-live

Logout, then login using the XBMC account, and test start xbmc by running:

xinit xbmc-standalone

Install Alsa

Install Alsa to get sound, run alsamixer to change the volumes as they are all initially zero. Then save the values from alsamixer.

sudo apt-get install linux-sound-base alsa-base alsa-utils
sudo alsamixer
#unmute PCM, Master and increase the volume
sudo alsactl store 0

Mount Additional Drives

I have several drives on my system used for storing video formatted using jfs. By adding these entries to /etc/fstab they will be automatically mounted

/dev/sdb1       /mnt/s320a      jfs     auto,noatime            0       2
/dev/sdc1       /mnt/s320b      jfs     auto,noatime            0       2
/dev/sdd1       /mnt/s500       jfs     auto,noatime            0       2

auto means that the drive will be automatically mounted, noatime turns off file access time, and the “2” means that the file will be scanned by fsck on startup. This last option is useful for jfs as they get cranky if they aren’t unmounted properly.

Mount NFS Share

I have one nfs drive shared over the network that I would like to mount:

sudo apt-get install nfs-common

Add another entry to fstab to mount the /mnt/s200 share on the nfs server to /mnt/s200 on the xbmc box:

nfs-server:/mnt/s200    /mnt/s200  nfs     _netdev,auto    0       0

Grant XBMC User Power Management Permissions

sudo apt-get install acpid #install acpid to allow shutdown from power button
sudo polkit-auth --user xbmc --grant org.freedesktop.hal.power-management.suspend
sudo polkit-auth --user xbmc --grant org.freedesktop.hal.power-management.hibernate
sudo polkit-auth --user xbmc --grant org.freedesktop.hal.power-management.reboot
sudo polkit-auth --user xbmc --grant org.freedesktop.hal.power-management.shutdown
sudo polkit-auth --user xbmc --grant org.freedesktop.hal.power-management.reboot-multiple-sessions
sudo polkit-auth --user xbmc --grant org.freedesktop.hal.power-management.shutdown-multiple-sessions

Setup Samba

I use samba to easily transfer files from my windows machine onto my media center.

Samba should be already installed as we selected it during the Ubuntu installation, so all we have to do is setup the configuration file.

vim /etc/samba/smb.conf

Modify the security setting in smb.conf to set per-share security (which we will leave wide open).

security = share

I’m not too worried about security, so I’ve made some very liberal shares:

comment = XBMC Files
path = /mnt/s320a
read only = no
writeable = yes
hosts allow =
create mask = 0777
guest ok = yes

comment = Xbmc Files
path = /mnt/s320b
writeable = yes
read only = no
create mask = 0777
guest ok = yes

comment = Xbmc Files
path = /mnt/s500
writeable = yes
read only = no
create mask = 0777
guest ok = yes

path = /mnt/yellowface.remote
writeable = yes
read only = no
create mask = 0777
guest ok = yes

Add samba to system startup

update-rc.d smbd defaults 20 21

Additional XBMC Customizations:

ATI Remote Wonder Setup
Disable Windowed Mode