How to autostart Syncthing (ARM) on OpenWrt?

Hello LEDErs.

First of all, sorry If I should post this on the Syncthing forum instead of the LEDE one, as I cannot address the origin of the issue.

I have downloaded latest (0.14.49) Syncthing ARM from official site, installed to my LEDE 17.01.05 Linksys WRT1900ACS router, launched from SSH console, configured it via config.xml to be accesible from any IP address ( and everything works great.

Now, I would like to make it to autostart everytime the router gets rebooted, so I found an autostart script from a repository at β€œ 1”, placed on β€œ/etc/init.d/” and launched the command β€œ/etc/init.d/syncthing enable”.

The problem is that now whenever I reboot, the GUI cannot be accessed at port 8384 (it gives a 404 error) like when I manually launch it. And when I try to launch it manually, it stops because it detects that the service is already in use (?):

09:10:25 FATAL: Starting API/GUI: listen tcp bind: address already in use
09:10:25 INFO: Syncthing exited: exit status 1

I have to manually delete the autostart script and disable it so I can manualy launch Syncthing again from SSH console.

I guess the autostart script is outdated (+3 years ago) and there is some conflict but my UNIX knowledge is very poor as you can see. The code seems pretty simple, though:


start() { service_start /usr/bin/syncthing 2>&1 | logger -t syncthing & }

stop() { service_stop /usr/bin/syncthing }

Is any other way to make it to autostart whenever the router is on?

Thanks in advance.

A 404 error means that there is some software listening to that port and answering the queries, and the fact that you cannot start a new instance of syncthing unless you stop it before confirms that indeed syncthing is up and running.

So, it looks like syncthing cannot find something when launched from init.d. Can you just log into your machine and execute /usr/bin/syncthing? Or do you need to execute anything before (a cd, for example)?

1 Like

Thank you for the pront response.

Yeah, I just log in via SSH to my router and type directly "syncthing" and it calls "/usr/bin/syncthing" so the service gets started (same with transmission and so on).

I think the script may be outdated, probably with the way syncthing needs to get autostarted (it has been +3 years since last commit), as if it would need "something more" to be executed or in another way, as you are right, syncthing is started but not accesible (and the config is the same for both the autostart script and when manually launched). Unless I stop it, I cannot launch it manually 8when launched manually it works perfectly)

The script could be outdated (it has been ages since I ran syncthing myself), but if it does the same as you do from the command line, the results should be the same; and I can not find any difference...

Have you seen any message on the logs? Simply run "logread -f" on the router, then try to access the config page, and see if you can spot any relevant message.

1 Like

Observing the logs gave me the hint why it is not working.

user.notice syncthing: [BKHMZ] 13:45:09 INFO: GUI and API listening on
user.notice syncthing: [BKHMZ] 13:45:09 INFO: Access the GUI via the following URL:

The service is up and running after every reboot, but the GUI is not listening on the correct address as stated in the config file (/root/.config/syncthing/config.xml). It is listening only for localhost connections (, but I am trying to access it from a LAN connection (and after I get it configured, I will need to access it from a WAN connection), so I would need it to be, so it does not bind to any IP address.

The config file is correct on the listening part:

<gui enabled="true" tls="false">

But it only gets correctly taken on the session I install syncthing and launch it for the first time, if I reboot and launch syncthing again (manually or via init.d script) it listens on

If I do:

/etc/init.d/syncthing reload


/etc/init.d/syncthing restart

The service gets reloaded/restarted correctly but it continues to listen on the wrong address (

I do not know why, but there is another "config.xml" file on "/", apart from the one at "/root" (with different syncthing ID and so on). I tried to edit it and swap the part with the one, but when I launch syncthing it continues listening on

Apart from it, it has appeared after the reboot the default "Sync" folder on "/" apart from the one at "/root" (and from the /overlay one which is normal) so it seems it is getting everything duplicated.

Well, at least I know it is working but only not accesible for anything but localhost. I now need to get syncthing to take the values at the config.xml file and find out why I got it duplicated on "/" and on "/root".

My guess is that the current directory when you log into your router is "/root"; but when it is executed from "init.d", the current directory is simply "/". Those extra config files you are finding where probably created by "syncthing", when it found no other config file there.

I would try to edit the init script and add a "cd /root" somewhere before executing the binary.

1 Like

Thank you, I will try it.

In 3 days is expected the OpenWRT 18.06 final to be released,

Is there any chance a Syncthing ipk package could be officially included in the repositories? I have surfed the directories but I have no found it and I do not know if it could be included in a near future (a "luci-app-syncthing" would be great too)

I think it is a great sync program, and given the router has >128MB RAM it works flawlessly.