Kodi Community Forum

Full Version: XBMCbuntu delay start of XBMC?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
I have an ION/Atom unit setup as a bedroom HTPC, connecting wirelessly and running XBMCbuntu (xvba-testing ppa). I use a shared MYSQL database.

Since this unit is wireless, it appears that XBMC is starting before the network connection is established, which causes the MySQL settings to fail. If I exit XBMC and restart XBMC the database information shows up correctly.

I know that Openelec has an option to 'Wait for the network before starting XBMC' (at least it has it in the nightlies I tested on the Raspberry Pi), is there an easy way to implement such a feature using XBMCbuntu?
something like this should work, but I didn't test it:

Code:
--- /etc/init/lightdm.conf    2013-05-17 00:14:13.000000000 +0200
+++ lightdm.conf    2013-09-12 09:38:42.000000000 +0200
@@ -11,7 +11,11 @@
start on ((filesystem
            and runlevel [!06]
            and started dbus
-           and plymouth-ready)
+           and plymouth-ready
+           and (starting network-interface
+                or starting network-manager
+                or starting networking)
+          )
           or runlevel PREVLEVEL=S)

stop on runlevel [016]
I looked into your option and found similar responses on the web, but I do not have a lightdm.conf in /etc/init ... I did have one in /etc/lightdm ... but it only had [SeatDefaults] in it. I could not find anything that had the 'start on' conditions in it.

I did find a solution though... I edited /usr/bin/xbmc-standalone and added a 'sleep 20' at the top.... this seems to have resolved my issue.

As I mentioned, Openelec has this setting.. any chance of seeing it natively in XBMC? ... I would think it would be useful for wireless devices.
if you run Xbmcbuntu, then you MUST have a /etc/init/lightdm.conf

edit: OE uses completely different methods to start xbmc. And it is not up to xbmc itself to do that, its on the OS level.
(2013-09-13, 10:34)wsnipex Wrote: [ -> ]if you run Xbmcbuntu, then you MUST have a /etc/init/lightdm.conf

edit: OE uses completely different methods to start xbmc. And it is not up to xbmc itself to do that, its on the OS level.

I just realized my mistake. Stupid me was looking in /etc/init.d ... sorry.

I will try your solution tonight.
I tried your solution, but only ended up with the XBMC splash screen... the light on the WIFI adapter never started blinking, and ctrl-alt-F(x) only resulted in a blinking cursor... I tried rebooting a few times, and left it as long as a half hour, but it never got past that point... so I just reloaded the unit.

It seems as if the WIFI adapter is not initialized until after LightDM starts.... any other suggestions?
I had a similar problem with the system booting too fast on its SSD disk. The XBMC script was loading so fast, that the GFX MXM chip hadn't loaded its drivers.

From another thread on this forum it was suggested to put a delay in the etc/init/xbmcbuntu.conf script. I have mine configured like this:

Code:
# xbmcbuntu
#
# init XBMCbuntu environment
#

#      Copyright (C) 2005-2011 Team XBMC
#      http://www.xbmc.org
#
#  This Program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2, or (at your option)
#  any later version.
#
#  This Program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with XBMC; see the file COPYING.  If not, write to
#  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#  http://www.gnu.org/copyleft/gpl.html

description     "XBMCbuntu"
author          "Luigi Capriotti"

# The script is started by the xbmcbuntu-wait job

