Categories
Homelab

[Linux] Syncthing – read-only file system when running as service

I’ve been using Syncthing for a while to synchronize my working copy with a local dev server for a few months.

At first I was using it by logging in and running it manually through the CLI. It was working well, so I didn’t think twice when I moved to run it as a service. It started, it synced some data, everything was fine.

Until it wasn’t, of course! šŸ™‚

Turns out that I didn’t notice a bunch of errors cropping up in the logs mentioning that the filesystem on the dev server is read-only and it was causing Syncthing to not sync anything.

I thought it was a bug and it was just showing Out of Sync for the folders, but it was actually syncing. Well I was wrong.

After debugging for a few hours and not finding any clues whatsoever in the forums through a few Google searches, I landed on an Syncthing article on the ArchWiki, mentioning my exact case:

read-only file system error on /etc although run as root

This was my exact usecase, apart from the problematic folder not being /etc, but /usr/local/src.

Well, after reading what it said, it turns out that if you run Syncthing (or anything) via systemd and you have ProtectSystem set for the service to full, it will make some directories read-only by default. /usr is one of those paths.

To fix it, you need to add a new line in the service config and restart the service (and daemon-reload):

ReadWritePaths=/usr/local/src

After this Syncthing should work fine.

Biser Perchinkov's avatar

By Biser Perchinkov

Look, a coder!

One reply on “[Linux] Syncthing – read-only file system when running as service”

Many thanks for hunting this down and sharing your solution. I was experiencing the same issue and your post worked perfectly for fixing it.

Like

Leave a comment