Syncthing on Qnap Crashes - No GUI.

My first post here :-). On my QNap the GUI in not accessible and appears randomly after a while. It seems to try to restart continuously. Looking a the logs, it seems to fall into panic mode because of a disk space issue. My Qnap is 4.2.1 (Intel) and space available is 3.87 TB.

Log:

panic: writing to temporary database: write /tmp/syncthing-db.948649057/000009.ldb: no space left on device
[monitor] 05:34:30 WARNING: Panic detected, writing to "/share/CACHEDEV1_DATA/.qpkg/syncthing/config/panic-20160727-053430.log"
[monitor] 05:34:30 WARNING: Please check for existing issues with similar panic message at https://github.com/syncthing/syncthing/issues/
[monitor] 05:34:30 WARNING: If no issue with similar panic message exists, please create a new issue with the panic log attached
[monitor] 05:34:30 INFO: Syncthing exited: exit status 2

Panic:

[P4PZY] 05:51:36 INFO: syncthing v0.14.2 "Dysprosium Dragonfly" (go1.6.3 linux-amd64) unknown-user@lx-buildslave.syncthing.net 2016-07-26 11:55:25 UTC
[P4PZY] 05:51:37 INFO: Single thread hash performance is ~63 MB/s
[P4PZY] 05:51:41 INFO: Ready to synchronize 
[P4PZY] 05:51:42 INFO: Ready to synchronize 
[P4PZY] 05:52:42 INFO: Ready to synchronize 
[P4PZY] 05:53:03 INFO: Ready to synchronize 
[P4PZY] 05:53:04 INFO: Ready to synchronize 
[P4PZY] 05:53:06 INFO: Ready to synchronize 
[P4PZY] 05:53:12 INFO: Ready to synchronize
..
panic: writing to temporary database: write /tmp/syncthing-db.431240151/000010.log: no space left on device

goroutine 317 [running]:
panic(0xa84280, 0xc820d84a40)
	/usr/local/go/src/runtime/panic.go:481 +0x3e6
github.com/syncthing/syncthing/lib/model.(*onDiskIndexSorter).Append(0xc820ec01a0, 0xc8221efaa0, 0x2f, 0x0, 0x1da7000, 0x1a4, 0x5768430d, 0x0, 0xc82059d2c0, 0x2, ...)
	/home/buildslave/workspace/syncthing-release/src/github.com/syncthing/syncthing/lib/model/sorter.go:166 +0x363
github.com/syncthing/syncthing/lib/model.(*autoSwitchingIndexSorter).Append(0xc82172ea10, 0xc8221efaa0, 0x2f, 0x0, 0x1da7000, 0x1a4, 0x5768430d, 0x0, 0xc82059d2c0, 0x2, ...)
	/home/buildslave/workspace/syncthing-release/src/github.com/syncthing/syncthing/lib/model/sorter.go:65 +0x245
github.com/syncthing/syncthing/lib/model.sendIndexTo.func1(0x7f9526af65f8, 0xc8214fc9a0, 0x12d5388)
	/home/buildslave/workspace/syncthing-release/src/github.com/syncthing/syncthing/lib/model/model.go:1273 +0x220
github.com/syncthing/syncthing/lib/db.nativeFileIterator.func1(0x7f9526af65f8, 0xc8214fc930, 0x3000)
	/home/buildslave/workspace/syncthing-release/src/github.com/syncthing/syncthing/lib/db/set.go:323 +0x2bd
github.com/syncthing/syncthing/lib/db.(*Instance).withHave(0xc82041a420, 0xc820447c08, 0xb, 0xb, 0xc820447cb0, 0x20, 0x20, 0x0, 0x0, 0x0, ...)
	/home/buildslave/workspace/syncthing-release/src/github.com/syncthing/syncthing/lib/db/leveldb_dbinstance.go:260 +0x5fb
github.com/syncthing/syncthing/lib/db.(*FileSet).WithHave(0xc821b6bb00, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xc82020c280)
	/home/buildslave/workspace/syncthing-release/src/github.com/syncthing/syncthing/lib/db/set.go:194 +0x2b9
