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

  Thread Rating:
  • 5 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
onderduiker Offline
Junior Member
Posts: 13
Joined: Sep 2008
Reputation: 0
Post: #16
tomsun Wrote:Or just go to session, and make a new entry. Browse to the binary. And it will start when you login or have autologin

--
/t

mmm, did that, but xbmc starts always in a minimized window in the upper left corner ??
find quote
covert Offline
Junior Member
Posts: 25
Joined: Mar 2004
Reputation: 0
Post: #17
onderduiker Wrote:mmm, did that, but xbmc starts always in a minimized window in the upper left corner ??

In XBMC..
Settings, Appearance, Screen, Resolution ZxY(Full Screen)

where YxZ is your screen res.
find quote
onderduiker Offline
Junior Member
Posts: 13
Joined: Sep 2008
Reputation: 0
Post: #18
Allready did that, but still the same problem.
I looked to the other HOW TO (without the desktop) and that works great for me.
.....but thanks for your answer.
find quote
pefdus Offline
Junior Member
Posts: 10
Joined: Apr 2008
Reputation: 0
Post: #19
Chaos_666 Wrote: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

I am going to explain this by an indepth example as it will help people understand what is occuring.

What we are going to achieve is xbmc will "restart" when it quits, and the X session will stay running.

In the excellent HOWTO provided in this thread, you find that the .xinitrc file will be executed when Xorg (via startx) begins.

Code:
#!/bin/bash
exec /usr/bin/xbmc --standalone

.. and when xbmc "quits", your xsession quits and you are dropped back to the console.

This occurs because startx "runs" the .xinitrc and when that "process" or the spawned controlling process finishes, startx finishes also.

So the idea is that we will keep the "process" running, so that startx never quits back to the console.

So to show the "chain of events"
Code:
mingetty
  --> logs in
        --> bash executes
             --> .bashrc runs
                   startx executes .xinitrc and runs until .xinitrc quits*

* we say when .xinitrc quits, but the control process (what startx is waiting for to finish) can be 'passed' to another command via 'exec <command>'

The manual entry for bash explains exec as follows
Quote:exec
... it replaces the shell without creating a new process ...

Given the following sample shell script
Code:
#!/bin/sh

echo command1
exec echo command2
echo command3

You will see the following output
Code:
rbuckland@itasca:~$ sh test
command1
command2

Simply put, the 3rd command never runs because 'exec echo command2' executes and takes control of the shell process.
Going back to the sample in this thread,

Code:
#!/bin/bash
exec /usr/bin/xbmc --standalone

the exec is passing the "control" to xbmc. Now remeber, when the controlling process run by startx finishes, startx finishes.
The trick is two fold,
(1) Keep the control in the .xinitrc
(2) Get .xinitrc to restart xbmc when it quits.

Under normal circumstances, the X session is tied to the "executing process" which has control, normally this is the window manager. In the example directly above, the exec passes control to xbmc.

If we change the above .xinitrc to look like the following ...
Code:
#!/bin/bash
/usr/bin/xbmc --standalone

... then the control is kept with .xinitrc, solving our step (1) .
The exec is no longer there, which means that after xbmc quits, control returns to the .xinitrc script.

Now for part (2). What we will do is get .xinitrc to keep xbmc running, even after it quits, by restarting it.

*The Answer*
To do this simply change the script so it runs xbmc in a loop...

Code:
#!/bin/bash
while [ 1 ]
do
  /usr/bin/xbmc --standalone
done

Now, each time xbmc quits, .xinitrc will relaunch it.
If you need to stop this (for some reason), just ssh into your box from somewhere (or grab a console) and kill the .xinitrc, or the startx script and the "login" will drop out of X.

cheers.
find quote
Chaos_666 Offline
Senior Member
Posts: 147
Joined: Sep 2008
Reputation: 11
Location: Germany
Post: #20
Hi there,
thanks for the answer in detail.

Maybe i did not explain my goal clearly.

So i wanted to know if there is a possibility to shut the system down if xbmc quits?!

THX
Chaos
find quote
zerobravo Offline
Junior Member
Posts: 1
Joined: Oct 2008
Reputation: 0
Post: #21
This is excellent work. Thanks!

I am running ubuntu hardy 8.04.1

I would like to be able to select at grub to either autostart and run xbmc as an appliance (as detailed here) or to use ubuntu and run gdm (as normal).

Is this possible?....currently doing my own research, but any help would be appreciated.
find quote
topfs2 Offline
Team-Kodi Developer
Posts: 4,251
Joined: Dec 2007
Reputation: 15
Post: #22
One way, is to have XBMC Live on a USB thumbdrive and run a reconfigure of grub so it detects XBMC Live then it should be selectable.
Otherwise you would have to do it yourself via another ubuntu install on same HDD or another.

Cheers,
Tobias

If you have problems please read this before posting

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.

[Image: badge.gif]

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
find quote
twood Offline
Junior Member
Posts: 10
Joined: Oct 2008
Reputation: 0
Post: #23
Thank you guys for these excellent guides.
Anyone has a solution to powedown or suspend the system when quit from xbmc standalone?
find quote
topfs2 Offline
Team-Kodi Developer
Posts: 4,251
Joined: Dec 2007
Reputation: 15
Post: #24
twood Wrote:Thank you guys for these excellent guides.
Anyone has a solution to powedown or suspend the system when quit from xbmc standalone?

