Category: Synology

  • Install Git command on Synology

     

    Installing git on Synology using IPKG is really easy.

    Click to Read More

    Install first IPKG as explained here and, in the ssh console, run next as root: ipkg install git

    You can also simply install it using ipkgGui. That’s even much easier than using a ssh console 😉

    Now, you can use the command git in a ssh console…

    Ex.: first thing you should do is to set up your name and email by typing:

    git config –global user.email <your_email>
    git config –global user.name <your_name>

    To clone a remote projet, in a local folder,  type:

    cd /<some_local_path>/

    git clone https://github.com/<user-name>/<repository>.git –branch <remote_branch-name>

    where “remote_branch-name” is a branch like “master”, “develop”, …

    The URL can be found using the “Clone or download” button of any GitHub project (See “Clone with HTTPS”).

    Clone GitHub Repository
    Clone GitHub Repository

    To update that project with a specific branch, type e.g.:

    git fetch origin develop

     

    Documentation can be found here.

    NB.: To install Git Server, look here

    Loading

  • Synology: Expanding Volume shows no progress

    I did start an expansion of my main volume by adding 2 x 3 TB, 24h ago, and looking at the progress, it’s still 0%. But it seems that the display is incorrect. Looking via a console, on can see some concrete progress.

    Click to Read More

    If I look into the Storage Manager, I see no progress:

    Expanding (Checking parity consistency 0.00%)

    Expand Volume No Progress
    Expand Volume No Progress

    To see some progress, try the following command in a ssh console:

    cat /proc/mdstat

    One can see that a disk is currently resyncing and should end in xxx minutes. Another one is waiting for a resync.

    Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4]
    md3 : active raid5 sdd7[2] sdc7[1] sdg7[0]
         1953485824 blocks super 1.2 level 5, 64k chunk, algorithm 2 [3/3] [UUU]
         [===>...............] resync = 28.7% (281233152/976742912) finish=846.3 min speed=13696K/sec
    md5 : active raid5 sdd6[4] sdc6[3] sdg6[2] sdb6[1] sda6[0]
         1953485824 blocks super 1.2 level 5, 64k chunk, algorithm 2 [5/5] [UUUUU]
         resync=DELAYED
    md2 : active raid5 sdd5[6] sdc5[5] sdg5[4] sdf5[3] sde5[2] sdb5[1] sda5[0]
         11692100736 blocks super 1.2 level 5, 64k chunk, algorithm 2 [7/7] [UUUUUU U]
    md4 : active raid1 sdh5[0]
         3902187456 blocks super 1.2 [1/1] [U]
    md1 : active raid1 sda2[0] sdb2[1] sdc2[2] sdd2[3] sde2[4] sdf2[5] sdg2[6] sdh2[ 7]
         2097088 blocks [8/8] [UUUUUUUU]
    md0 : active raid1 sda1[0] sdb1[1] sdc1[2] sdd1[3] sde1[4] sdf1[5] sdg1[6] sdh1[ 7]
         2490176 blocks [8/8] [UUUUUUUU]

    Loading

  • Synology: My Own Knowledge Base

    I always forget plenty of details useful to work on my Synology, such as path, tips & tricks, command or service names, etc.. So, to retrieve them more easily, I will publish them here.

    Click to Read More

    Post under construction…

    Connect on a Synology

    • via SSH console: see here
    • via GateOne on DSM: see here

    Synology Commands

    • Located in /usr/syno and /usr/syno/sbin resp. for binaries and script requiring root privileges
    • Interesting scripts in /usr/syno/etc.defaults/rc.sysv/ (to be used as root)
      • ./apparmor.sh {start|stop|restart|try-restart|reload|force-reload|status|kill|add_packages_profile|remove_packages_profile}
      • ./share-preapre.sh start
      • ./sftp.sh reload
      • ./tfpt.sh reload
      • ./ningx.sh reload
      • ./synomount.sh {start|stop}
      • ./pgsql.sh {start|stop|restart|reload|status}
      • ./S80samba.sh {start|stop}
      • ./S83nfsd.sh {start|stop}
      • ./inetd.sh { prestart_telnetd | poststop_telnetd | prestart_cups_lpd | poststop_cups_lpd }

    Other command paths:

    Interesting Paths

    • Web folder: /var/services/web
      • Reference onto /volumex/web
    • Package folder: /var/packages/<Package Name>
      • See 3rd Party Packages bellow
    • Link onto all 3rd party packages
      • /usr/syno/synoman/webman/3rdparty

    Synology Services

    • Names:
      • Packages’ service name: pkgctl-<package>
      • Ex.: pkgctl-WebStation
      • For others, execute: /usr/syno/sbin/synoservicecfg –list
    • Config
      • path: /usr/syno/etc/synoservice.d/<service>
    •  Commands:

    Need to be root:

      • /usr/syno/sbin/synoservice −−help
      • /usr/syno/sbin/synoservicecfg −−help (alias of above)
      • /usr/syno/sbin/synoservicectl −−help (limited features of above)
      • /usr/syno/sbin/synoservicemigrate −−help
      • Ex.: synoservice −−restart pkgctl-WebStation

    No need to be root:

      • /usr/syno/sbin/synopkg
      • /usr/syno/sbin/synopkgctl
    •  Status for Packages:
      • Each service has a file named “enabled” which is created when the service is started via the Packager Center UI (/var/packages/<package>/enabled).
      • This file is deleted once one stops the service via the Package Center UI.
      • This file is not deleted if one stops the service with the command line /usr/syno/sbin/synoservicecfg –stop pkgctl-<package>
      • This ile is not recreated if one (re)starts the service with the command line /usr/syno/sbin/synoservicecfg –start pkgctl-<package>
      • Command line ex.:
        • /usr/syno/sbin/synoservicecfg –stop “pkgctl-AudioStation”
        • output: warn: The runkey of service [pkgctl-AudioStation] has been set to “No”
        • /usr/syno/sbin/synoservicectl –stop “pkgctl-AudioStation”
        • output: pkgctl-AudioStation stoped.
    • List all Services
      • /usr/syno/sbin/synoservicecfg –list
      • /usr/syno/sbin/synoservicecfg –list-config
    • More options
      • /usr/syno/sbin/synoservicecfg —help-dev

    3rd Party Packages

    • Access path: /usr/syno/synoman/webman/3rdparty/
      • This is a link to the binaries/web page/scripts of the actual application to run.
      • ls -la /usr/syno/synoman/webman/3rdpart/<packagename> will give you the actual path
    • Access Url: http://<YourNas>:<Admin Port>/webman/3rdparty/<Package Name>/….
      • To check the URL of a 3rd Party Package, simply Right Click on it in DSM’s Main Menu and select “Open in new window”
    • Setup path (scripts, config, enabled “flag”, INFO): /var/packages/<package>/
      • This is the location of all info used be DSM to install, access and run the package
      • Link onto the package itself /var/packages/<package>/target => /volume<x>/@appstore/<Package Name>
        • target/ is only created after the installation and can therefore not be used in Package’s pre-installation script.
      • Link onto the package configuration : /var/packages/<package>/etc => /usr/syno/etc/packages/<Package Name>
        • etc/ is only created after the installation and can therefore not be used in Package’s pre-installation script.
    • Installation path: /volume<x>/@appstore/<package>
      • This is the path to the binaries/web page/scripts of the application.
      • Found via: ls -la /var/packages/<package>/target
    • Configuration path: /usr/syno/etc/packages/<package>
      • This is the path where the configuration settings of the application can be stored.
      • This path is not deleted during an upgrade/uninstallation.
      • Found via: ls -la /var/packages/<package>/etc
    • List the custom feeds: cat /usr/syno/etc/packages/feeds

    So, concretely, the structure of a Package Folder under /var/packages/<Package name> is like:

    • conf/
    • enabled
    • etc -> /usr/syno/etc/packages/<Package name>
    • INFO
    • scripts/
      • postinst
      • postuninst
      • postupgrade
      • preinst
      • preuninst
      • preupgrade
      • start-stop-status
    • target -> /volume<x>/@appstore/<Package name>
    • WIZARD_UIFILES/
      • install_uifile or install_uifile.sh
      • uninstall_uifile or uninstall_uifile.sh
      • upgrade_uifile or upgrade_uifile.sh
      • NB.: each file can be postfixed with the language. Ex.: install_uifile_enu or install_uifile_fre

    NB: Sometimes, ‘target’ can be a link on -> /usr/local/packages/@appstore/<Package name>

    Volumes

    • Volume Raid storage calculator: https://www.synology.com/fr-fr/support/RAID_calculator

    Logs

    • Main Log path: /var/log/
    • Package installation log: /var/log/synopkg.log
    • Services log:  /var/log/synoservice.log
    • Services’ path start/stop logs: /var/log/startup
    • Apache’s log: /usr/local/etc/apache22/logs /usr/local/etc/apache24/logs
    • nginx’s log: /var/log/nginx/

    If something goes wrong and you look for information, delete all existing logs (rm -R) and redo the failing operation. Next, look for newly created logs 😉

    Web Server

    The Web server can be nginx, apache22 or apache24, as:

    • Configured globally in the Web Station > General Settings > HTTP back end Server or
    • Configure per Virtual Host in Web Station > Virtual Host

    Config files are per Web server types:

    • Apache 22’s configs are under /usr/local/etc/apache22. Ex.:
      • virtualhost config file: /usr/local/etc/apache22/sites-enabled/httpd-vhost.conf (notice: changes in this file are lost after restarting the Web Station)
      • httpd conf file:  /usr/local/etc/apache22/conf/httpd22.conf
    • Apache 24’s configs are under /usr/local/etc/apache24
    • Nginx’s configs are under usr/local/etc/nginx

    But also in the Web Station configs:

    • Virtual Host, depending if using php56 or php 70, are also in  /var/packages/WebStation/etc/php56/conf.d/webstation_vhost.ini (notice: changes in this file are lost after restarting the Web Station)

    Restart Web Server:

    • synoservicecfg restart nginx
    • synoservice restart pkgctl-Apache2.4
    • synoservice restart pkgctl-WebStation

    Interesting website info here.

    Plex Server

    • Plex Media Server data path: /Volume<x>/Plex/Library/Application Support/Plex Media Server/
    • Complete Server Backup:
      • Stop Plex Media Server (via the Package Center)
      • Copy the directory mentioned above to backup Plex’s database et configuration.
      • Restart Plex Media Server
    • Database Backup:
      • Backups are in /Volume<x>/Plex/Library/Application Support/Plex Media Server/Plug-in Support/Databases/
      • Stop Plex Media Server (via the Package Center)
      • Move away the followin file
        • com.plexapp.plugins.library.db
        • com.plexapp.plugins.library.db-shm
        • com.plexapp.plugins.library.db-wal
      • Rename the latest (or any older) com.plexapp.plugins.library.db-YYYY-MM-DD into com.plexapp.plugins.library.db
      • Restart Plex Media Server

    Synology Certificates

    They are (in most recent DSM version) under /usr/syno/etc/certificate/system

    Synology Model

    Notifications

    • Notification messages: /usr/syno/synoman/webman/texts/enu/mails
    • Notification sending mode: /usr/syno/etc/notification/notification_filter.settings
    • Other Notification messages (unknown usage): /usr/local/share/notification/dsm/enu/mails
    • Command:
      • /usr/syno/bin/synonotify <notification>  ‘{“[%VAR1%]”: “value1”, “[%VAR2%]”: “value2”}’
    • Debugging:
      • syno_hibernate_debug_tool –enable 10
      • syno_hibernate_debug_tool –disable

    Event Logs

    • Event messages: Events : /usr/syno/synosdk/texts/enu/events
    • Command:
      • synologset1 [sys | man | conn] [info | warn | err] eventID(%X) [substitution strings…]

    Package Installation scripts

    • Documentation about installation scripts are here .
    • The etc folder of the package is a link onto /usr/syno/etc/packages/<Package Name>/
    • A script must exit 0 to succeed. Any other value will fail the installation/upgrade/uninstallation.
    • One can redirect all errors into the log with code like this:

    exec 2<&-
    exec 2>>/var/log/MyPackageErr.log

    • All information logged in $SYNOPKG_TEMP_LOGFILE are displayed at the end of the installation/upgrade/uninstallation in any cases (success or failure).
    • Add a <br> at the end of each line in $SYNOPKG_TEMP_LOGFILE to have a nice display. Ex.: sed -i ‘s/$/<br>/’ “$SYNOPKG_TEMP_LOGFILE”
    • One can decide to fail an installation/upgrade/uninstallation with code like this:

    if [ -s “/var/log/MyPackageErr.log” ]; then
    sed -i ‘s/$/<br>/’ “/var/log/MyPackageErr.log”
    cat /var/log/MyPackageErr.log >> $SYNOPKG_TEMP_LOGFILE
    exit 1
    fi

    • Add or Remove an port configuration in the firewall by command:

    SERVICETOOL=”/usr/syno/bin/servicetool”
    FWPORTS=”/var/packages/<Package Name>/scripts/<Package Name>.sc”

    In the ‘posinst’ script:

    ${SERVICETOOL} –install-configure-file –package ${FWPORTS} >> /dev/null

    In the ‘preuninst’ script:

    if [ “${SYNOPKG_PKG_STATUS}” == “UNINSTALL” ]; then
    ${SERVICETOOL} –remove-configure-file –package $<Package Name>.sc >> /dev/null
    fi

    The structure of the <Package Name>.sc file is described here https://help.synology.com/developer-guide/integrate_dsm/install_ports.html

    Following ports are used by Synology : https://www.synology.com/en-us/knowledgebase/DSM/tutorial/Network/What_network_ports_are_used_by_Synology_services

    Using commands is only required with firmware version < 6.0-5936

    Loading

  • Move a Synology Package from a volume to another

    I wanted to replace the smallest disks of my NAS with bigger ones. Unfortunately, some packages where installed on those. To avoid uninstalling/reinstalling everything, I did wrote a shell script which does the job, as well as a Package for Synology to offer a web interface.

    Click to Read More

    Here the first version of my script:

    [shell] #!/bin/bash

    TARGET=$1
    PACKAGE=$2

    if [[ $PACKAGE == &amp;amp;amp;quot;&amp;amp;amp;quot; ]] then
    echo &amp;amp;amp;quot;Usage: mvpkg Target Package&amp;amp;amp;quot;
    echo &amp;amp;amp;quot; Target must be like ‘volumex’ where x is a numeric.&amp;amp;amp;quot;
    echo &amp;amp;amp;quot; Package must be the name of a package.&amp;amp;amp;quot;
    exit
    fi

    if [[ $TARGET != volume[0-9]* ]] then
    echo &amp;amp;amp;quot;Usage: mvpkg Target Package&amp;amp;amp;quot;
    echo &amp;amp;amp;quot; Target must be like ‘volumex’ where x is a numeric.&amp;amp;amp;quot;
    echo &amp;amp;amp;quot; Package [$PACKAGE] must be the name of a package.&amp;amp;amp;quot;
    exit
    fi

    #Check the package and check the result: &amp;amp;amp;quot;enable&amp;amp;amp;quot; (is start), &amp;amp;amp;quot;disable&amp;amp;amp;quot; (is stop) or &amp;amp;amp;quot;does not exist&amp;amp;amp;quot;
    output=$(/usr/syno/sbin/synoservicecfg –status &amp;amp;amp;quot;pkgctl-$PACKAGE&amp;amp;amp;quot; | grep Service)

    if [[ $output == *&amp;amp;amp;quot;does not exist&amp;amp;amp;quot;* ]] then
    echo &amp;amp;amp;quot;The service $PACKAGE can’t be found.&amp;amp;amp;quot;
    exit
    else
    #find the current volume of the package and its link
    output=$( ls -la /var/packages/*/target | grep &amp;amp;amp;quot;/$PACKAGE/&amp;amp;amp;quot;)

    link=$(echo $output | grep -oP &amp;amp;amp;quot;\/var/packages/.*/target&amp;amp;amp;quot;)
    volume=$(echo $output | grep -oP &amp;amp;amp;quot;volume\d*&amp;amp;amp;quot;)
    path=$(echo $output | grep -oP &amp;amp;amp;quot;\/volume.*&amp;amp;amp;quot;)

    if [[ $link != &amp;amp;amp;quot;/var/packages/$PACKAGE/target&amp;amp;amp;quot;* ]] then
    echo &amp;amp;amp;quot;The service $PACKAGE is not correctly installed.&amp;amp;amp;quot;
    exit
    fi

    if [[ $volume != &amp;amp;amp;quot;volume&amp;amp;amp;quot;* ]] then
    echo &amp;amp;amp;quot;The service $PACKAGE can’t be located.&amp;amp;amp;quot;
    exit
    fi

    if [[ $volume == $TARGET ]] then
    echo &amp;amp;amp;quot;The service $PACKAGE is already on $TARGET.&amp;amp;amp;quot;
    exit
    fi

    if [[ &amp;amp;amp;quot;$path&amp;amp;amp;quot; != &amp;amp;amp;quot;/$volume/@appstore/$PACKAGE&amp;amp;amp;quot; ]] then
    echo &amp;amp;amp;quot;The service $PACKAGE does not have a standard location.&amp;amp;amp;quot;
    exit
    fi

    #List Packages with dependency on this one
    #/usr/syno/sbin/synoservicecfg –reverse-dependency pkgctl-$PACKAGE

    #Stop the package and all its dependencies
    output=$(/usr/syno/sbin/synoservicecfg –hard-stop &amp;amp;amp;quot;pkgctl-$PACKAGE&amp;amp;amp;quot; | grep warn)

    if [[ $output != *&amp;amp;amp;quot;have been set&amp;amp;amp;quot;* ]] then
    echo &amp;amp;amp;quot;The service $PACKAGE couldn’t be stopped.&amp;amp;amp;quot;
    exit
    fi

    if [ -d &amp;amp;amp;quot;/$TARGET/@appstore/$PACKAGE&amp;amp;amp;quot; ]; then
    mv &amp;amp;amp;quot;/$TARGET/@appstore/$PACKAGE&amp;amp;amp;quot; &amp;amp;amp;quot;/$TARGET/@appstore/$PACKAGE-$(date -d &amp;amp;amp;quot;today&amp;amp;amp;quot; +&amp;amp;amp;quot;%Y%m%d%H%M&amp;amp;amp;quot;).log&amp;amp;amp;quot;
    fi

    #remove the link on the previous volume
    rm -f &amp;amp;amp;quot;$link&amp;amp;amp;quot;

    #move the package
    mv &amp;amp;amp;quot;$path&amp;amp;amp;quot; /$TARGET/@appstore

    #link with the package on the new volume
    ln -s &amp;amp;amp;quot;/$TARGET/@appstore/$PACKAGE&amp;amp;amp;quot; &amp;amp;amp;quot;$link&amp;amp;amp;quot;

    #Replace link also in local
    local=&amp;amp;amp;quot;/usr/local/$PACKAGE&amp;amp;amp;quot;
    if [ -L &amp;amp;amp;quot;$local&amp;amp;amp;quot; ]; then
    rm -f &amp;amp;amp;quot;$local&amp;amp;amp;quot;
    ln -s &amp;amp;amp;quot;/$TARGET/@appstore/$PACKAGE&amp;amp;amp;quot; &amp;amp;amp;quot;$local&amp;amp;amp;quot;
    fi

    #update settings
    sed -i &amp;amp;amp;quot;s/$volume/$TARGET/&amp;amp;amp;quot; &amp;amp;amp;quot;/usr/syno/etc/packages/$PACKAGE/*&amp;amp;amp;quot; &amp;amp;amp;amp;&amp;amp;amp;gt;/dev/null

    if [[ $output != *&amp;amp;amp;quot;is enabled&amp;amp;amp;quot;* ]] then
    echo &amp;amp;amp;quot;The service $PACKAGE didn’t restart properly once moved from $volume to $TARGET.&amp;amp;amp;quot;
    else
    echo &amp;amp;amp;quot;The service $PACKAGE has been moved successfuly from $volume to $TARGET.&amp;amp;amp;quot;

    #Restart packages depending on the one moved
    output=$(/usr/syno/sbin/synoservicecfg –reverse-dependency &amp;amp;amp;quot;pkgctl-$PACKAGE&amp;amp;amp;quot;)

    output=&amp;amp;amp;quot;$(echo $output | grep -Po &amp;amp;amp;quot;pkgctl-([^\]]*)&amp;amp;amp;quot;)&amp;amp;amp;quot;
    for string in $output
    do
    /usr/syno/sbin/synoservicecfg –start &amp;amp;amp;quot;$string&amp;amp;amp;quot;
    done
    fi

    #Restart the package and all its dependencies
    output=$(/usr/syno/sbin/synoservicecfg –hard-start &amp;amp;amp;quot;pkgctl-$PACKAGE&amp;amp;amp;quot; | grep Service)

    #Check if the package has been correctly restarted
    output=$(/usr/syno/sbin/synoservicecfg –is-enabled &amp;amp;amp;quot;pkgctl-$PACKAGE&amp;amp;amp;quot;)
    fi
    [/shell]

    It is inspired from this post.

    I did use it to move: AudioStation, CloudStation, DNSServer, NoteStation, PHP5.6, PHP7.0.

    During the move, the package could temporary appear in the Package Center as needing to be repaired:

    Repair Package
    Repair Package444

    Simply wait until the operation is completed and click next on “Refresh” in Package Center. Also, check that no other service was stopped but not restarted !! Restarting other services with dependency is not (yet) managed by the script.

    WARNING: Moving some packages resulted in troubles (Packages never able to restart). Ex.: Apache Http Server 2.2 and 2.4, the Node.js, Unofficial Java Installer, WordPress. These packages did not restart properly after being moved. I still have to investigate why, but they displayed the error “failed to run the package service” for ever (even after restarting the NAS). Something I known is that there are also Symlinks onto packages in /usr/local/. My script takes those into account. But there are possibly other such dependencies somewhere else ?! Most package could fortunately be returned in their orignal state very easily by moving them back to their original volume.

    Important notice

    MariaDB. Before moving it, open it via the DSM main menu and change the volume where the DB files are stored.

    If you wonder which package is on which volume, the easiest is to run this command in a shell: ls -la /var/packages/*/target

    Troubleshooting

    WordPress. After moving, it was stuck in the “repair state”. I simply backuped its folder (/volumex/web/wordpress => /volumex/web/wordpress.bkp), clicked on Repair, reconfigured it to use a new DB, stopped it once fully reinstalled, deleted its new folder and replaced it with the backup (/volumex/web/wordpress.bkp => /volumex/web/wordpress) before restarting wordpress and deleting the new DB.

    Node.jsFileBot-Node and the Unofficial Java Installer. I simply clicked on Repair to fix them.

    Plex Media Server. during y first attempts, it didn’t restart. I did simply install manually the latest version and the “update” fixed the problem without loosing any setting/library/etc… With the latest version of my script, the move succeeded.

    Can’t restart. Look into Package’s installation path, for config files possibly still pointing at the old volume. Use for this purpose a command like:  find -L /var/packages/<package_name>/ -type f -print0 | xargs -I {} -0 grep -l “volumex” “{}”

    If you find such config files, possibly update them by replacing the old volume (volumex) with the new volume (volumez) using a command like: sed -i “s/volumex/volumez/” <config_file_path>

    Stuck ? If you can’t stop/restart a service correctly and can update this one manually, then delete it via a console, Click next Refresh in the Package Center and reinstall it:

    • ls -la /var/packages/<package_name>/target   => this is showing you the volume<x> where it’s installed
    • rm -R /var/packages/<package_name>
    • rm -R /usr/syno/etc/packages/<package_name>
    • rm -R /volume<x>/@appstore/<package_name>
    • rm -f /usr/syno/synoman/webman/3rdparty/<package_name>
    • rm -f /usr/local/<package_name>

    Script & Package

    I did create a “Synology Package” to be able to move packages easily from the DSM. You can find it on my own Synology Repository (See Blog’s menu “SPK Server”). You will find the script in the Package if you “unzip” it, in \package\ui\mvpkg.sh

    Package Mover
    Package Mover
    [EDIT 13-10-2017] I have added support in the package to start/stop/delete packages, display reverse and forward dependencies. Only delete a packages if you are screwed.

    [EDIT 24-02-2018] The sources for my package are available on GitHub (named Package Manager).

    [EDIT 23-12-2018] Since a recent update of DSM, the feature to list dependencies between packages does not work anymore.

    Loading

  • Synology: “failed to install ‘…’. This package is not published by Synology Inc,

    I got the following message when trying to install third parties packages on my Synology: “failed to install ‘…’. This package is not published by Synology Inc,

    The solution is simply to Trust Any Publisher.

    Click to Read More

    Go into the “Package Center” > Settings > General tab and select “Any Publisher” in the section “Trust Level”

    Trust Any Publisher
    Trust Any Publisher

    Loading

  • Synology: the service is disabled now

    After reinstalling my Synology and trying to access various modules, I got web pages displaying “the service is disabled now”. E.x.: for WordPress, phpMyAdmin, …

    The solution was quite simple: Go into the “Package Center” and you should see that the modules are stopped. Start them 😉

    Loading

  • WordPress 404 on Synology after restarting NAS

    Each time I restart my NAS (for update reasons), I have errors 404 when trying to reach any post of my WordPress blog, until I re-set permalinks’ settings. I finally fixed it by updating my WordPress with latest Synology’s package.

    Click to Read More

    A long time ago, rebooting my NAS started to result systematically in 404 in my WordPress blog. I found a manual fix here: simply resetting WordPress permalinks’ settings was solving the problem… until the next reboot 🙁

    But I never understood why rebooting my NAS was resulting in the lost of permalinks’ settings. And could find a definitive solution.

    I finally took today an hour to reproduce and further investigate the problem (motivated by the shiny sun outside :p). I found that restarting only the WordPress Package was also resulting in this issue. I noticed more precisely that the .htaccess file was deleted when starting the package (not when stopping). I am sure that removing access rights on the .htaccess file for WordPress, as described here for example, would be a solution. But the not best one.

    I found the best solution by accident. A long time ago, as I was interested in a version of WordPress more recent than the one available via Synology’s packages, I did a manual upgrade with the official WordPress setup. Since that time, I never did an update anymore with Synology’s Package Manager, but used the native WordPress update via its own Dashboard:

    WordPress-Update

    Today, I did a backup of WordPress’ installation folders and updated Synolgy’s WordPress Package. Once the update accomplished, I noticed that the .htaccess was containing information specific to Synology:

    # Synology PHP
    AddHandler default-handler .htm .html .shtml
    AddHandler php-fastcgi .php
    AddType text/html .php
    Action php-fastcgi /php56-fpm-handler.fcgi
    # Synology PHP

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /wordpress/
    RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /wordpress/index.php [L] </IfModule>

    # END WordPress

    And now, when restarting WordPress, the .htaccess is not deleted anymore (and permalink’s settings are not lost). There is certainly a good explanation, that I ignore, but at least I won’t suffer 404 anymore.

    And next time I update manually WordPress, I will pay attention to backup the .htaccess as specially clearly recommended here, as well as merging that .htaccess with the updated one after the update of the Permalinks’ structure:

    1. Backup your database. Read Backing Up Your Database for a detailed explanation.
    2. Backup ALL your WordPress files in your WordPress directory. Don’t forget your .htaccess file.
    3. Verify the backups you created are there and usable. This is essential.
    4. Ensure first four steps are completed. Do not attempt the upgrade unless you have completed the first four steps.
    5. Delete the old WordPress files on your site, but DO NOT DELETE

      • wp-config.php file;
      • wp-content folder; Special Exception: the wp-content/cache and the wp-content/plugins/widgets folders should be deleted.
      • wp-images folder;
      • wp-includes/languages/ folder–if you are using a language file do not delete that folder;
      • .htaccess file–if you have added custom rules to your .htaccess, do not delete it;
      • robots.txt file–if your blog lives in the root of your site (ie. the blog is the site) and you have created such a file, do not delete it.
    6. Upload the new files from your computer’s hard drive to the appropriate WordPress folder on your site.
    7. Run the WordPress upgrade program and follow the instructions on the screen.
    8. Update Permalinks and .htaccess. Update your Permalink Structure and merge the custom rules, if necessary, into your .htaccess file.
    9. Install updated Plugins and Themes. Please review the list of Plugins that work in Version 4.8. Check for Theme Compatibility with 4.8 and ask your Theme author for any new version.

    Loading

  • Synology: “DSM updating in process…” forever

    I recenlty tried to update my DSM 6.1.1-15101 from pacth 3 to 4. For some unknown reasons, the update never ends which results in various “issues”. The only solution I found to exit that situation was to kill the upgrade process.

    Click to Read More

    Once the update started, the progress eventually appeared stuck…

    Updating Synology

    After 2 hours, I decided to open the admin interface (http://<MySyno>:<adminPort>) and was able to log in. But back into the Control Panel, I saw the message “DSM updating is in process…”…

    DSM Updating

    It would not have been a big issue if it didn’t prevent me to update any packages. Trying to do so was resulting in a popup blocking any automatique on manual installation/update. I was also unable to restart or shutdown properly the NAS for the same reason.

    To solve this situation I had to kill the upgrade process:

    1. Open a SSH console using Putty to connect onto the NAS
    2. Login as administrator
    3. Enter the root mode using the command: sudo -i
    4. Kill the update processes typing the command: kill -9 $(ps aux | grep -e SYNO.Core.Ugrade |grep -v grep | awk ‘{ print $2 }’)

    I was next able to update other packages… I did next restart the NAS but for some reasons, it never rebooted completed (neither detected by the Synology Assistant nor accessible via the Admin webUI). I had therefore to do a hard reboot 🙁

    Now, although I am still unable to reboot properly or upgrade DSM, I can at least install (or update) packages, possibly to help me in backuping everything before a complete reset.

    NB.: I also tried to upgrade from SSH, without success.

    Using the feature auto, I got an error message:

    root@Hades:~# synoupgrade –check
    UPGRADE_CHECKNEWDSM
    Available update: DSM 6.1.2-15132, patch type: dsm, restart type: reboot, reboot type: now

    root@Hades:~# synoupgrade –download
    UPGRADE_DOWNLOADDSM
    New update has been downloaded

    root@Hades:~# ls -la /volume1/@autoupdate
    total 223684
    drwx—— 2 root root 4096 Jun 16 18:49 .
    drwxr-xr-x 37 root root 4096 Jun 16 18:49 ..
    -rw-r–r– 1 root root 229038080 Jun 14 11:50 DSM_DS1815%2B_15132.pat

    root@Hades:~# synoupgrade –check-pat ./DSM_DS1815+_15132.pat
    UPGRADE_CHECK_PAT
    Patch type is DSM
    ErrSysAvailSize

    root@Hades:~# synoupgrade –auto
    UPGRADE_AUTO
    New update has been downloaded
    Start DSM update…
    ServerUpgrade failed

    Using an explicit download or the explicit path of the patch auto-downloaded, I get no error:

    root@Hades:~# synoupgrade –patch /volume1/@autoupdate/DSM_DS1815%2B_15132.pat
    UPGRADE_PATCH
    Start DSM update…
    root@Hades:~#

    root@Hades:~# wget https://global.download.synology.com/download/DSM/release/6.1.2/15132/DSM_DS1815%2B_15132.pat
    –2017-06-16 18:34:22– https://global.download.synology.com/download/DSM/release/6.1.2/15132/DSM_DS1815%2B_15132.pat
    Resolving global.download.synology.com… 52.222.227.46, 52.222.227.228, 52.222.227.163, …
    Connecting to global.download.synology.com|52.222.227.46|:443… connected.
    HTTP request sent, awaiting response… 200 OK
    Length: 229038080 (218M) [binary/octet-stream] Saving to: ‘DSM_DS1815+_15132.pat’

    100%[==================================================================================================================>] 229,038,080 10.0MB/s in 30s

    2017-06-16 18:34:53 (7.23 MB/s) – ‘DSM_DS1815+_15132.pat’ saved [229038080/229038080]

    root@Hades:~# synoupgrade –check-pat /root/DSM_DS1815+_15132.pat
    UPGRADE_CHECK_PAT
    Patch type is DSM
    Check patch successfully

    root@Hades:~# synoupgrade –patch /root/DSM_DS1815+_15132.pat
    UPGRADE_PATCH
    Start DSM update…
    root@Hades:~#

    Fortunatelly, in all cases, the DSM is not suck in “updating in process”

    Loading

  • Synology Package Creator for shell scripts and php pages

    I did upgrade “Mods“, my Windows Tool used to create dummy packages adding shortcuts on DSM’s desktop to open web pages.

    Now, “Mods” is able to package shell scripts and php webpages…

    Mods
    Mods

    Click to Read More

    It is available here on GitHub.

    For example, you could package apps like Chris Hager’s Most Simple Ajax Chat Ever

    Simple Chat on DSM
    Simple Chat on DSM

    Or package a more advanced tool like php Server Monitor

    Server Monitor
    Server Monitor
    Server Monitor Running
    Server Monitor Running

    This Tool is available here on GitHub.

    Loading

  • Create a VPN to download from a Synology

    In order to hide my NAS, I wanted it to use its own VPN, while my public IP was still visible when surfing with any other devices in my LAN.

    To do so, I subscribed to HMA! (HideMyAss!) and applied their configuration procedure on my Synology. Et voilà.

    Click to Read More

    I did try both a L2TP and a OpenVPN VPN with success. Tricks:

    • For a L2TP VPN, use your PPTP password and NOT your account password
    • For a OpenVPN VPN, use your account password
    • Although using Port Forwarding to access my NAS from internet, I did not had to open the required ports !!!
      • L2TP: UDP 500, 4500 and 1701
      • Open VPN : 443 if using TCP, 553 is using UDL
    • If you are using a DDNS, go to the  Control Panel > External Access and Click Update to verify the public IP of your NAS. It must now be your VPN IP.
    • Check that downloading a torrent (with this procedure), your tracker IP is your VPN IP.
    • Check you IP calling ipify from your NAS.
      • A very simple way to do this is to call the following php page on your Web Station:
    <?php 
     $ip = file_get_contents('https://api.ipify.org');
     echo "My public IP address is: " . $ip;
    ?>
    • Soon after enabling the VPN, I started to be attacked on Telnet port! I am using Security’s Auto-Block feature to prevent brute force attacks.
    • On a mobile device (or anything else) connected directly to Internet (not via your LAN), type your VPN IP in a browser. You should see the default home page of your web station if this one is enabled.
      • I would recommend to replace this default page by a php page returning a header 404.
    <?php
     header("HTTP/1.0 404 Not Found");
    ?>
    • If you are using a DDNS on your NAS, you won’t be able to access your router and VDSL modem via that domain name. Indeed, only your NAS is accessible via this VPN IP. If possible, configure another DDNS on your VDSL modem or router.
      • Ex.: I am using duckdns.org for free. They have a great support page here with detailed configurations for many different devices.
      • Doing so, you can access your NAS and your router or modem via their own Domain name.
    • “Tested OK” both when accessed from LAN or from Internet:
      • Download Station via Synology Download Station for Chrome (https://www.download-station-extension.com)
      • JDownloader via Chrome extension and via https://my.jdownloader.org
      • Plex Server via App or via http://DDNS name:port/web or via http://plex.tv
      • DSM via its admin port
      • Apps: DS Cam, DS File, DS Audio, DS Get, DS Photo, DS Video, DS Cloud and DS Note are all wokring fine using Quick Connect (All those I tested via their DDNS name + custom port or DSM admin port worked too)
      • Cloud Sync (with Hubic)
      • FTP Server

    Loading