github.com/syncthing/syncthing/lib/model.sendIndexTo(0x0, 0x7f9526cb49c8, 0xc82154c4b0, 0xc82062dfa0, 0xb, 0xc821b6bb00, 0xc8216d7040, 0x0, 0x0, 0x0)
	/home/buildslave/workspace/syncthing-release/src/github.com/syncthing/syncthing/lib/model/model.go:1275 +0x3db
github.com/syncthing/syncthing/lib/model.sendIndexes(0x7f9526cb49c8, 0xc82154c4b0, 0xc82062dfa0, 0xb, 0xc821b6bb00, 0xc8216d7040, 0x0)
	/home/buildslave/workspace/syncthing-release/src/github.com/syncthing/syncthing/lib/model/model.go:1214 +0x5ca
created by github.com/syncthing/syncthing/lib/model.(*Model).ClusterConfig
	/home/buildslave/workspace/syncthing-release/src/github.com/syncthing/syncthing/lib/model/model.go:733 +0x2073

Thanks for this !

-Eric

I can’t really help with this but if you highlight the log output and click on the block quote and code options it will be much easier to read.

LOG:

[monitor] 05:32:11 INFO: Starting syncthing
[P4PZY] 05:32:11 INFO: syncthing v0.14.2 "Dysprosium Dragonfly" (go1.6.3 linux-amd64) unknown-user@lx-buildslave.syncthing.net 2016-07-26 11:55:25 UTC
[P4PZY] 05:32:11 INFO: My ID: xxxxx-xxxxx-xxxxx
[P4PZY] 05:32:11 INFO: Single thread hash performance is ~62 MB/s
[P4PZY] 05:33:16 INFO: Ready to synchronize xx (readwrite)
[P4PZY] 05:33:22 INFO: Ready to synchronize xx (readwrite)
[P4PZY] 05:33:23 INFO: Ready to synchronize xx (readwrite)
[P4PZY] 05:33:26 INFO: Ready to synchronize xx (readwrite)
[P4PZY] 05:33:27 INFO: Ready to synchronize xx (readwrite)
[P4PZY] 05:33:28 INFO: Ready to synchronize xx (readwrite)
[P4PZY] 05:33:49 INFO: Ready to synchronize xx (readwrite)
[P4PZY] 05:34:05 INFO: Ready to synchronize xx (readwrite)
[P4PZY] 05:34:06 INFO: Ready to synchronize xx (readwrite)
[P4PZY] 05:34:06 INFO: Using discovery server https://discovery-v4-1.syncthing.net/v2/?id=xx
[P4PZY] 05:34:06 INFO: Using discovery server https://discovery-v4-2.syncthing.net/v2/?id=xx
[P4PZY] 05:34:06 INFO: TCP listener (0.0.0.0:22000) starting
[P4PZY] 05:34:07 INFO: UPnP parse: unrecognized UPnP device of type urn:schemas-upnp-org:device:InternetGatewayDevice:1
[P4PZY] 05:34:07 INFO: Completed initial scan (rw) of folder xx
[P4PZY] 05:34:08 INFO: Using discovery server https://discovery-v4-3.syncthing.net/v2/?id=xx
[P4PZY] 05:34:08 INFO: Using discovery server https://discovery-v6-1.syncthing.net/v2/?id=xx
[P4PZY] 05:34:08 INFO: Using discovery server https://discovery-v6-2.syncthing.net/v2/?id=xx
[P4PZY] 05:34:08 INFO: Using discovery server https://discovery-v6-3.syncthing.net/v2/?id=xx
[P4PZY] 05:34:08 INFO: Device xx is "xx" at [dynamic]
[P4PZY] 05:34:08 INFO: Device xx is "xx" at [dynamic]
[P4PZY] 05:34:08 INFO: Device xx is "xx" at [dynamic]
[P4PZY] 05:34:08 INFO: Device xx is "xx" at [dynamic]
[P4PZY] 05:34:08 INFO: Device xx is "xx" at [dynamic]
[P4PZY] 05:34:08 INFO: Device xx is "xx" at [dynamic]
[P4PZY] 05:34:08 INFO: Device xx is "xx" at [dynamic]
[P4PZY] 05:34:08 INFO: Device xx is "xx" at [dynamic]
[P4PZY] 05:34:08 INFO: GUI and API listening on 0.0.0.0:8090
[P4PZY] 05:34:08 INFO: Access the GUI via the following URL: http://127.0.0.1:8090/
[P4PZY] 05:34:09 INFO: Completed initial scan (rw) of folder xx
[P4PZY] 05:34:10 INFO: Completed initial scan (rw) of folder xx
[P4PZY] 05:34:12 INFO: Completed initial scan (rw) of folder xx
[P4PZY] 05:34:17 INFO: Established secure connection to xx at 10.0.0.10:54785-45.62.253.132:22067 (Relay (Client))
[P4PZY] 05:34:17 INFO: Device xx client is "syncthing v0.14.2" named "xx"
[P4PZY] 05:34:17 INFO: New NAT port mapping: external TCP address 0.0.0.0:51465 to local address 0.0.0.0:22000.
[P4PZY] 05:34:22 INFO: Completed initial scan (rw) of folder xx
[P4PZY] 05:34:24 INFO: Device xx folder "x" is delta index compatible (mlv=1283954)
[P4PZY] 05:34:27 INFO: Established secure connection to x at 10.0.0.10:52816-0.0.0.0:22067 (Relay (Client))
[P4PZY] 05:34:27 INFO: Device x client is "syncthing v0.14.2" named "xx"
[P4PZY] 05:34:27 INFO: Device x folder "x" is delta index compatible (mlv=1283649)
[P4PZY] 05:34:27 INFO: Detected 2 NAT devices
[P4PZY] 05:34:30 INFO: Established secure connection to x at 10.0.0.10:43690-0.0.0.0:22067 (Relay (Client))
[P4PZY] 05:34:30 INFO: Device x client is "syncthing v0.14.2" named "x"
[P4PZY] 05:34:30 INFO: Device x folder "x" is delta index compatible (mlv=1283499)
[P4PZY] 05:34:30 INFO: Device x folder "x" is delta index compatible (mlv=0)
panic: writing to temporary database: write /tmp/syncthing-db.948649057/000009.ldb: no space left on device
[monitor] 05:34:30 WARNING: Panic detected, writing to "/share/CACHEDEV1_DATA/.qpkg/syncthing/config/panic-20160727-053430.log"
[monitor] 05:34:30 WARNING: Please check for existing issues with similar panic message at https://github.com/syncthing/syncthing/issues/
[monitor] 05:34:30 WARNING: If no issue with similar panic message exists, please create a new issue with the panic log attached
[monitor] 05:34:30 INFO: Syncthing exited: exit status 2


