Linux HOW-TO make XBMC for Linux auto start on Ubuntu

  Thread Rating:
  • 5 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
MrCerulean Offline
Junior Member
Posts: 4
Joined: Oct 2008
Reputation: 0
Thumbs Up  HOW-TO make XBMC for Linux auto start on Ubuntu Post: #1
I built a media centre PC specifically to run XBMC on Linux. I'm using the PPA's on Hardy Heron (8.04). Since this box is only going to run XBMC, I thought I'd get it to power up, log in and fire up XBMC automatically.

Keep in mind that these steps are for Ubuntu. Other distro's may differ.

Login as the user who installed XBMC. I find it easier to do all this from my laptop, ssh'd in to the XBMC box.

Using your favourite editor, create a file in your home directory called .xinitrc that contains the following:
Code:
#!/bin/bash
exec /usr/bin/xbmc --standalone

Make .xinitrc executable:
Code:
chmod +x .xinitrc

Edit your .bashrc and add the following as the last line:
Code:
startx

Install rcconf:
Code:
sudo apt-get install rcconf

Run rcconf and turn off gdm:
Code:
sudo rcconf

Install mingetty:
Code:
sudo apt-get install mingetty

Edit /etc/events.d/tty1:
Code:
sudo vi /etc/events.d/tty1

Change the line:
Code:
exec /sbin/getty 38400 tty1
to read:
Code:
exec /sbin/mingetty --autologin uname tty1
where uname is the user who installed XBMC.

Reboot to test.

With this setup, you're not loading gdm or gnome. You're not loading a window manager. The load will be lighter and the boot process will be faster.

Please let me know if there are any questions! Thanks to AlTheKiller for some pointers.
(This post was last modified: 2013-01-11 14:58 by zag.)
find quote
malloc Offline
Team-XBMC Developer
Posts: 1,062
Joined: May 2004
Reputation: 0
Post: #2
great howto. this would be great in the wiki. ask pike for ninja status if you'd like to contribute it and you need write access.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
find quote
althekiller Offline
Team-XBMC Developer
Posts: 4,701
Joined: May 2004
Reputation: 12
Post: #3
Looks good. I would however edit .bash_login instead of .bashrc and/or wrap launching startx with an "if x`pidof X` = ''x" ; then startx; fi" (or similar) to stop launching multiple instances if you open an xterm or login another tty.
find quote
QuietTime Offline
Junior Member
Posts: 15
Joined: Mar 2008
Reputation: 0
Post: #4
Forgive me for being a linux noob, but where should the first file you create (.xinitrc) be located?
find quote
MrCerulean Offline
Junior Member
Posts: 4
Joined: Oct 2008
Reputation: 0
Post: #5
The .xinitrc file should be in your home directory. I'll clarify that...
find quote
proctor Offline
Senior Member
Posts: 113
Joined: Aug 2008
Reputation: 0
Post: #6
Anyone know what to check to find out why I lose my sound when I set XBMC to autostart? The sound works if i go back to gdm.
find quote
MrCerulean Offline
Junior Member
Posts: 4
Joined: Oct 2008
Reputation: 0
Post: #7
Try renaming your .xinitrc to off.xinitrc (mv .xinitrc off.xinitrc). Reboot the system. You should wind up in a terminal logged in as your XBMC user. Run alsamixer and see if all the sound points are turned on.

To restore XBMC startup, mv off.xinitrc .xinitrc and reboot again.
find quote
covert Offline
Junior Member
Posts: 25
Joined: Mar 2004
Reputation: 0
Post: #8
My Ubuntu auto logs me in (mythbuntu). This is the default file that starts MythTV. Easy to change it to start XBMC..

~/.config/autostart/mythtv.desktop
Code:
[Desktop Entry]
Name=MythTV Frontend
Comment=A frontend for all content on a mythtv-backend
GenericName=MythTV Viewer
Exec=mythfrontend --service
Type=Application
Encoding=UTF-8
Icon=/usr/share/mythtv/themes/blue/myth_tv_logo.png
Categories=GNOME;Application;AudioVideo;Audio;Video
X-AppInstall-Package=mythtv
find quote
Chaos_666 Offline
Senior Member
Posts: 147
Joined: Sep 2008
Reputation: 11
Location: Germany
Post: #9
Hi there
Great Howto, thats exactly how i solved this problem, before there was this howto.

But what happens if you press the Off Button on the remote or shuts it down via menu?
Here it quits xbmc but stays in X?!

Anyone knows a solution for that?

THX
Chaos
find quote
proctor Offline
Senior Member
Posts: 113
Joined: Aug 2008
Reputation: 0
Post: #10
MrCerulean Wrote:Try renaming your .xinitrc to off.xinitrc (mv .xinitrc off.xinitrc). Reboot the system. You should wind up in a terminal logged in as your XBMC user. Run alsamixer and see if all the sound points are turned on.

To restore XBMC startup, mv off.xinitrc .xinitrc and reboot again.

Thanks, I booted to terminal and found out that my user 'xbmc' was not a member of the 'audio' group.

I did: sudo adduser xbmc audio

Restarted and everything works as advertised.
find quote
Post Reply