How to Connect XBMC Linux to Synology Diskstation NAS

XBMC-Synology-poster

One of the most appliance-like installations of the XBMC Media Center is when it is installed on Linux.    One problem you may face with an XBMC Linux installation (or appliance running XBMC like the Pivos Xios, hacked Apple TV or Raspberry Pi) is connecting to and scraping your media that resides on a Networked Attached Storage Device.

XBMC Linux may not connect to Windows (aka Samba) shares easily, and may even produce an error.  Sure, you can connect to your media via UPnP, but you won’t be able to populate your Movie and TV Show metadata, as XBMC’s internal scrapers do not support it.

So if Samba is out and UPnP is out, then the only way to get all of your media’s metadata populated (scraped) is to connect to your Synology NAS via NFS (Network File System).  Even if you have enabled this on your Diskstation, you may have noticed that XBMC will still not connect to it when you add media.  You have to do a little tweak to your Diskstation to get XBMC (and some other appliances) to work.

Overview: We have to set up an NFS share on the Synology Diskstation.  Then we have to use a terminal to edit a file, and to do that we have to enable SSH access.

1. First, log in to your Synology control panel and enable SSH.  Open the Control Panel, click on the Terminal icon, and then click “Enable SSH service“.

2. Then return to the Control Panel and click on the Win/Mac/NFS icon.  Click on the NFS Service tab and click the checkbox labeled “Enable NFS“.  Click OK.

3. Now we have to enable the new NFS privileges on the shares you want to connect to.  Return to the Control Panel and click the “Shared Folder” icon.

Now click on the “NFS Privileges” button.  In the new subwindow, click “Create“.  Now in the new NFS Rule tab, enter the settings in the screenshot below.  Then click OK.

4. Now the NFS privileges have been applied to your shares, but there’s still one tweak before XBMC will be able to connect to them.  You have to use a terminal emulator (such as PuTTY) to connect to your Diskstation and expose a command line.

Fire up PuTTY and enter the IP address of your Diskstation.  Make sure the Port is 22!

Once you get a “login as” prompt, enter “root”.  The password is the same as the admin password you used to login to the Control Panel.

5. Type “cat /etc/exports” to verify the exported NFS directories.  If nothing is there, then go back to Step 2.

6. Now we have to edit the exports file.  I personally like to use the Nano editor, which uses commands similar to Word to save and exit.  Unfortunately Nano wasn’t included with the Diskstation, so we have to use VI, which requires you to press escape to “pause” your text editing and issue cryptic commands.  Argh.

Type vi /etc/exports and change all of the “insecure_locks” entries to read “insecure”.

VI is a really counter-intuitive text editor.  Press the INSERT key on your keyboard, use the arrow keys to go to the line and press the delete key to remove the “_locks” part of “insecure_locks”.

When you are done, press the ESC key on your keyboard, which lets you send commands to the VI editor.  Type :x and you will “Save and Exit”.  It’s ironic how the command to save and exit is the same emoticon used to express my enthusiasm for vi.

Type cat /etc/exports again and you should see your changes.  If not, edit the file again.  I won’t berate you this time.  Vi sucks.

7. Type exportfs -ra to initialize the directories, or you can reboot your Diskstation if you have five minutes to kill.

You can now go into XBMC and add new media.  When doing so, use the “NFS” method, and you should see your Diskstation’s IP address magically appear!  Add your sources as normal, and all of your media center’s fancy scrapers will be able to gather metadata.

The process is a little more involved on QNAP NASes, but the thing you’re doing is the same: changing “insecure_locks” to “insecure”.  On QNAP devices you not only have to edit the file but enter it into the bootup scripts so it is enabled every time.  The details are in a forthcoming article, so stay tuned XBMC Linux fans!

Alan is a web architect, stand-up comedian, and your friendly neighborhood English Nazi. You can stalk him on the Interwebs via Google+, Facebook and follow his ass on Twitter @ocmodshop.

7 Comments

  1. Matt

    April 25, 2014 at 5:41 pm

    "5. Type /cat/etc/exports to verify the exported NFS directories. If nothing is there, then go back to Step 2 and learn to follow directions."

    When being a patronising know-it-all make sure you're right first!

    In step 5 "/cat/etc/exports" should be "cat /etc/exports" otherwise there's "nothing there"

    M :o)>

    • ocmodshop

      May 27, 2014 at 9:29 am

      Sometimes I get a little loopy when writing. People who know me personally think I'm a jerk, too. Thanks for the tip!

  2. nvnsuresh

    October 12, 2013 at 10:21 pm

    perfect.. probably the best online help i ever received..

  3. Maph

    October 1, 2013 at 10:55 pm

    Lol. Step #5 is my favorite. In the process of building an XBMC/linux box (well… just ordered) to stream from my Synology, and ran across your post while browsing on the subject. I just had to chime in because … well. I'm as thoroughly confused by nano as you are by vi…. (the one true text editor. Lol)
    <esc>:%s/(insecure)_locks/1/
    (which is equivalent to:)
    <esc>:%s/insecure_locks/insecure/
    :x
    should one-line replace all your insecure_locks with insecure throughout the entire file (%=global s=search /searchstring/replacestring/)

  4. hobo_beans

    July 1, 2013 at 11:44 pm

    凸ಠ益ಠ)凸
    This is how I feel about vi

    THANK YOU KIND SIR/MA'AM
    I owe you some btc or something, you've saved me from having a stroke tonight. I've spent hours in the past few days trying to downgrade my eye phone and get my jailbreak back with no luck.

    Then my cool new raspberry pi xbmc box wouldn't cooperate with my synology ds212j. More hours spent in frustration!

    Found your post and after 15 minutes of swearing at vi everything is golden.

    Thank you for being so smart.

  5. Dougie

    June 28, 2013 at 4:37 pm

    You are a genius, thanks mate!

  6. pego

    May 16, 2013 at 1:17 pm

    Thanks! Editing the exports to insecure actually helped.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>