Serviio 0.6 package for Synology NAS with Web UI

Serviio-package-with-webUI

The Serviio Web UI, styled to look like the regular DSM control panel widgets

 

UPDATE – This is no longer the most recent package. I have released a new version and created a new blog post to keep the comments on topic.

My guide for installing Petr Nejedly’s excellent Serviio 0.5.2 on Synology has been a very popular post, and many people have got it running. However, the process is still complex enough to deter a lot of people and, as I learned more about my Synology NAS, I realised that I could automate the whole thing. The biggest obstacle was creating a package for Java, but adding locale support to the syno Linux also proved difficult.

The PHP Web UI is now included which you can use to manage Serviio once it’s installed. I have tried to fix most of the localization issues with it, and have edited the CSS to give it the look and feel of DSM as much as I could. You could also use Serviio Remote Console from another computer if you prefer. Any online content plugins (ending in .groovy) that are found in your NAS ‘public’ share will also be installed into Serviio’s plugins folder automatically during installation.

The package will allow future upgrades while preserving the media database and the online plugins, as long as Serviio itself is ok with that. You can see Serviio’s log by clicking More in the Package Centre. DSM Package Center installs the application to /volume1/@appstore/Serviio though from what I understand, on multi-volume systems the user is prompted for a destination volume. If you need to edit device profiles, add online content plugins, or look at the log in detail that’s where you’ll find the files. Bear in mind that a NAS, even an Intel Atom powered one, is unlikely to have sufficient CPU power to manage realtime video transcoding (e.g. from DivX to MPEG2), though it will manage remuxing MKV to M2TS and realtime audio transcoding.

 

Download

If you have DSM 3.2, you can install directly from Package Center. In Settings -> Package Sources add my package repository URL which is http://packages.pcloadletter.co.uk

If you’re still on DSM 3.1, download one of the following packages. Right-click, Save As:

Serviio uses some open source libraries without which it would not have been possible.
By downloading the software on this page you are agreeing to the terms of the original Serviio End User Licence Agreement.
I accept no liability for any damage that may occur to your data or your cat’s health as a result of using this software :) The scripts are shown in full below, so you are free to assess any risks yourself.

 

Instructions

This package can be installed on an unmodified NAS – no hacking is required. It has been tested on DSM 3.1 and DSM 3.2. Here’s what you need to do:

  • In the DSM User control panel enable the User Home service
  • In the DSM Web Services control panel enable Web Station
  • Using the DSM Package Center install my Java SE for Embedded Synology package
  • Download any online content plugins that you require and leave the .groovy file for each in your NAS’s public shared folder
  • Determine your NAS’s CPU type, and install the appropriate Serviio Synology package from the download link above
  • Give it some time to start (click More Info in Package Center to see the Log tab – check it has loaded all the renderer profiles), then you can use the Serviio icon in the DSM drop down menu in the top-right to launch the Web UI. This Serviio icon will only be visible to admin users in DSM
  • To use the Serviio Remote Console from a Windows PC edit ServiioConsole.exe.vmoptions in the Serviio folder and add the line: -Dserviio.remoteHost=192.168.x.x (replace with your NAS’s IP address). It can take a minute or so to start – this is normal. For details on how to configure the Remote Console on other operating systems refer to the Serviio FAQ. It seems that the first time Serviio starts with a blank database the Remote Console will get stuck showing the message “Serviio is updating its Media Library”. If that happens wait a couple of minutes, stop and restart Serviio via the Package Center. Give it another couple of minutes then the remote console should work fine.
  • Once the console is up, disable ‘Generate thumbnails for local videos’, and set the ‘Transcoded files location’ to /volume1/@tmp. Don’t forget to use the Users control panel in DSM to grant permission for the Serviio user to read your files (if they’re not in the public share)
  • When you add folders to your library you need to use the ‘Add path…’ button (not ‘Add local…’) and give the full Linux path (e.g. /volume1/share-name/Movies). There are issues with the Add Local ajax file browser which mean that it doesn’t work properly even if you give PHP access to the filesystem root
 

The DSM main drop-down menu, showing the Serviio Web UI icon

 

Upgrading from 0.5.2

If you want to upgrade from a manually installed 0.5.2, you will need to follow the steps below. I was considering automating it, but it gets complicated trying to remove people’s edits from /etc/profile which may not be entirely consistent.

  • Stop the Serviio 0.5.2 daemon by running: /opt/etc/init.d/S99serviio.sh stop
  • Copy your media database somewhere safe: cp -R /opt/serviio/library/db /volume1/public
  • Follow the uninstallation steps at the bottom of my original guide
  • Install my Java Synology package
  • Install the Serviio Synology package from the download link above but don’t start it yet
  • Copy your saved database into position: cp -R /volume1/public/db /volume1/@appstore/Serviio/library (warning – for people with multiple volumes, the @appstore folder is not always on /volume1 apparently)
  • Force ownership on database files: chown -R serviio /volume1/@appstore/Serviio/library
  • Force ownership on transcode cache: chown -R serviio /volume1/@tmp/Serviio
  • Start Serviio in the DSM Package Center
  • Follow the rest of the settings guidelines from above
 