PANIC:



[P4PZY] 05:51:36 INFO: syncthing v0.14.2 "Dysprosium Dragonfly" (go1.6.3 linux-amd64) unknown-user@lx-buildslave.syncthing.net 2016-07-26 11:55:25 UTC
[P4PZY] 05:51:36 INFO: My ID: xx
[P4PZY] 05:51:37 INFO: Single thread hash performance is ~63 MB/s
[P4PZY] 05:51:41 INFO: Ready to synchronize xx (readwrite)
[P4PZY] 05:51:42 INFO: Ready to synchronize xx (readwrite)
[P4PZY] 05:52:42 INFO: Ready to synchronize xx (readwrite)
[P4PZY] 05:53:03 INFO: Ready to synchronize xx (readwrite)
[P4PZY] 05:53:04 INFO: Ready to synchronize xx (readwrite)
[P4PZY] 05:53:06 INFO: Ready to synchronize xx (readwrite)
[P4PZY] 05:53:12 INFO: Ready to synchronize xx (readwrite)
...
[P4PZY] 05:53:28 INFO: Ready to synchronize xx (readwrite)
[P4PZY] 05:53:29 INFO: Ready to synchronize xx (readwrite)
[P4PZY] 05:53:29 INFO: Using discovery server https://discovery-v4-1.syncthing.net/v2/?id=xx
[P4PZY] 05:53:29 INFO: Using discovery server https://discovery-v4-2.syncthing.net/v2/?id=xx
[P4PZY] 05:53:29 INFO: Using discovery server https://discovery-v4-3.syncthing.net/v2/?id=xx
[P4PZY] 05:53:29 INFO: TCP listener (0.0.0.0:22000) starting
[P4PZY] 05:53:30 INFO: UPnP parse: unrecognized UPnP device of type urn:schemas-upnp-org:device:InternetGatewayDevice:1
[P4PZY] 05:53:30 INFO: Completed initial scan (rw) of folder xx
[P4PZY] 05:53:30 INFO: Using discovery server https://discovery-v6-1.syncthing.net/v2/?id=xx
[P4PZY] 05:53:32 INFO: Completed initial scan (rw) of folder xx
[P4PZY] 05:53:33 INFO: Completed initial scan (rw) of folder xx
[P4PZY] 05:53:33 INFO: Using discovery server https://discovery-v6-2.syncthing.net/v2/?id=xx
[P4PZY] 05:53:33 INFO: Using discovery server https://discovery-v6-3.syncthing.net/v2/?id=xx
[P4PZY] 05:53:33 INFO: Device xx is "xx" at [dynamic]
[P4PZY] 05:53:33 INFO: Device xx is "xx" at [dynamic]
[P4PZY] 05:53:33 INFO: Device xx is "xx" at [dynamic]
[P4PZY] 05:53:33 INFO: Device xx is "xx" at [dynamic]
[P4PZY] 05:53:33 INFO: Device xx is "xx" at [dynamic]
[P4PZY] 05:53:33 INFO: Device xx is "xx" at [dynamic]
[P4PZY] 05:53:33 INFO: Device xx is "xx" at [dynamic]
[P4PZY] 05:53:33 INFO: Device xx is "xx" at [dynamic]
[P4PZY] 05:53:33 INFO: GUI and API listening on 0.0.0.0:8090
[P4PZY] 05:53:33 INFO: Access the GUI via the following URL: http://127.0.0.1:8090/
[P4PZY] 05:53:34 INFO: Completed initial scan (rw) of folder xx
[P4PZY] 05:53:35 INFO: Established secure connection to xx at 10.0.0.10:56191-0.0.0.0:22067 (Relay (Client))
[P4PZY] 05:53:35 INFO: Device xxx client is "syncthing v0.14.2" named "xx"
[P4PZY] 05:53:35 INFO: Device xx folder "xx" is delta index compatible (mlv=1283954)
[P4PZY] 05:53:37 INFO: Completed initial scan (rw) of folder xx
[P4PZY] 05:53:40 INFO: Established secure connection to xx at 10.0.0.10:54203-0.0.0.0:22067 (Relay (Client))
[P4PZY] 05:53:40 INFO: Device xx client is "syncthing v0.14.2" named "xx"
[P4PZY] 05:53:41 INFO: Device xx folder "xx" is delta index compatible (mlv=1283649)
[P4PZY] 05:53:44 INFO: Completed initial scan (rw) of folder xx
[P4PZY] 05:53:45 INFO: Established secure connection to xx at 10.0.0.10:45076-0.0.0.0:22067 (Relay (Client))
[P4PZY] 05:53:45 INFO: Device xx client is "syncthing v0.14.2" named "xx"
[P4PZY] 05:53:45 INFO: Device xx folder "xx" is delta index compatible (mlv=1283499)
[P4PZY] 05:53:45 INFO: Device xx folder "xx" is delta index compatible (mlv=0)
Panic at 2016-07-27T05:53:45-04:00
panic: writing to temporary database: write /tmp/syncthing-db.431240151/000010.log: no space left on device

