Search This Blog

Wednesday, September 29, 2010

Solution to XBMC idle hanging problem

As per this thread on the XBMC forums, I was for a long time having problems with XBMC hanging when idle.  On average about once a day for the last 6 months - very very annoying.  And no solution - until now!

The solution is to work around the buggy smb mounting code in XBMC that creates these hangs and also, in general, doesn't play so nicely with Windows 7 shares.  Instead, we use 'autofs' to mount the shares locally into a mount point within the XBMCLive Ubuntu outside of XBMC itself - this way the shares appear to XBMC as local folders, and the hangs disappear!

Here's the solution:

In a terminal (e.g. a putty connection), you must:

Create an entry in /etc/hosts for your server

eg.

192.168.1.51 homeserver

Then:
sudo apt-get install smbclient
sudo apt-get install smbfs
sudo apt-get install

(this installs the appropriate packages for automounting shares)

Add to /etc/auto.master

Code:

/smb    /etc/auto.smb --timeout=60


Create /etc/auto.smb.yourservername

Code:

username=yourusername
password=yourpassword


Restart autofs

Code:

sudo service autofs restart


Your shares can now be accessed via /smb/yourservername/...

(That is, to list them, you need to 'ls  /smb/youservername/' - if you just 'ls /smb/' you won't see the shares as they are mounted on demand!)

You must also remove ANY references to your old smb shares in XBMC.

Goto the folder: /home/#XBMCUSER/.xbmc/userdata, Edit sources.xml
Remove any source that has "smb://" in it. In my case I did a replace of smb://#USER@..../ to /mnt/share/.... since I've mounted all my shares on my box.

Then edit passwords.xml
Remove your smb passwords

Last edit mediasources.xml
And also remove the share there.

This solution completely eliminates the hangs.  It is needed for Dharma as well as the hanging issue remains as of Beta2 for Dharma.


Another nice thing about this solution is that browsing to shares seem quicker in general this way.

7 comments:

  1. You just browse for the source as it's local - should be right there...

    ReplyDelete
  2. Have you confirmed you actually have autofs installed and running? You need it to be running, the config files alone aren't enough. autofs doesn't come by default with XBMCLive.

    ReplyDelete
  3. I managed to configure the above and I can see the shared from my server. Only when I try to open the share I receive the message: "No such file or directory".

    I addition of above I did install autofs as well and the shares are visible. Even after service restart or server reboot, no luck.

    I tried the above on XBMC-Live Beta 4, as the idle hanging problem still remains in this version.

    ReplyDelete
  4. Nice tip. In my experience seem to reduce the xbmc (dharma rc2 installed on debian sid) latency on big directories. Sadly the tip doesn't remove completely this latency that it's a bit annoying

    @Kwa-Si-Mo if u still experiencing problems please take a look at http://www.howtoforge.com/accessing_windows_or_samba_shares_using_autofs

    ReplyDelete
  5. Seemed to have "somewhat" similar issues as @Kwa-Si-Mo. I just can't see anything on the machine with the shares. Autofs is installed. I posted a thread over at XBMC forums to help me with the issue:

    http://forum.xbmc.org/showthread.php?t=89513

    ReplyDelete
  6. I need some additional help to make this work because I get No such file or directory if I use the ls /smb/GYULA-PC/Anime command to test.

    Some troubleshoot maybe hepls

    you wrote :

    Create an entry in /etc/hosts for your server

    eg.

    192.168.1.51 homeserver

    Can this be any ip address or a specific one ? If yes how do I determine mine ? I've used the one that the cmd ipconfig gave me ( Local area Connection ipv4 address)

    -----------------

    you also wrote

    Create /etc/auto.smb.yourservername

    Code:

    username=yourusername
    password=yourpassword

    I've created /etc/auto.smb.GYULA-PC

    and wrote the admin and pass i'm using for logging in at my main PC where the shares are

    -------------------------

    I've edited the sources.xml too

    until now it looked like that :

    Videos
    /home/xbmc/Videos/


    TV Shows
    smb://GYULA-PC/TV Shows/


    and after replacing smb://GYULA-PC to mnt/share it looks like that :


    Videos
    /home/xbmc/Videos/


    TV Shows
    mnt/share/TV Shows/


    Where is the problem Dear Sir ?

    ReplyDelete
  7. Not sure - what can you see under /mnt/smb/ ?

    You might be best off taking this to the XBMC forum as I no longer use Live, I use openelec, which works differently (and much easier).

    ReplyDelete

Note: Only a member of this blog may post a comment.