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 Grammar Nazi. You can stalk him on the Interwebs via Google+, Facebook and follow his ass on Twitter @ocmodshop.