goroutine 317 [running]:
panic(0xa84280, 0xc820d84a40)
	/usr/local/go/src/runtime/panic.go:481 +0x3e6
github.com/syncthing/syncthing/lib/model.(*onDiskIndexSorter).Append(0xc820ec01a0, 0xc8221efaa0, 0x2f, 0x0, 0x1da7000, 0x1a4, 0x5768430d, 0x0, 0xc82059d2c0, 0x2, ...)
	/home/buildslave/workspace/syncthing-release/src/github.com/syncthing/syncthing/lib/model/sorter.go:166 +0x363
github.com/syncthing/syncthing/lib/model.(*autoSwitchingIndexSorter).Append(0xc82172ea10, 0xc8221efaa0, 0x2f, 0x0, 0x1da7000, 0x1a4, 0x5768430d, 0x0, 0xc82059d2c0, 0x2, ...)
	/home/buildslave/workspace/syncthing-release/src/github.com/syncthing/syncthing/lib/model/sorter.go:65 +0x245
github.com/syncthing/syncthing/lib/model.sendIndexTo.func1(0x7f9526af65f8, 0xc8214fc9a0, 0x12d5388)
	/home/buildslave/workspace/syncthing-release/src/github.com/syncthing/syncthing/lib/model/model.go:1273 +0x220