Package scripts

For info, here are the scripts inside the package. The security-conscious among you can untar the package and take a look at the contents for yourself.

preinst

#!/bin/sh

#--------SERVIIO preinstall script
#--------package maintained at pcloadletter.co.uk

source /etc/profile

if [ -z ${JAVA_HOME} ]; then
        echo "Java is not installed or not properly configured. JAVA_HOME is not defined. " > $SYNOPKG_TEMP_LOGFILE
        echo "Download and install the Java Synology package from http://wp.me/pVshC-z5" >> $SYNOPKG_TEMP_LOGFILE
        exit 1
fi

if [ ! -f ${JAVA_HOME}/bin/java ]; then
        echo "Java is not installed or not properly configured. The Java binary could not be located. " > $SYNOPKG_TEMP_LOGFILE
        echo "Download and install the Java Synology package from http://wp.me/pVshC-z5" >> $SYNOPKG_TEMP_LOGFILE
        exit 1
fi

exit 0
 

postinst

#!/bin/sh

#--------SERVIIO postinstall script
#--------package maintained at pcloadletter.co.uk

#create serviio daemon user
synouser --add serviio `${SYNOPKG_PKGDEST}/bin/passgen 1 20` "Serviio daemon user" 0 "" ""

#determine the serviio user homedir and save that variable in the user's profile
#this is needed because librtmp needs to write a file called ~/.swfinfo
#and new users seem to inherit a HOME value of /root which they have no permissions for
SERVIIO_HOMEDIR=`cat /etc/passwd | sed -r '/Serviio daemon user/!d;s/^.*:Serviio daemon user:(.*):.*$/\1/'`
su - serviio -s /bin/sh -c "echo export HOME=${SERVIIO_HOMEDIR} >> .profile"

#change owner of Serviio folder tree
chown -R serviio ${SYNOPKG_PKGDEST}

#reset ownership on any pre-existing transcoding temp folder (same volume as appstore)
if [ -d ${SYNOPKG_PKGDEST}/../../@tmp/Serviio ]; then
        chown -R serviio ${SYNOPKG_PKGDEST}/../../@tmp/Serviio
fi
#reset ownership on any pre-existing transcoding temp folder (on volume1 in case app was installed on a different volume)
if [ -d /volume1/@tmp/Serviio ]; then
        chown -R serviio /volume1/@tmp/Serviio
fi

#create symbolic link to Serviio's version of FFmpeg
if [ -f /opt/bin/ffmpeg ]; then
        mv /opt/bin/ffmpeg /opt/bin/ffmpeg.bak.serviio
        ln -s ${SYNOPKG_PKGDEST}/bin/ffmpeg /opt/bin/ffmpeg
else
        ln -s ${SYNOPKG_PKGDEST}/bin/ffmpeg /bin/ffmpeg
fi

#set up symlink for the DSM GUI
if [ -d /usr/syno/synoman/webman/3rdparty ]; then
        ln -s ${SYNOPKG_PKGDEST}/DSM /usr/syno/synoman/webman/3rdparty/Serviio
fi

#move web UI files to Webstation root folder
mv ${SYNOPKG_PKGDEST}/web /volume1/web/serviio

#find path of public share (it might not be on /volume1)
PLUGIN_PICKUP=`cat /usr/syno/etc/smb.conf | sed -r '/\/public$/!d;s/^.*path=(\/volume[0-9]{1,3}\/public).*$/\1/'`

