moved the config directory to mounted ssd but can't run it

hey, I’m on RPI and I moved the entire directory to /home/pi/usb/.syncthing_config also changed /lib/systemd/system/syncthing.service to

ExecStart=/usr/bin/syncthing -/home/pi/usb/.syncthing_config -no-browser -no-restart -logflags=0

accordingly.

But I can’t open the GUI after restarting (I moved back to the old location in the meantime), am I missing something?

If you take a step back, do you think there is enough information here for us to be able to help you?

There are no logs (which I suspect would allow you to answer this yourself), we don’t know how you installed syncthing, how are you running it (user service or system service), there is pretty much no information that would allow us to help you.

I can say this is wrong though:

At minimum that should be something like

ExecStart=/usr/bin/syncthing -home /home/pi/usb/.syncthing_config

2 Likes

After moving Syncthing’s config directory, just create a symbolic link pointing from the default location to the new one:

ln -s /home/pi/usb/.syncthing_config /home/pi/.config/syncthing

It’s much simpler – and more importantly – avoids making manual changes to systemd’s unit files under /lib/systemd/system/ which are distributed with software packages. During system updates, any custom changes will be overwritten, customized files renamed, and/or newer versions will be set aside by the package manager.

1 Like

thank you guys :+1:, I’ll look into these recipes

this seems appealing, but how can I check if the symlink is working and the linked dir is used? I’m rather a linux novice and I renamed the original config.xml and it did not start, so I had to revert Thanks

So if you started with Syncthing’s config directory being at /home/pi/.config/syncthing, and want to relocate it to /home/pi/usb/.syncthing_config, the first step is to move it…

mv /home/pi/.config/syncthing /home/pi/usb/.syncthing_config

… then to confirm that it’s been moved, just check the contents of the original directory…

ls -l /home/pi/.config

… before creating the symbolic link (aka. “soft link”, and often abbreviated as “symlink”)…

ln -s /home/pi/usb/.syncthing_config /home/pi/.config/syncthing

… and finally testing the symlink to see if you can access config.xml:

cat /home/pi/.config/syncthing/config.xml

If you don’t get any errors, you’re good to go (don’t forget to undo the changes you made earlier to /lib/systemd/system/syncthing.service).

Now launch Syncthing and verify that all your folders and settings are as expected.

Yeah, don’t rename config.xml because it’s what Syncthing is looking for.

Syncthing offers --home, --config and --data options plus the $STDATADIR and $STHOMEDIR environment variables for customizing the location of the directories, but a symlink is often simpler when you’re still getting comfortable using Linux.

And as a bonus, a year from now you won’t have to remember that you had modified a systemd unit file buried in a subdirectory, made menu/desktop shortcuts with additional startup options, and/or set environment variables while upgrading your RPi. Just plug in your SSD, mount it, and recreate the symlink.

okay, thank you for that write up :pray:. I think I did everything you described except I did not move the content for the original directory but just copied it. Not sure what that does. I think I will go over the steps again.

Copying and creating the symlink, e.g…

cp --archive /home/pi/.config/syncthing /home/pi/usb/.syncthing_config
ln -s /home/pi/usb/.syncthing_config /home/pi/.config/syncthing

… results in this:

/
└── home
    └── pi
        └── .config
            └── syncthing
                └── .syncthing_config

In the directory tree above, /home/pi/.config/syncthing/.syncthing_config is a symlink to /home/pi/usb/.syncthing_config.

Expanding the directory tree to include files – because of the symlink – it effectively looks like this:

/
└── home
    └── pi
        └── .config
            └── syncthing
                ├── config.xml
                └── .syncthing_config
                    └── config.xml

While the symlink is valid, Syncthing will still be using the original config at /home/pi/.config/syncthing/config.xml because the extraneous /home/pi/.config/syncthing/.syncthing_config is ignored.

You need /home/pi/.config/syncthing to be the symlink to /home/pi/usb/.syncthing_config for it to work the way that you’re asking for.

OMG, currently I have 2023-12-09_09-47

If this is incorrect, how can I make this right?

No worries, easy fix…

Since you already have a valid looking /home/pi/.config/syncthing directory, issue the following commands exactly as shown:

Stop Syncthing…

syncthing cli operations shutdown

(I don’t know what the situation is with your earlier changes to /lib/systemd/system/syncthing.service, otherwise I’d use systemctl.)

Remove the unwanted synlink…

rm /home/pi/.config/.syncthing_config

Rename the copy of the Syncthing config that you made earlier to the USB SSD in case it still exists…

mv /home/pi/usb/.syncthing_config /home/pi/usb/syncthing_config-old

Move Syncthing’s default config directory to the USB SSD…

mv /home/pi/.config/syncthing /home/pi/usb/.syncthing_config

Create the required symlink pointing to the Syncthing config on the USB SSD so that Syncthing can find it…

ln -s /home/pi/usb/.syncthing_config /home/pi/.config/syncthing

Now Syncthing will look for its files under /home/pi/.config/syncthing and Linux will transparently redirect it to /home/pi/usb/.syncthing_config.

Since you mentioned being a Linux novice, here are two variations of the commands above. :wink:

Shorter…

rm ~pi/.config/.syncthing_config
mv ~pi/usb/.syncthing_config ~pi/usb/syncthing_config-old
mv ~pi/.config/syncthing ~pi/usb/.syncthing_config
ln -s ~pi/usb/.syncthing_config ~pi/.config/syncthing

Even shorter, if you’re logged in as user pi

rm ~/.config/.syncthing_config
mv ~/usb/.syncthing_config ~/usb/syncthing_config-old
mv ~/.config/syncthing ~/usb/.syncthing_config
ln -s ~/usb/.syncthing_config ~/.config/syncthing

OMG, will do this first thing in the morning, thanks a lot for this privatissimum.

Good idea. Sleep is very important. :smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.