github.com/syncthing/syncthing/lib/db.nativeFileIterator.func1(0x7f9526af65f8, 0xc8214fc930, 0x3000)
	/home/buildslave/workspace/syncthing-release/src/github.com/syncthing/syncthing/lib/db/set.go:323 +0x2bd
github.com/syncthing/syncthing/lib/db.(*Instance).withHave(0xc82041a420, 0xc820447c08, 0xb, 0xb, 0xc820447cb0, 0x20, 0x20, 0x0, 0x0, 0x0, ...)
	/home/buildslave/workspace/syncthing-release/src/github.com/syncthing/syncthing/lib/db/leveldb_dbinstance.go:260 +0x5fb
github.com/syncthing/syncthing/lib/db.(*FileSet).WithHave(0xc821b6bb00, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xc82020c280)
	/home/buildslave/workspace/syncthing-release/src/github.com/syncthing/syncthing/lib/db/set.go:194 +0x2b9
github.com/syncthing/syncthing/lib/model.sendIndexTo(0x0, 0x7f9526cb49c8, 0xc82154c4b0, 0xc82062dfa0, 0xb, 0xc821b6bb00, 0xc8216d7040, 0x0, 0x0, 0x0)
	/home/buildslave/workspace/syncthing-release/src/github.com/syncthing/syncthing/lib/model/model.go:1275 +0x3db
github.com/syncthing/syncthing/lib/model.sendIndexes(0x7f9526cb49c8, 0xc82154c4b0, 0xc82062dfa0, 0xb, 0xc821b6bb00, 0xc8216d7040, 0x0)
	/home/buildslave/workspace/syncthing-release/src/github.com/syncthing/syncthing/lib/model/model.go:1214 +0x5ca
created by github.com/syncthing/syncthing/lib/model.(*Model).ClusterConfig
	/home/buildslave/workspace/syncthing-release/src/github.com/syncthing/syncthing/lib/model/model.go:733 +0x2073

It writes the index to /tmp, which is usually a special partition not necesserily relevant to the total size of your disk.

OK then, is there a way to free some space ? Via FTP or SSH ?

Is it safe to clean up some files there ?

Thanks again!

-Eric

Well, google on increasing /tmp size, potentially for the OS in question.

Instead of increasing the /tmp size, is it possible for syncthing to use another location for temporary files ?

Thanks.

-Eric

You can set TMPDIR env var to the directory you want syncthing to use for temporary storage.

1 Like

I understand. I’m not a Linux guy. Thanks for your patience.

I have see two config files via my SFTP.

/share/CACHEDEV1_DATA/.qpkg/syncthing/config/config.xml

and

/share/CACHEDEV1_DATA/.qpkg/syncthing/syncthing.conf