#pick up any plugins from the public share
mv ${PLUGIN_PICKUP}/*.groovy ${SYNOPKG_PKGDEST}/plugins

exit 0
 

start-stop-status

#!/bin/sh

#--------SERVIIO start-stop-status script
#--------package maintained at pcloadletter.co.uk

daemon_status ()
{
        ps | grep '^ *[0-9]* serviio' > /dev/null
}

case $1 in
        start)
                #start Serviio in background mode
                su - serviio -s /bin/sh -c "${SYNOPKG_PKGDEST}/bin/serviio.sh &"
                exit 0

        ;;
        stop)
                su - serviio -s /bin/sh -c "${SYNOPKG_PKGDEST}/bin/serviio.sh -stop"
                exit 0
        ;;
        status)
                if daemon_status ; then
                        exit 0
                else
                        exit 1
                fi
        ;;
        log)
        echo "${SYNOPKG_PKGDEST}/log/serviio.log"
                exit 0
        ;;
esac
 

preuninst

#!/bin/sh

#--------SERVIIO preuninstall script
#--------package maintained at pcloadletter.co.uk

#make sure that Serviio is stopped
${SYNOPKG_PKGDEST}/bin/serviio.sh -stop
sleep 6

exit 0
 

postuninst

#!/bin/sh

#--------SERVIIO postuninstall script
#--------package maintained at pcloadletter.co.uk

#remove serviio daemon user
synouser --del serviio

#remove symlink and reinstate any backed up version of FFmpeg
if [ -L /opt/bin/ffmpeg ] && [ -f /opt/bin/ffmpeg.bak.serviio ]; then
        rm /opt/bin/ffmpeg
        mv /opt/bin/ffmpeg.bak.serviio /opt/bin/ffmpeg
fi
if [ -L /bin/ffmpeg ]; then
        rm /bin/ffmpeg
fi

#remove DSM icon symlink
rm /usr/syno/synoman/webman/3rdparty/Serviio

#remove web UI
if [ -d /volume1/web/serviio ]; then
        rm -r /volume1/web/serviio
fi

exit 0
 

preupgrade

#!/bin/sh

#--------SERVIIO preupgrade script
#--------package maintained at pcloadletter.co.uk

#make sure that Serviio is stopped
${SYNOPKG_PKGDEST}/bin/serviio.sh -stop
sleep 6

#if a media database exists we need to preserve it
if [ -d ${SYNOPKG_PKGDEST}/library/db ]; then
        mkdir ${SYNOPKG_PKGDEST}/../serviio_db_migration
        mv ${SYNOPKG_PKGDEST}/library/db ${SYNOPKG_PKGDEST}/../serviio_db_migration
fi

#if online plugins exist we need to migrate them
if ls ${SYNOPKG_PKGDEST}/plugins/*.groovy; then
        mkdir ${SYNOPKG_PKGDEST}/../serviio_plugin_migration
        mv ${SYNOPKG_PKGDEST}/plugins ${SYNOPKG_PKGDEST}/../serviio_plugin_migration
fi

exit 0
 

postupgrade

#!/bin/sh

#--------SERVIIO postupgrade script
#--------package maintained at pcloadletter.co.uk

#use the backed up media database from the previous version
if [ -d ${SYNOPKG_PKGDEST}/../serviio_db_migration/db ]; then
        mv ${SYNOPKG_PKGDEST}/../serviio_db_migration/db ${SYNOPKG_PKGDEST}/library
        rmdir ${SYNOPKG_PKGDEST}/../serviio_db_migration

        #serviio daemon user has been deleted and recreated so we need to reset ownership (new UID)
        chown -R serviio ${SYNOPKG_PKGDEST}/library/db
fi

#use the backed up plugins from the previous version
if [ -d ${SYNOPKG_PKGDEST}/../serviio_plugin_migration/plugins ]; then
        cp ${SYNOPKG_PKGDEST}/../serviio_plugin_migration/plugins/*.groovy ${SYNOPKG_PKGDEST}/plugins
        if [ ! -z ${SYNOPKG_PKGDEST} ]; then
                if [ -d ${SYNOPKG_PKGDEST}/../serviio_plugin_migration ]; then
                        rm -r ${SYNOPKG_PKGDEST}/../serviio_plugin_migration
                fi
        fi
        #serviio daemon user has been deleted and recreated so we need to reset ownership (new UID)
        chown -R serviio ${SYNOPKG_PKGDEST}/plugins
fi

#reset ownership on transcoding temp folder (same volume as appstore)
if [ -d ${SYNOPKG_PKGDEST}/../../@tmp/Serviio ]; then
        chown -R serviio ${SYNOPKG_PKGDEST}/../../@tmp/Serviio
fi
#reset ownership on transcoding temp folder (on volume1 in case app was installed on a different volume)
if [ -d /volume1/@tmp/Serviio ]; then
        chown -R serviio /volume1/@tmp/Serviio
fi

#restart Web Station to clear webserver caches
if [ -f /usr/syno/etc/rc.d/S97apache-user.sh ]; then
        /usr/syno/etc/rc.d/S97apache-user.sh restart
fi

exit 0
 

Changelog:

  • 0.6.0.1-005 added Web Station dependency, EULA dialog, and links for Web UI and user forum in More Info
  • 0.6.0.1-004 test for package repo to allow update notification
  • 0.6.0.1 v3 hopefully fixed an issue with the Serviio DSM icon in DSM 3.2 on NAS units without Optware installed
  • 0.6.0.1 v2 inclusion of a modified version of the PHP Web UI
  • 0.6.0.1 v1 new minor Serviio release with some updated international translations – will upgrade 0.6 preserving the media library
  • 0.6 v1 first public release
  • 0.6b4 v2 fixed permissions on transcode temporary folder following upgrade, avoiding the need for a reboot
  • 0.6b4 v1 added upgrade scripts to allow media database migration (install future packages over the top of this one – database is preserved)
  • 0.6b3c v2 fixed HOME env var for serviio user (to fix librtmp issues with BBC iPlayer) and removed the need to edit the passwd file to change the shell (safer)
  • 0.6b3c v1 initial spk test release

 
 
About these ads

173 thoughts on “Serviio 0.6 package for Synology NAS with Web UI

  1. Peter59

    Hi Patters. I wish you the best for 2012 !!
    I’m commenting you great “how-to” to report an issue I’m having with the installation of the servioo package. I have a DS1511+ Synology NAS running DSM 3.2-1955 and There’s no way for me to get Servioo working. Do I need to disable the DSM built-in DLNA server ?

    I’ve installed Java 7 and servioo of course. Java is reported as stopped, and Servioo is stopped too. when I click on its icon in the admin tab and I get the big red cross saying that the servioo service has not been found. I’m kinda disapointed, servioo seems so powerfull :-(
    I uninstalled thoose twice with no luck :(

    When you get back from holidays, maybe you could help me with few advices ? Maybe java 7 isn’t working afterall, need I to uninstall Java 7 and install Java 6 ?

    ANyway, thanks for your help

    Reply
    1. patters Post author

      Can you try connecting to your NAS via SSH and running the command:
      java -version

      Is there an error? No one has yet given me feedback as to whether Oracle’s Java 7 works on Intel (I don’t have an Intel syno to test). Their last version didn’t but that could just have been a bug (possibly with DSM).

      Reply
  2. Peter59

    Hi, sorry for the version 7 feedback, I uninstalled it, I installed version 6, and this time it worked… Except, Servioo doesn’t work either way after a fresh install.

    I saw a lot of things in the log.. then after a while of nothing new in the log, I stopped the Servioo, then launched it again, and Voila !!
    It worked, I mean, the only thing working right now is the UI with all the options. But this is a start.

    Thanks for your support.

    Reply
  3. batserra

    Hi

    First thanks for the program, but i have a error ,when i try in transcode change tmp folder i get the errno: 2 , i had the same error in library but i changed to /volumne1/video folder. But when i try to change in the transcode to /volume1/tmp i get the same error.

    I’m using Serviio v 0.6.0.1 with Dsm 3.2 and 110j Nas server, also ,in the control user ,servioo user have read permisions. How i can fix it?

    Sorry with my english

    Thanks for all

    Reply
      1. batserra

        Thanks patters, but the same ,after some seconds with a busy ,the windows change to ajaxx tree file browser in the windows and a this message to you want to change transcoded files location from “/volume1/@tmp” to “/”?
        What i’m doing wrong?
        Thanks

  4. Pete

    This worked brilliantly for me on my ds212j. Thanks a great deal for putting the package and instructions together, much appreciated.

    One serviio related gotcha that tripped me up for a while was that it doesn’t seem to like library paths with spaces escaped, but once I discovered this everything was downhill.

    Cheers,
    Pete

    Reply
  5. Pavol

    Hi, thanks for great package. I managed to install it to my ds212+ BUT there is one little problem – my NAS is now always running, it does not go into sleep mode. Is it because automatic update of library is on?

    Reply
  6. Jon

    Hi there,

    Wow this looks awesome…feel gutted I am on my second SyNo nas and have only just found it!!!! Thank you for all your work on this, sure im not the first to say that!

    Have installed as instructed, webservices enabled, java sorting out (yikes pain, but worth it) and servio package installed….

    When I go to run I get a big red circle of doom and the following underneath…

    Cannot get status
    Cannot connect to Serviio server, it does not seem to be running. Exiting

    Its late and im probably doing something stupid, but would really appreciate a pointer.

    Thanks again

    Jon :0D

    Reply
    1. patters Post author

      It most likely is working, it’s just that the PHP Web UI seems to flake out when the server is busy. I’m switching to a different Web UI in the next version of the package which should fix that issue. You could use the Serviio Remote Console to configure Serviio from another computer. See the FAQ on the Serviio site for details.

      Reply
  7. batserraluis

    New update to 0.6.1-006 ????

    Hi today i find that i cap upgrate my serviio 0.6.0.1-005 to another new version, but always when i try to download there is an error.
    Can i download manually?

    Whats new in this version?

    Thanks a lot

    Reply
  8. ben

    can you post an spk link for the java installation? i cant seem to add the repo in my isp.. i think it is being blocked by my isp.. i tried with another syno on another isp and it was ok but not with this isp..

    Reply
  9. Chey

    Hello, Happy New Years !
    Thx for ur job.

    I have a 110J synology with the 4.1 DM.
    All seem to be working fine… but i have some Pb…
    I can’t see the Serviio Icon on my dsm menu to manage it ? java 7 is installed on my nas synology.

    Thx for ur reponse.
    Chey.

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s