Kodi Community Forum

Full Version: running xbmc as session
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
For those of you who want to run XBMC so it autoloads without a desktop manager here's a simple solution. I did this on Ubuntu hardy heron using the gnome login so slight modifications might be necessary to get it going on a different setup.

I used gksudo and nautilus to do this all from the gui because my linux is really rusty and I've found it works really nicely. For those that don't know how to do this. You might have to install gksu first. Then hit Alt-F2 and type gksudo nautilus then enter your password. This will run nautilus as root allowing you to do all of this.

Step 1: Create Load script:
This is only necessary if you want to use projectM. Create a new file in /usr/bin/ named loadxbmc (right click and select Create Document / New File). Then open it and paste in the following code:
export XBMC_HOME=/usr/share/xbmc
Save it and close it. Then set the file as executable (right click / select Properties / select the Permissions tab / click the Allow executing file as program check box)

Step 2: Create Session type:
Go to /usr/share/xsessions/ I just copied the GNOME launcher here and renamed it to XBMC. The I right clicked and selected properties. Then on the launcher tab I changed the Command field to: /usr/bin/loadxbmc and the Comment field to This session logs you into XBMC.

Step 3: Create a new account.
Go to System / Administration / Users and Groups. Hit the unlock button and enter your password. Now hit Add User. Enter in a user name I used xbmc and a real name I used XBMC then enter a password. If you want click on user privileges and set them how you choose. When your done click OK and then Close.

Step 4: Login to the new xbmc account and configure
Now login to xbmc and set xbmc to run fullscreen. Then go to System / Administration / Login Window click the Security tab. Check enable automatic login and choose the xbmc account. Then click Close.

Step 5: Logout and set the session type for xbmc.
Logout and from the login screen set the session type for the xbmc account to XBMC and login when it asks tell it to make it the default session.

Now when you turn the macine on it will boot into X and autologin to the xbmc account which is running xbmc instead of gnome. When you shutdown XBMC you mare taken out to the login screen where you can login as another user or change the session type for the xbmc account for maintenance. Now if only xbmc had two different shutdowns one to exit the program which would be a logoff and one to shutdown the machine then the box could function as just a media center with no need to use a mouse or keyboard, and still have a fully working gnome setup available when you want it.
If anyone here knows how to add a logout option to the shutdown menu and set it to exit xbmc and then change the shutdown options to shut down the whole system could they please post it here. I found the latter in another post and I might add it here later but without the logout option I'm not sure I want to do it.
Logout option is just shutdown XBMC if nothing but xbmc is running then it will shut it down and take you back to the login screen ( if you have it running )
But nare in mind xbmc has its own user system so daddy can hide his porn from the kiddies and thats what the logout button is for
actually i was referring to modifying the project meyhem skin so when you open the shutdown menu you have an option to log out which would log you out of your session and an option to shutdown which would shut down the whole system and an option to logout of your xbmc user as well. That way the box could function as a simple htpc without you ever having to see linux from boot to shutdown unless you chose to log out of your session specifically which would drop you to a linux login screen.
export PATH=/usr/bin:/usr/local/bin
export HOME=/
export XBMC_HOME=/home/jeff/XBMC/BUILD
/usr/bin/X11/xinit /home/jeff/XBMC/BUILD/xbmc.bin -q &
xset -dpms &
xset s off &
irexec -d /root/.lircrc &

I have this script in my init.d and call it from rc2.d - Obviously, I don't have kdm/gdm running.

For shutdown/reboot I depend on .lircrc

Quote:# Reboot System
prog = irexec
button = DVD
config = /usr/local/bin/Reboot.sh

# Shutdown System
prog = irexec
button = RecTV
config = /usr/local/bin/Shutdown.sh
Running xbmc as root is a pretty bad idea...
Ordinarily, I'd agree, but here it's running as a standalone HTPC, not browsing the net. Where's the harm?