script
    sleep 5
    kernelParams=$(cat /proc/cmdline)
    subString=${kernelParams##*xbmc=}
    xbmcParams=${subString%% *}

    xbmcUser=xbmc
    # Read configuration variable file if it is present
    [ -r /etc/default/xbmcbuntu ] && . /etc/default/xbmcbuntu
    if ! getent passwd $xbmcUser >/dev/null; then
        xbmcUser=$(getent passwd 1000 | sed -e 's/\:.*//')
        echo "xbmcUser=$xbmcUser" >> /etc/default/xbmcbuntu
    fi

    if ! grep "firstTimeInit=done" /etc/default/xbmcbuntu ; then
        SETUPHOOKSDIRECTORY="/etc/xbmc/setup.d"

        # Executes setup hooks (if any)
        if [ -d $SETUPHOOKSDIRECTORY ]; then
          for hook in $(find $SETUPHOOKSDIRECTORY -type f -perm /u=x,g=x,o=x | sort)
          do
            $hook $xbmcUser $xbmcParams || true
          done
        fi
    fi

    BOOTHOOKSDIRECTORY="/etc/xbmc/live.d"

    # Executes boot hooks (if any)
    if [ -d $BOOTHOOKSDIRECTORY ]; then
      for hook in $(find $BOOTHOOKSDIRECTORY -type f -perm /u=x,g=x,o=x | sort)
      do
        $hook $xbmcUser $xbmcParams || true
      done
    fi

    if ! grep "firstTimeInit=done" /etc/default/xbmcbuntu ; then
            echo "firstTimeInit=done" >> /etc/default/xbmcbuntu || true
    fi
end script

Just add the "sleep 5", which will force XBMC to wait for 5 seconds before continuing with the rest in the script.

Don't know if it'll work for you, but worth a try
(2013-09-25, 21:49)daemon9th Wrote: [ -> ]I had a similar problem with the system booting too fast on its SSD disk. The XBMC script was loading so fast, that the GFX MXM chip hadn't loaded its drivers.

From another thread on this forum it was suggested to put a delay in the etc/init/xbmcbuntu.conf script. I have mine configured like this:

Just add the "sleep 5", which will force XBMC to wait for 5 seconds before continuing with the rest in the script.

Don't know if it'll work for you, but worth a try

As I said earlier, I added a 'sleep 20' directly into /usr/bin/xbmc-standalone. The problem with that is if you update xbmc, you lose the change and need to redo it. Your idea may work a bit better.
I had exactly the same problem on XBMCbuntu. Then I installed TVHeadend and now when I boot the linux boots in a second or 2 and then I have a blank screen for like 10 seconds. then XBMC starts and the library is there. it seems to wait for the network and/or the TV Receiver. Is there any way to check this and improve the time? I find it sad that I finally have a PC thatboots as quick as a VCR and then I have to wait for 30 seconds for a network connection - mine is cable btw.
The options wsnipex named is the correct way of doing it. It makes the lightdm process which starts xbmc wait until network is available.
I changed the lightdm.conf like wsnipex suggested but now I get the terminal login when I but the system

Code:
# LightDM - light Display Manager
#
# The display manager service manages the X servers running on the
# system, providing login and auto-login services
#
# based on gdm upstart script

description    "LightDM Display Manager"
author        "Robert Ancell <[email protected]>"

start on ((filesystem
           and runlevel [!06]
           and started dbus
           and plymouth-ready)
       and plymouth-ready
           and (starting network-interface
                or starting network-manager
                or starting networking)
      )
          or runlevel PREVLEVEL=S)

stop on runlevel [016]

emits login-session-start
emits desktop-session-start
emits desktop-shutdown

script
    if [ -n "$UPSTART_EVENTS" ]
    then
        # Check kernel command-line for inhibitors, unless we are being called
        # manually
        for ARG in $(cat /proc/cmdline); do
            if [ "$ARG" = "text" ]; then
        plymouth quit || :
                stop
        exit 0
            fi
        done

    [ ! -f /etc/X11/default-display-manager -o "$(cat /etc/X11/default-display-manager 2>/dev/null)" = "/usr/bin/lightdm" -o "$(cat /etc/X11/default-display-manager 2>/dev/null)" = "/usr/sbin/lightdm" ] || { stop; exit 0; }

    if [ "$RUNLEVEL" = S -o "$RUNLEVEL" = 1 ]
    then
        # Single-user mode
        plymouth quit || :
        exit 0
    fi
    fi

    exec lightdm
end script

post-start script
    sleep 5
    clear > /dev/tty7
end script

post-stop script
    clear > /dev/tty7
    sleep 1
    if [ "$UPSTART_STOP_EVENTS" = runlevel ]; then
        initctl emit desktop-shutdown
    fi
end script

What did I do wrong?
You have got the line...

and plymouth-ready)

...twice. Remove the line containing the bracket, keep the other one, retry...
Code:
start on ((filesystem
           and runlevel [!06]
           and started dbus
           and plymouth-ready
           and (starting network-interface
                or starting network-manager
                or starting networking)
      )
          or runlevel PREVLEVEL=S)

Like M4tt0 said.
I tried that, and it had the same result Sad
Logfiles or it never happed. Also be more pricese concerning "same".

and pastebint your edited config.
Pages: 1 2 3