syncthing fails to start on dietpi - cert error

syncthing fails to start on dietpi. Log shows error: [start] 2019/11/14 04:09:23 INFO: syncthing v1.3.1 “Fermium Flea” (go1.13.3 linux-arm) teamcity@build.syncthing.net 2019-10-07 11:30:25 UTC [start] 2019/11/14 04:09:23 INFO: Generating ECDSA key and certificate for syncthing… [start] 2019/11/14 04:09:24 WARNING: Failed to load/generate certificate: save cert: open /mnt/dietpi_userdata/syncthing/cert.pem: permission denied

The very first dietpi build worked great on my pi. I decided to scrap it and rebuild. Ever since I have been getting this error when I try to start syncthing. I loaded it using dietpi management.

Syncthing (or, the user it runs as) doesn’t have write permissions on the indicated directory. It needs that.

For Dietpi specifically, the solution can be found here:

Summary:

chown -R dietpi:dietpi /mnt/dietpi_userdata/syncthing*
systemctl restart syncthing