0

I have tried but failed to find proper information about xinit, in order to understand why it is that when boot into Unity and then start an application (xbmc) all is well, but when I try to use a /etc/init script for auto starting the same program, I get no sound. (I have previously asked a more general question about my 'no sound' problem, but since I have not received any answer yet, I am trying to do some detective work on my own.)

As far as I can understand, the script (here in full) basically changes user into USER and then starts the program (xbmc):

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

Anyone willing and able to explain to me what my possibilities are for controlling the sound when booting 'directly' into a program like this? Can I go in via a virtual terminal, ssh or what have you, and check what is going on? All advice (including how to further clarify the question, if need be) appreciated.

EDIT: I am guessing that a potential source of the problem might be if the script runs too soon in the startup process, so that the program starts before the sound card is initialised or something.

In that case, this part of the full script might be relevant for my problem:

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

But I do not know how to check if this might be the cause.

2
  • 1
    I need to ask you something. If you add console owner to the Upstart job, then change the allowed_users= setting for X.Org back to console, does it still work alright? Sep 20, 2014 at 3:39
  • Thanks for your help, but I was not sure how to follow this piece of advice, and since I have figured out something that at least works (if not the most beautiful of solutions), I will probably stick to that. Much appreciate your effort in trying to help me, though! Sep 22, 2014 at 20:31

2 Answers 2

0

Try to have something along the lines of:

start on stopped rc RUNLEVEL=[2345]
stop on starting rc RUNLEVEL=[016]

That is the rough equivalent of $all in LSB init scripts. If it really is an ordering problem, then this will probably fix it.

But first, set the xbmc job to "manual" then start it after the boot is over to see if it is an ordering issue (if you still get no sound then the start and stop on are fine).

1
  • Thank you, but when I change the script this way it does not start at all, I am afraid. Since I asked the question, I have found a 'workaround' which I explain in the added 'answer' I added here. Sep 22, 2014 at 20:03
0

I have found a workaround which solves the problem for me, in the sense that it:

  1. allows me to autostart in xbmc
  2. restarts xbmc if the program crashes
  3. it fully functioning: there is sound and the video is working perfectly.

What I chose to do was to auto-start Ubuntu into my 'xbmc' user the 'normal' GUI way by selecting the option in Unity. Then, I added a process monitor script to respawn the program for me.

Here is how: Following this answer, I added a the following script to the home directory of user 'xbmc', naming it 'process_monitor.sh':

#!/bin/bash

if [[ -z "$1" ]];then
    echo "ERROR: must specify program"
    exit 1
fi

while (( 0 == 0 ));do
    $@ &
    pid=`jobs -l | awk '{print $2}'`
    wait $pid
done

After making the script executable by

chmod a+x ~/process_monitor.sh

I added the following line in "Startup applications" for user 'xbmc' (accessed through Dash or, in 12.04 at least, the top right bar):

/bin/bash ~/process_monitor.sh /usr/bin/xbmc

This way, I can now auto-start in xbmc with perfect sound and video functionality, and then have the monitor script make sure that xbmc respawns when it crashes. Perhaps not the most beautiful of solutions, but it works!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .