Forum
[PROBLEM] MySQL Connection On Boot - Printable Version

+- Forum (http://forum.xbian.org)
+-- Forum: Software (/forum-6.html)
+--- Forum: Configuration (/forum-17.html)
+--- Thread: [PROBLEM] MySQL Connection On Boot (/thread-423.html)



MySQL Connection On Boot - Swiss - 9th Feb, 2013 08:47 PM

Morning All,

I'll start with this as a configuration query rather than a bug as is more likely to simply be I've done something wrong Undecided

Setup:
1x D-Link Share-Centre NAS
1x Debian Server Running MySQL
1x Windows 7 Ultimate PC
2x Raspberry Pi Model B 512Mb

Media is on the NAS
XBMC database is on the Debian Server Setup From Here
Raspberry Pi are both running XBian Alpha 4 + Frodo 12 Update From Here
XBMC 12.0 Git:20130127-fb595f2 is the current version on all Devices

Firstly and probably a little strange, everything work perfectly. All devices share the database, I can updated it from my PC and the PIs just work.

However the PIs always need a kick when powered on or rebooted because they cant find the MySQL DB (Log Below)
To get the PIs working all I need to to is SSH in and run /etc/init.d/xbmc restart and boom all is good in my world, however this is just a little irritating Big Grin

Initial thought was, ok it's not waiting for the network...
Updated /etc/init.d/xbmc
Modified
Terminal
# Required-Start: bootlocal
To
Terminal
# Required-Start: bootlocal $network $named $remote_fs
And
Terminal
# Required-Start: $all
Run update-rc.d accordingly - no change

Tweaked /etc/init.d/xbmc
Terminal
### END INIT INFO

sleep 10

DESC=XBMC
Now my Pi boots, twiddles its fingers for a few moments, carries on and everything is good.

Obviously this isn't the best solution because when I come to do the next update I will have completely forgotten about this and it will all implode again. Is there a blatantly obvious setting that I'm missing to handle this ??

------------------ XMBC Log From Boot Up------------------------
Log Details


RE: MySQL Connection On Boot - CurlyMo - 9th Feb, 2013 09:14 PM

First of all, please post your logs on pastebin as stated in our forum rules.

Quote:Than copy the whole text from screen to clipboard. Upload the file on the services like http://pastebin.com/ and post the link in your post/thread.
Do NOT post the raw text file from log directly on the forum! The log has a lot of lines of text and if this would be posted directly in your post/thread it makes it difficult to read/search your post through all the lines.

Second, bootlocal is already depends on $all so no need to change the dependency of XBMC.

I'm also running my xbmc with an external mysql library and it just works out of the box. Does your debian machine go to sleep or something?


RE: MySQL Connection On Boot - bacobart - 9th Feb, 2013 09:46 PM

I think xbmc's just having trouble resolving 'cdnsvr02' to an ip address, maybe xbmc starts before the dns server can be reached. Try adding cdnsvr02 to /etc/hosts with the fixed ip address and see if that helps, or reconfigure the advancedsettings.xml to use the ip instead of the hostname.


RE: MySQL Connection On Boot - Swiss - 20th Feb, 2013 05:23 AM

Firstly - apologies on the Log, edited and dealt with.

None of my Debian servers, nor the ESX that hosts them sleep.
It's not a DNS issue as I get the same error if i change the xbmc config to the MySQL Server IP Address instead.

Done some more digging and it's defiantly underlying network that's the cause, although still highly likely that I'm to blame Tongue

Additional Setup Info
Debian server CDNSVR01 handles, among other things, DHCP & DNS via dnsmasq.

If I tail syslog on the CDNSVR01 the entries for the PI requesting it's DHCP lease occur after XBMC has already loaded. Add the delay back in and DCHP completes before XBMC loads.

So my next logical question is...
If XBMC has a dependency for bootlocal, bootlocal depends on $all and $all includes $network $named & $remote_fs why is XBMC loading before the network has finished starting up ?

Sorry if the answers really obvious, but I've only recently started playing Linux based OS so I'm still finding my feet.

Cheers,
Swiss.


RE: MySQL Connection On Boot - connorpb - 15th May, 2013 03:54 PM

I'd like to add that I have the same problem that Swiss did - not sure if you've solved it Swiss, but if you did I'd love to hear how!

Same deal - Xbian starts without network activity, can't connect to the MySQL database, logs show network connectivity after connection errors by timestamp. SSH restart of XBMC resolves the issue, as the network connection has established by then.

Of note, my Pi is wireless - could the wifi networking not be accounted for in the boot dependencies?


RE: MySQL Connection On Boot - mk01 - 19th May, 2013 08:55 AM

swiss you have cable connected or wifi ?