Can you provide me an example of a syntax to use in on of those file.

Thanks!

-Eric

It’s nothing todo with the configs. It’s todo with the process that starts syncthing. Google how to set an environment variable before starting a process on linux, and make sure that whatever starts syncthing has that variable set.

Maybe it would be an idea for Syncthing to fallback to the database location, if the TMPDIR does not exist? I had the same issue on Android as well.

Syncthign has no .conf file, so that file is probably the package config which could also have the startup command in it. If that’s the case, you can set the temp dir by inserting the line

export TMPDIR=/share/CACHEDEV1_DATA/.qpkg/syncthing/tmp

and creating that dir.

This, of course, requires /share/CACHEDEV1_DATA/.qpkg/syncthing/ to be on a HDD with enough space, not like the special mounted /tmp.

@wweich: If so, I would guess that the .conf file has been put there initially by the qpkg setup on the Qnap.

Will thecommand line

export TMPDIR=/share/CACHEDEV1_DATA/.qpkg/syncthing/tmp

has to be run on the startup file on the Qnap i.e. each time the NAS starts ? Or is it a one time change ?

Regard,

-Eric

That command needs to be inside the script that starts syncthing.

I have that in my qpkg.config

> [syncthing]
> Name = syncthing
> Version = 1-0.12.22
> Enable = TRUE
> QPKG_File = syncthing.qpkg
> Date = 2016-06-21
> Shell = /share/CACHEDEV1_DATA/.qpkg/syncthing/syncthing.sh
> Install_Path = /share/CACHEDEV1_DATA/.qpkg/syncthing
> Web_Port = 8090
> WebUI = /
> Author = Father_mande
> Status = complete

Do I insert the command line there ?

Regards,

-Eric

What’s in the file /share/CACHEDEV1_DATA/.qpkg/syncthing/syncthing.sh ?

Hey wweich,

see below:

#!/bin/sh

########### START of SHELL script
shft() {
    # Change this '8' to one less than your desired maximum rollover file.
    # Must be in reverse order for renames to work (n..1, not 1..n).
    for suff in {8..1} ; do
        if [[ -f "$1.${suff}" ]] ; then
            ((nxt = suff + 1))
            echo Moving "$1.${suff}" to "$1.${nxt}"
            mv -f "$1.${suff}" "$1.${nxt}"
        fi
    done
    echo Moving "$1" to "$1.1"
	if [ -e $1 ] ; then
		mv -f "$1" "$1.1"
	fi
}
change_apache()
{
        /bin/grep -q syncthing /etc/default_config/apache-sys-proxy-ssl.conf.tplt
        if [ $? -eq 0 ] ; then
                echo "syncthing is already in base of ssl proxy"
        else
                NBL=`/bin/grep -n ProxyPass /etc/default_config/apache-sys-proxy-ssl.conf.tplt | /usr/bin/head -n 1 | /bin/cut -d: -f1`
				ADDRIP=`/sbin/getcfg global guiAddress -d "0.0.0.0:8090" -f ${QPKG_DIR}/syncthing.conf`
				GUIPORT=`echo $ADDRIP | cut -f 2 -d ":"`
                sed -i "${NBL}i\ProxyPass /syncthing/ http://127.0.0.1:${GUIPORT}/" /etc/default_config/apache-sys-proxy-ssl.conf.tplt
                /etc/init.d/stunnel.sh restart
        fi
}
start_inotify()
{
	# if need change max number of file able to be survey
	# echo 204800 > /proc/sys/fs/inotify/max_user_watches
	echo " here to test ... start inotify with & and nohup or daemon-mgr"
	# use ${QPKG_DIR}/syncthing-inotify
}


