Geek Freely: Installing Subsonic Server on NAS4Free (embedded)

    Featured Post

    The whole point in this post is to run your own VPN service, and allow you to connect remote devices to your home network.

    To start off yo…

    Firstly, I have to say I cannot take all the credit for this… I got a lot of information from , who in turn got it from NAS4Free wiki.

    However, I did find some problems along the way, and as usual I want to keep it somewhere I can get easy access to in future – this blog.  Please also note, this will solve any m4a and flac transcoding issues, and possibly other codecs.

    The whole process relies on you setting up a jail in NAS4Free so that the changes are not lost on reboot (since this is an embedded guide).

    Lets start of with configuring NAS4Free to complete this task:

    SSH into your NAS4Free box using putty or similar. NOTE: Change all reference to /mnt/data to the mountpoint on your NAS where you are going to store the jail.

    The base system has to be downloaded to make sure you get all

    the necessary binaries, config files and scripts. To download it you can

    just copy paste the following commands into the ssh shell.

    The last command for fetching lib32 is not needed if you are running NAS4Free on an 32bit system.  The following two commands extract the base system into the proto folder inside the jail.

    NOTE: Obviously exchange EST for

    your own time=zone. Next we will configure the mounts that the jail is

    going to be able to access.

    NOTE: Change DataDisk1 for the mounts that you have on the NAS

    that you want to be accessible in the jail.

    Copy into the fstab file the following lines:

    /mnt/data/DataDisk1 /jail/proto/mnt/DataDisk1 nullfs rw 0 0

    The drive is mounted read write for playlist, comments, ratings, podcast access from Subsonic.

    The next part of the

    configuration is to create the rc.conf file.

    Copy into the rc.conf.local the following lines:

    jail_enable=”YES” # enable jails YES|NO

    jail_list=”proto” # name of the jails to start “proto www…”

    jail_proto_rootdir=”/jail/proto” # path to our jail

    jail_proto_hostname=”proto” # hostname

    jail_proto_ip=”″ # ip of the jail, replace with a ip in the same subsystem as your NAS

    jail_proto_interface=”re0″ # Network Interface to use, replace with your NAS interface name

    jail_proto_devfs_enable=”YES” # use devfs

    jail_proto_mount_enable=”YES” # mount YES|NO

    jail_proto_fstab=”/jail/conf/fstab.proto” # File with Filesystems to mount

    Copy into jail_start the following lines:

    #!/bin/tcsh -x

    #mounting to /jail

    mkdir /jail

    mount_nullfs /mnt/data/jail /jail

    # copy jail binaries to /usr, not needed if N4F is 454 or up

    # because Daoyama include needed files, uncomment if you use low .454 version

    # cp -r /jail/conf/root/ /

    # link config files to /etc

    ln -s /jail/conf/rc.conf.local /etc

    #start all jails

    /etc/rc.d/jail start

    Make the start-up script executable with the following command:

    And to make it run each time the NAS server is started, add the following via the webgui under System|Advanced|Command Scripts.

    Command: /mnt/data/jail/conf/jail_start

    Type: PostInit

    Save and apply, and reboot your server. After a successful reboot check your new jail via SSH using the jls command, you should see something like this:

    JID             IP Address                   Hostname                      Path

    1                   proto                              /jail/proto

    And that’s how you setup a FreeBSD jail on NAS4Free embedded.

    Enter the jail with the following command (based on the output of example jls above we use 1):

    The pkg_add command doesn’t function

    properly inside the jail. To fix this you have to run the following

    command NOTE: I am using a 64-bit install:

    Now start installing the packages required by


    Now install libmp3lame so that ffmpeg can use it for transcoding:

    Now compile and install your own ffmpeg with libmp3lame enabled, (remember –enable-libmp3lame during make config):

    Create the folders and download/extract subsonic standalone.

    Enter the following

    command while you are still inside the jail to see if subsonic starts.

    If subsonic started as it should you can connect to it via the

    browser at the following adress: Jail-IP:4040, default username is

    admin, and password admin.

    To make it run each time the NAS server is started add via the webgui under: System|Advanced|Command Scripts.

    Command: jexec 1 /var/subsonic/standalone/

    Type: PostInit

    Save and apply, and reboot your server. After a successful reboot you can check your Subsonic install via http://Jail-IP:4040

    If your Subsonic installation has problems with the audio (the java

    install couldn’t see your audio dev) install

    alsa-plugins via the following command:


    And if you want to access your new service on your android device, why not try out the official

    (4/17/2013 Updated for Subsonic 4.8)

    (5/10/2013 Updated based on fsbruva’s comments



    Thank you for this guide. I’ve installed MADSONIC – Mashup Mod (a fork of subsonic) 4.8 in my N40L microserver with nas4free.BTW, jail’s FreeBSD system base directory is ‘proto’ in this guide, right? So it needs to be changed the extraction destination from ‘plugin’ to ‘proto’ in this guide. (e.g. tar xvf /jail/work/base.txz -C /jail/plugins/ –> tar xvf /jail/work/base.txz -C /jail/proto/ )Due to directly compiled ffmpeg(it needed very long time for me), file conversion (Flac,ogg etc. to mp3) is perfect. Thank you again for explanation in detail, and sorry for my poor english. Best regards from Korea.


    Hi,Awesome post, hoping I can get it fully working.Just hit a minor snag.

    For some reason the embedded USB partition reckons it’s fully.But I’m sure with this guide all the files get install via /mnt/data/###so the embedded boot partition shouldn’t have got effected at all.Any ideas?CheersMichael


    Hi Michael,Indeed you do create the Jail on a mnt, but the data is copied to the embedded system when it is run – so it is possible you don’t have space.I would recommend you back up, reinstall nas4free, giving it plenty of space on the USB for further jails, then reload your configuration.


    Thanks for the guide! I’m totally new to this and setting up the jail took a couple of times before i got it working. But now i’m having trouble with the “pkg_add -v -r xtrans” and all the other ones stating (Error: Unable to get No address recordpkg_add: unable to fetch ‘’ by URLpkg_add: 1 package addition(s) failed)Please help?


    Never mind just downloaded the files with IDM copied them with the help of WinSCP to the root@proto, then i did this “setenv PACKAGESITE /jail/proto/” and than continued with the guide.


    Hi Richard De Winkel,Sorry you were having issues with this, I checked the FTP site directly and the file exists, I am not sure what happened, but I am glad you worked around the issue.Hope the guide went well for you!


    I’m getting a weird responce from subsonic “No media folders found” what ever i do its telling me this i got my media files at “/mnt/Media/A2Z/” and can’t figure out whats wrong i followed the guide to the letter including “DataDisk1”.Am i missing something?


    Hi,Thank you very much for this tutorial. I have almost no clue about what all this means but i managed to get very far with the installation.

    Jail is up and running,everything seems to be ok up to “compile your own ffmpeg”..That is where I’ve been stuck for the last 8hours.. Make install clean does a lot of stuff (takes about 2 hours) and then stops.. these are the last lines:====> Compressing man pages (compress-man)===>

    Building package for cmake-modules- package /usr/ports/devel/cmake-modules/work/cmake-modules- depends:.pkg_create: find_play_pen: can’t find enough temporary space to extract the files, please set yourPKG_TMPDIR environment variable to a location with at least 0 bytesfree*** [do-package] Error code 1Stop in /usr/ports/devel/cmake-modules.*** [run-depends] Error code 1Stop in /usr/ports/devel/cmake.*** [build-depends] Error code 1Stop in /usr/ports/graphics/opencv-core.*** [lib-depends] Error code 1Stop in /usr/ports/multimedia/ffmpeg.*** [install] Error code 1Stop in /usr/ports/multimedia/ffmpeg.root@proto:/usr/ports/multimedia/ffmpeg #Can you please tell me what to do as i’m slowly getting to the end of the rope.Regards,Claudiu


    Hi again,I solved this problem.. The USB didn’t have enough space.

    My jail is located on the same usb as the Nas4Free and the usb thumb drive was just too small. I replaced it with a bigger one and now the jail is working and the subsonic is ok.I can access the subsonic web page without any problem.However when trying to set up the media folders i get the message “Folder not found”.My config is: USB drive with Nas4Free and the jail and 2 x HDD in a ZFS pool with the Music and Movies datasets. The datasets are automatically mounted in the root of the USB thumb drive, still Subsonic can not see themI read in the subsonic forum that subsonic can not read mapped drives and that i would have to “Use UNC paths – not mapped drives and be sure that the subsonic service has logon permissions that have permission to access the shares.” …Can someone please explain what that means in noob language ?RegardsClaudiu


    Just a small update.. I started from scratch. Installed TheBrig – that makes a breeze to create jails and manage them.Then installed subsonic inside a jail on the USB and it is working great.Happy camper now:) USB with Nas4Free and Jails on the same USB, Subsonic and UMS both working from their jails.Cheers for the great ideas in this blog and to all those who made it possible that a complete newb managed to do all the above in less then 3 days.Regards,Claudiu


    I am so sorry I missed your request for help, but pleased you managed to resolve your issues.

    Thanks for letting us know.

    Subscribe to:


    Blog Archive


    Leave a Reply

    Your email address will not be published.