Starting insync-headless with systemd (or a fix for the autostart method)


I have a Debian 9 stretch install which I am setting up to use as a music server but also as a backup machine for my dropbox and goodgle drive accounts. I have managed to install dropbox and get it started using systemd as a background process on boot up.

I have installed insync without a problem and sync’d to my google drive. I used the autostart command which comes with insync headless which works well BUT when this is enabled, it interferes with unmounting my /home partition and unmounting fails at shutdown. I have localised it to the insync-headless service as when I quit this prior to shutting down there is no unmounting error.

Needless to say I don’t want my /home partition to become corrupted over time with unmounting being an issue.

My thought was to use systemd to start/stop the insync-headless service so it was definitely stopped prior to unmounting at shutdown. I have tried to setup a systemd .service file in /etc/systemd/system/ with various files posted around the internet and enable with systemctl but I keep getting an invalid argument error.

I don’t have enough experience with systemd at present to know how to sort this out, or why insync-headless won’t let me unmount my /home partition. I will keep reading about systemd service files but any help would be greatly appreciated.




Tagging our engineer @jimperio and he will get back to you.


Other community members want to hear solution too, please post it here.


Hey @Murz,

Thanks for the input! Tagging our engineer @Kurt_Ko.


as i had the same idea as ollie i found this thread but unfortunately dead end after passing the inquiry to the engineer :slight_smile: so i started googleing and reading around and created myself something working for me. it is not tested until the very end in order to ensure functionality in all use cases but if you like to give it a try or even improve my solution, please feel free to do so.

i am not responsible if you loose your valuable data (i.e. cat pictures or videos, etc) nor if this planet gets destroyed unexptedly :slight_smile:

my task was to automate the start and stop of insync-headless on my openmediavault based nas (debian 9) so insync-headless is getting started at boot time after network is up and getting stopped when the machine gets rebooted or powered off.

the command insync-headless set_autostart yes does not work as it requires a login with running xsession and usually my machine starts up and nobody logs in but for maintenance reason.

all actions taken require root privileges:

1. create a file /etc/systemd/system/insync-headless.service and fill it with this content:

Description=Insync Headless



2. create another file /usr/lib/insync/ and fill it with this content:
/usr/bin/insync-headless start

3. create another file /usr/lib/insync/ and fill it with this content:
/usr/bin/insync-headless quit

4. make both files from step 2 and 3 executable:
chmod u+x /path/to/spark/sbin/
chmod u+x /path/to/spark/sbin/

5. test the start and stop script (allow some 20-30 seconds between start and stop script command as insync requires this time to come up and run):
systemctl start insync-headless

check if insync is running:
pgrep -l insync

should give you something like the next line (process number is most likely a different one):
2259 insync

now (after waiting some seconds) test the stop command:
systemctl stop insync-headless

check if insync is still running:
pgrep -l insync

should give you no result at this time.

6. finally enable autostart:
systemctl enable insync-headless

you are done.

any suggestions, improvement or other type of feedback is welcome.

best regards

Insync Headless autostart?