Just choose which action you want to trigger in Settings -> System
XBMC Live (xbmc --standalone) will default to Shutdown of system.

Usually Suspend is rather hard to get going if you have a Nvidia or ATI due to bad drivers. Intel works rather good for me.

Cheers,
Tobias

If you have problems please read this before posting

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.

[Image: badge.gif]

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
find quote
Chaos_666 Offline
Senior Member
Posts: 147
Joined: Sep 2008
Reputation: 11
Location: Germany
Post: #25
Hi there
Topfs2 Wrote:Just choose which action you want to trigger in Settings -> System
XBMC Live (xbmc --standalone) will default to Shutdown of system.

Usually Suspend is rather hard to get going if you have a Nvidia or ATI due to bad drivers. Intel works rather good for me.

Cheers,
Tobias

Guess twood is not using XBMC Live.
He ran into the same problem i mentioned above.

Hopefully someone has a solution for that, as it is nearly the last annoying thing on my HTPC

THX
Chaos
find quote
twood Offline
Junior Member
Posts: 10
Joined: Oct 2008
Reputation: 0
Post: #26
Chaos_666 Wrote:Hi there


Guess twood is not using XBMC Live.
He ran into the same problem i mentioned above.

Hopefully someone has a solution for that, as it is nearly the last annoying thing on my HTPC

THX
Chaos

Yes I'm not running Live, I have ubuntu 8.04 installed and I followed the guide to make it start directly to XBMC standalone.
Unfortunatelly when choosing the option to shutdown, the system will not do anything no matter what my settings are (shutdown/suspend). If i choose to restart XBMC it will just drop to the console.
There is a away to perform a normal restart as already decribed here in this thread, but the thing is that I would love to be able to shutdown XBMC running in standalone mode.
find quote
topfs2 Offline
Team-Kodi Developer
Posts: 4,251
Joined: Dec 2007
Reputation: 15
Post: #27
twood Wrote:Yes I'm not running Live, I have ubuntu 8.04 installed and I followed the guide to make it start directly to XBMC standalone.
Unfortunatelly when choosing the option to shutdown, the system will not do anything no matter what my settings are (shutdown/suspend). If i choose to restart XBMC it will just drop to the console.
There is a away to perform a normal restart as already decribed here in this thread, but the thing is that I would love to be able to shutdown XBMC running in standalone mode.

Sounds like dbus is failing for you. Could you provide a debug log.
If you start with xbmc --standalone (as the guide suggest?)
Then it should shutdown, do you have anything printed to console?

Cheers,
Tobias.

If you have problems please read this before posting

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.

[Image: badge.gif]

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
find quote
ohickmott Offline
Junior Member
Posts: 1
Joined: Oct 2008
Reputation: 0
Post: #28
Hi there,

I am a very new linux user but have been using OS X for some time so have a brief insight to using terminal etc.

MrCerulean instructions are fantastic and work like a treat however I am trying to use a Belkin pci wireless card to network this machine and the only way I seem to be able to get this running is by using the ndiswrapper to utilize the windows drivers under gnome.

Is anybody aware of a way to use the standalone method of booting into XBMC without gnome running and still be able to use wireless networking?

Any help is much appreciated!

Cheers
Olly
find quote
twood Offline
Junior Member
Posts: 10
Joined: Oct 2008
Reputation: 0
Post: #29
Topfs2 Wrote:Sounds like dbus is failing for you. Could you provide a debug log.
If you start with xbmc --standalone (as the guide suggest?)
Then it should shutdown, do you have anything printed to console?

Cheers,
Tobias.

Well here is my debug log.
http://pastebin.com/mc61aae3
There is indeed an error message coming from dbus.
00:08:34 T:3053426560 M:1750196224 ERROR: DBus: org.freedesktop.DBus.Error.AccessDenied - A security policy in place prevents this sender from sending this message to this recipient, see message bus configuration file (rejected message had interface "org.freedesktop.Hal.Device.SystemPowerManagement" member "Suspend" error name "(unset)" destination "org.freedesktop.Hal")

My xbmc version is atlantis beta 2 installed from PPA.
Any ideas? Thank you
(This post was last modified: 2008-10-29 00:26 by twood.)
find quote
Chaos_666 Offline
Senior Member
Posts: 147
Joined: Sep 2008
Reputation: 11
Location: Germany
Post: #30
Hi there,
same problem here:
Code:
23:33:11 T:3067770720 M:1057349632   DEBUG: OnMessage : Translating XBMC.ShutDown()
23:33:11 T:3067770720 M:1057349632   DEBUG: OnMessage : To XBMC.ShutDown()
23:33:11 T:3067770720 M:1057177600   ERROR: DBus: org.freedesktop.Hal.Device.PermissionDeniedByPolicy - org.freedesktop.hal.power-management.shutdown no <-- (action, result)
23:33:12 T:3067770720 M:1057161216   DEBUG: ------------------- GUI_MSG_WINDOW_DEINIT
23:33:12 T:3067770720 M:1057161216   DEBUG:
23:33:12 T:3067770720 M:1057161216   DEBUG: -------------------

THX 4 your help
Chaos
find quote
Post Reply