QPKG_DIR=`/sbin/getcfg syncthing Install_Path -d "" -f /etc/config/qpkg.conf`
DAEMON=${QPKG_DIR}/syncthing
if [ ! -e /root/.syncthing.lock ] ; then
	if [ ! -e /usr/bin/syncsh ] ; then
		ln -s ${QPKG_DIR}/syncthing.sh /usr/bin/syncsh
	fi
	cp -RP $QPKG_DIR/certs/* /etc/ssl/certs/
        if [ -e /usr/share/ca-certificates ] ; then
                rm -f /usr/share/ca-certificates
        fi
        ln -s $QPKG_DIR/ca-certificates /usr/share/ca-certificates
	if [ ! -e /usr/bin/syncthing-cli ] ; then
		ln -s ${QPKG_DIR}/syncthing-cli /usr/bin/syncthing-cli
	fi
	touch /root/.syncthing.lock
fi

case "$1" in

start)
	REP=`/sbin/getcfg syncthing Enable -u -d FALSE -f /etc/config/qpkg.conf`
    if [ "$REP" != "TRUE" ] ; then
            echo "syncthing is not Enable"
            /sbin/log_tool -t 2 -a "syncthing is Disable can't be started ... "
            exit 1
    fi
	change_apache
	echo "Start services: syncthing"
	# reserved if use daemon_mgr later
	# export STNORESTART=TRUE
	ADDRIP=`/sbin/getcfg global guiAddress -d "0.0.0.0:8090" -f ${QPKG_DIR}/syncthing.conf`
	REP=`/sbin/getcfg global guihttps -d "NO" -f ${QPKG_DIR}/syncthing.conf`
	if [ "$REP" = "YES" ] ; then
		HTTPSGUI=https
	else
		HTTPSGUI=http
	fi
	LWD=`pwd`
	cd ${QPKG_DIR}
    	shft "sync.log"
   	## date >"${fspec}" #DEBUG code
	REP=`/sbin/getcfg global Log -d "NO" -f ${QPKG_DIR}/syncthing.conf`
	LOGSY=""
	if [ "$REP" = "YES" ] ; then
		LWD=`pwd`
		cd ${QPKG_DIR}
    	shft "sync.log"
		cd $LWD
		LOGSY=">${QPKG_DIR}/sync.log 2>&1"
	fi
	export STGUIADDRESS=${HTTPSGUI}://${ADDRIP}
	export HOME=${QPKG_DIR}
	# export STNORESTART=yes
	REP=""
	REP=$(/sbin/getcfg global gogc -d "100"  -f ${QPKG_DIR}/syncthing.conf)
	export GOGC=$REP
	REP=$(/sbin/getcfg global gomaxprocs -d "0" -f ${QPKG_DIR}/syncthing.conf)
	if [ "$REP" != "0" ] ; then
		PRO=$(cat /proc/cpuinfo | grep processor | wc -l | tr -d " ")
		if [ $REP -le $PRO ] ; then
			export GOMAXPROCS=$REP
		fi
	fi

	/sbin/daemon_mgr syncthing start "$DAEMON -home ${QPKG_DIR}/config  $LOGSY &"

	/sbin/log_tool -t 0 -a "syncthing is started $STGUIADDRESS GOGC=$GOGC GOMAXPROCS=$GOMAXPROCS "
;;

stop)
	echo "Stop services: syncthing"
	/sbin/daemon_mgr syncthing stop "$DAEMON"
	killall syncthing
	/sbin/log_tool -t 0 -a "syncthing server is stopped"
;;

restart)
	$0 stop
	sleep 5
	$0 start
;;
set_x86)
	MACHINE=`/bin/uname -m`
	if [ "${MACHINE}" = "x86_64" ] ; then
		$0 stop
		sleep 2
		rm -f ${QPKG_DIR}/syncthing
		/bin/ln -s ${QPKG_DIR}/syncthing.386 ${QPKG_DIR}/syncthing
		$0 start
		/sbin/setcfg Global Use_x86 "TRUE" -f ${QPKG_DIR}/syncthing.conf
	fi
;;
set_x86_64)
	MACHINE=`/bin/uname -m`
	if [ "${MACHINE}" = "x86_64" ] ; then
		$0 stop
		sleep 2
		rm -f ${QPKG_DIR}/syncthing
		/bin/ln -s ${QPKG_DIR}/syncthing.amd64 ${QPKG_DIR}/syncthing
		$0 start
		/sbin/setcfg Global Use_x86 "FALSE" -f ${QPKG_DIR}/syncthing.conf
	fi
;;
status)
	REP=`/sbin/getcfg syncthing Enable -u -d FALSE -f /etc/config/qpkg.conf`
    if [ "$REP" != "TRUE" ] ; then
		echo " syncthing is Disable"
	else
		echo " syncthing is Enable"	
		MACHINE=`/bin/uname -m`
		if [ "${MACHINE}" = "x86_64" ] ; then
			REP=""
			REP=$(/sbin/getcfg global Use_x86 -f ${QPKG_DIR}/syncthing.conf)
			echo "x86 mode (use x86 exec in place of x86_64) : "
			echo "   x86 mode is set to : $REP "
		fi
		echo " herefater task running one with select multiple with fork"
		ps -eaf | grep -v grep | grep syncthing 
		echo " QPKG version "
		echo `/sbin/getcfg syncthing Version -d "xx-yyy" -f /etc/config/qpkg.conf | /bin/tr -s " " | /bin/cut -f 1 -d "-"`
		echo " Syncthing version from qpkg.conf"
		echo `/sbin/getcfg syncthing Version -d "xx-yyy" -f /etc/config/qpkg.conf | /bin/tr -s " " | /bin/cut -f 2 -d "-"`
		if [ ! -z "$2" ] ; then
			echo " QPKG Config File "
			cat ${QPKG_DIR}/syncthing.conf
			echo " Syncthing config file "
			cat /root/.config/syncthing/config.xml
		fi
	fi
;;

qpkg_enable)
	/sbin/setcfg syncthing Enable "TRUE" -f /etc/config/qpkg.conf
;;

qpkg_disable)
	/sbin/setcfg syncthing Enable "FALSE" -f /etc/config/qpkg.conf
;;
set_log)
	/sbin/setcfg global Log "YES" -f ${QPKG_DIR}/syncthing.conf
;;
unset_log)
	/sbin/setcfg global Log "NO" -f ${QPKG_DIR}/syncthing.conf
;;
set_new_version)
	QPKGV=`/sbin/getcfg syncthing Version -d "xx-yyy" -f /etc/config/qpkg.conf | /bin/tr -s " " | /bin/cut -f 1 -d "-"`
	if [ ! -z "$2" ] ; then
		/sbin/setcfg syncthing Version "${QPKGV}-${2}" -f /etc/config/qpkg.conf
	fi
;;
*)
	echo "Usage is :"
	echo " $0 start|stop|restart "
	echo " $0 set_x86|set_x86_64 (ONLY applicable for 64 bits kernel : stop then replace exec. by x86 or amd64 one then restart)"
	echo " $0 status [full]"
	echo " $0 qpkg_anable|qpkg_disable "
	echo " $0 set_log|unset_log (need a restart to be use"
	echo " AFTER internal Update you can change Syncthing version in QPKG "
	echo " $0 set_new_version VERSION ( example VERSION = 0.9.10 check in GUI after internal update )"
	
;;

esac

It should work if you add it to the existing export lines, for the start command. Like:

...
start)
...
	export STGUIADDRESS=${HTTPSGUI}://${ADDRIP}
	export HOME=${QPKG_DIR}
        <-- here -->
        # export STNORESTART=yes

That file will probably be overwritten the next time you update the QNAP package, and you need to do it again.

wweich, that did the trick. I was not aware before today that my QNap had a tmp file located in another location. Is this a linux vesrion of a RAM drive used by Microsoft a few years back ?

I have another question: since the old /tmp folder was filled with syncthing temporary files, would it be prudent to delete the files inside it, or it will clean itself on the next reboot of the NAS ?

Again thanks for your help wweich!

-Eric

It should be no problem, if you remove all the syncthing-db.* folders from /tmp.

/tmp is normally cleared on reboot.