Autostart XBMC at boot

75,086

Solution 1

Run:

gedit ~/.config/autostart/xbmc.desktop

write in file

[Desktop Entry]
Type=Application
Exec=xbmc -d 5 --standalone -fs
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_En]=xbmc
Name=xbmc
Comment[en_En]=
Comment=

save file and restart system.

XBMC will start with five second delay, in standalone mode and full screen mode.

Solution 2

A better option is to make XBMC your session. You won't get into unity etc, so it's all a bit cleaner.

  1. if you auto-log in, then logout of your current session.
  2. on the log-in screen, press the ubuntu logo next to your name
  3. choose 'XBMC'
  4. log in.

This makes XBMC go all fullscreen when you (auto?) log in.

Solution 3

I had a small issue getting it to run automatically too, doing the same thing. My issue was that it would not start full screen, even when passing it the -fs argument. As Bruno Pereira has suggested, using the XBMC session works great. Click the little Ubuntu symbol next to your username when you log in and select XBMC. If you have set your computer to auto-login, you will have to log out to do this. Then when you want to do something on your computer not XBMC related, simply log off, and log back in, changing the session back to Ubuntu.

The other option, which may work for you is to create a small script like this:

#!/bin/bash
/bin/sleep 5
/usr/bin/xbmc -fs

Save this somewhere as xbmcstartscript.sh, then use

chmod +x xbmcstartscript.sh

to make it executable. Now use that script for your startup application, instead of pointing directly to XBMC.

Apparently there is some sort of conflict/race condition where XBMC will try to start up before Unity is done loading, so you need to wait a few seconds before opening XBMC.

Solution 4

Are you using encrypted home directories? If so, the autologin features, and the scripts above + elsewhere, didn't work for me on 14.04 (one of them created a nasty loop which left me unable to login locally; thankfully I could get terminal access through webmin).

Anyway, what did work for me was unencrypting the home directories per the instructions here (modified slightly as I found some bits unclear):

(1) Login to an administrator account.

(2) Open a terminal window and backup your home directory/ies - you will need to do this for all users on the system, as this process removes encryption for everyone. Change 'user' below to the names of your users.

sudo cp -rp /home/user /home/user.backup

(3) Check there are no errors in the copy process; there shouldn't be, but you are about to delete the original, so worth making sure.

(4) Delete your home directory/ies:

rm -rf /home/user

(5) Remove the encryption packages

sudo apt-get remove ecryptfs-utils libecryptfs0

(6) Restore your home directory

sudo mv /home/user.backup /home/user

(7) Reboot The original instructions suggested removing any .Private .ecryptfs folders; I didn't have to do this, but you may.

rm -rf ~/.Private rm -rf ~/.ecryptfs

(8) Because I'd already set the user account I wanted to autologin in the system / users panel, when I rebooted it logged straight in.

(9) If you then open the Dash (click the ubuntu symbol in the top left) and search for "startup applications" per the answer above, I had success just calling "kodi".

Share:
75,086

Related videos on Youtube

Garry Pettet
Author by

Garry Pettet

I'm a former UK radiologist who now works full time as a web, desktop and iOS developer.

Updated on September 18, 2022

Comments

  • Garry Pettet
    Garry Pettet almost 2 years

    I'm running Ubuntu 12.10 desktop 64-bit. I've installed the latest version of XBMC (Eden). Everything seems to be working great.

    The only small issue I'm running into is that I can't figure out how to make XBMC launch automatically on boot/restart. In the 'Startup Applications Preferences' dialog in Ubuntu I have added a new launcher with the command

    /usr/bin/xbmc
    

    and ticked the checkbox next to it. When I restart though XBMC doesn't launch. I know this is the correct path because I ran

    which xbmc
    

    in the Terminal to confirm it.

    Am I doing something really stupid here? How come XBMC won't launch automatically? It works fine if I click its icon in the dock.

    Many thanks,

    • Garry Pettet
      Garry Pettet over 11 years
      I don't understand what you mean by this (sorry - new to Linux)
    • GaryP
      GaryP almost 11 years
      @BrunoPereira I did the method you mentioned but I think my xbmc session does not have permission rights. I can't open the existing files. But It works fine when just using the auto start application feature of Ubuntu
    • Bruno Pereira
      Bruno Pereira almost 11 years
      Then you need to adjust your permissions on your files, I would say...
  • Garry Pettet
    Garry Pettet over 11 years
    The script didn't work for me. I'll try the session option this evening when I get home. Will I be able to VNC the login screen once I log out (that's how I control the PC)?
  • reverendj1
    reverendj1 over 11 years
    I don't use VNC anymore but if I recall correctly, by default, VNC only runs when logged in. This may help to run it as a daemon, so you can still connect to it while at the login screen, askubuntu.com/questions/83824/….
  • ImaginaryRobots
    ImaginaryRobots over 11 years
    'gedit' would automatically create the file, so the 'touch' command is not necessary (especially since it had a typo). I removed it.
  • Tinellus
    Tinellus over 10 years
    Thanks, worked for me too. On question though: the file disappeared from .config/autostart directory... Is this normal?
  • jcollum
    jcollum almost 3 years
    Ubuntu 20: this doesn't appear to work anymore. No surprise, it's an 8 year old answer. But it's one of the top google hits.