XBMC Auto Start on Ubuntu

Posted by {"display_name"=>"greg", "login"=>"greg", "email"=>"greg@udon.org", "url"=>""} on November 05, 2013 · 2 mins read

These instructions are based on the XBMC install page instructions.

Create the file /etc/init/xbmc.conf as described on the install page and make sure you change the USER to your default Ubuntu user id.

sudo vi /etc/init/xbmc.conf

Paste this text in the file but change the user from xbmc to your Ubuntu user id:

# xbmc-upstart
# starts XBMC on startup by using xinit.
# by default runs as xbmc, to change edit below.
env USER=xbmc

description     "XBMC-barebones-upstart-script"
author          "Matt Filetto"

start on (filesystem and stopped udevtrigger)
stop on runlevel [016]

# tell upstart to respawn the process if abnormal exit
respawn

script
  exec su -c "xinit /usr/bin/xbmc --standalone -- -nocursor :0" $USER
end script

Edit the file /etc/X11/Xwrapper.conf and replace the last line with

allowed_users=anybody

Reboot your Ubuntu system and XBMC should startup by automatically.

.Xauthority Issue

After setting the Xwrapper.conf allowed_users parameter I encountered a flashing error message on the screen as described here. I renamed the ~/.Xauthority file to ~/.Xauthority.bak

Mount External Drives

If you have external USB drives that store media for XBMC, you may need to insure that these drives are mounted before XBMC starts. Martin's Ubuntu Blog post on this subject describes in more detail the following steps to do this:

First run the mount command and look for your USB drive will show up if it has been automatically mounted. Normally, it will be mounted under the /media directory. Here's what mine looks like:

/dev/sdb1 on /media/1TB type fuseblk (rw,nosuid,nodev)

Now make a backup of your /etc/fstab.

sudo cp /etc/fstab /etc/fstab.bak

Then open the /etc/fstab file and insert a like like this based upon the results of your mount command:

/dev/sdb1 /media/1TB auto auto,user,rw,exec 0 0