Autostart on OpenELEC using systemd

Hello there! I am using a RaspberryPi with OpenELEC on it as a MediaCenter, have BTSync already running on on it, and thought about setting up syncthing for experimental purposes. Downloading, starting, connecting and syncing Files from the attached NAS: worked fine. Autostarting syncthing on boot: not as simple as I expected

OpenELEC has a, but due to the fact I was unable to daemonize syncthing on OpenELEC, I switched to systemd using the provided file [“etc/linux-systemd/system”][1]. I got a lot of syncthing[700]: 13:10:05 FATAL: mkdir ": read-only file system errors, and tried every possible combination of different parameters and settings within those files (searching the web did not really help) so I switched to the provided file [“etc/linux-systemd/user”][2]. That got me the error syncthing[862]: 13:38:21 FATAL: home: No home directory found - set $HOME (or the platform equivalent). although i added the parameter -home="/storage/.config/syncthing" (which is the default config-path) So i googled how to add environment variables to systemd-scripts and edited my file to

Description=Syncthing - Open Source Continuous File Synchronization

ExecStart=/storage/syncthing/syncthing -home=/storage/.config/syncthing
RestartForceExitStatus=3 4


Removing either the Environment-Variable or the -home-Parameter results in syncthing not starting. Well, this works for me, but I find it kind of strange to have to provide the home-Path twice, so is this an error or expected behavior? (And I felt like posting this somewhere, so other users trying to get syncthing autostarting on OpenELEC can read it :blush:) [1]: [2]:

Thanks for this it was very useful!

A while later I found another solution which might be handy for those who simply want OpenElec to run things at start-up including Syncthing, and don’t need daemonised processes:

From - is run on system startup. It can be used to run commands before XBMC/Kodi starts. To create it simply use nano

nano /storage/.config/

So for my Syncthing setup the looked like this on OpenElec:

) &

I also added another line to have the make a text file telling me how much free space was left on the remote drives, and use Syncthing to sync it to my local folder:

 sleep 30; df -h | grep /dev/sd > /var/media/[your-Sync-Folder-here]/freespace.txt
) &

The sleep is necessary to let OpenElec mount the drive before putting the text file into it.

Hope it’s useful to someone :slight_smile:

1 Like

Thanks this is a great tip! Until OSMC comes out as alternative for OpenElec, I am stuck with OpenElec so I was looking for a solution like this.

Unfortunately for me, it does not want to start Syncthing, “Permission denied”. I am on OpenElec 5.0.8 and try to use Syncthing for the first time. I login as root via SSH, I do not understand why I get this message.


sleep 2
mkdir /media/esata
mount -O move /media/mydrivelabel /media/esata
) &

I have a Cubox-i4 Pro and a eSATA HDD connected to it. All my media is expected by Kodi to be on /media/esata/ so I need those first two commands to make sure my HDD is mapped to that path. But those commands don’t affect yours as this is the output when I run the script:

CuboxTV:/ # /storage/.config/ line 7: /storage/syncthing/syncthing: Permission denied

How can I run Syncthing succesfully?

====== SOLVED:

CuboxTV:~ # cd /storage/syncthing
CuboxTV:~/syncthing # chmod +x syncthing

and a note for others and myself in the future:

nano /storage/.config/syncthing/config.xml

Final steps:

  1. Modify to to be able to access the webUI on other systems.
  2. Go to the webui, Settings and set a username and password with HTTPS checked.

Is /storage/syncthing/syncthing marked as executable?

1 Like

that was the mistake, I updated my post :slight_smile:


Hi there I found this forum while searching for a solution to run btsync on my raspberry i´m stuck afer

nano /etc/apt/sources.list.d/btsync.list past following lines: deb wheezy main contrib non-free deb-src wheezy main contrib non-free

while following this tutorial

I really don´t have a clue about how to set up btsync due openelec hasn’t activate apr-get command so any help would be very highly appreciated!

obviously I´m a complete newbie…

Thank you very much for any support and help


@rubbo this is the forum for Syncthing not BTSync :wink:

1 Like

Holy MOther of God…sorry about that… after googleing I found the very first post and I saw a light of hope…

keep searching


1 Like

Why don’t you switch to Syncthing on your Raspberry?

1 Like

Don’t forget to set a username and password. Please add this to your notes, thx

1 Like