Why Are Remote Devices Disconnected?

I got syncthing working fine yesterday and did a lot of testing. It works great. Today when I signed into my two computers I see Remote Devices.

Disconnected

I added two images to my shared Images folder on one computer and nothing happened.

Are they not supposed to connect automatically? I see the syncthing service service running fine on both computers. I ran netstat -tpln he service is listening on the correct port on both computers. I ran the journalctl command on both sides.

$ journalctl -r -u syncthing.service 
-- No entries --

I waited for more than an hour to see if they would automatically connect but they did not. I have searched other posts on a solution to this issue.

I am running syncthing 1.22.0 on both Linux computers.

(I’m assuming this is a continuation of your earlier posts under the topic How Do I Sync a Folder Under a Different Profile…)

Questions:

  • When you ran netstat -tpln, where you logged on as “root” or one of the regular users? (Based on the journalctl command output, it looks like a regular user.)
  • Output from systemctl --user status syncthing.service
  • Screenshots from the computers of Syncthing’s web GUI with the device panels expanded to show the details?
1 Like

This is not a continuation of my previous post. The other post is resolved.

I am an experienced Linux user of more than a decade. I never login as root.

systemctl status shows the service running fine.

systemctl --user status syncthing.service
Dec 28 11:11:35 fedora syncthing[1878]: [A2YBN] INFO: Ready to synchronize "Images" (c4r1d-tzlpj) (sendreceive)
Dec 28 11:11:35 fedora syncthing[1878]: [A2YBN] INFO: Completed initial scan of sendreceive folder "Images" (c4r1d-tzlpj)

No offense intended. :slightly_smiling_face:

I just need to know of it’s the same hardware and software setup as the previous post involving two users running Syncthing independently. If it’s not, then details about the current setup are needed.

1 Like

No offense taken. Thank you for your assistance. How would you troubleshoot this?

So it’s the same environment as your earlier post?

1 Like

Yes. I just have two computers running Linux on the same LAN. There is no relay or going over the WAN.

On one of the computers…

  1. Log off all user accounts.
  2. Log back on as only one of the users.
  3. How many syncthing processes are running when you do a ps -ef | grep syncthing?

There are two processes running.

Do the two processes belong to the same user as the one you’re logged on as? – i.e., No Syncthing processes running for the other non-root user?

Yes, they belong to the same user.

So the reason you’re randomly seeing “Disconnected” status for remote devices is because of the way that systemd works.

As you’re already aware, the command systemctl --user enable syncthing.service tells systemd that you want Syncthing to auto-start for the current user.

After the command above has been issued, any of the following actions will result in Syncthing auto-starting for that user:

  • systemctl --user start syncthing.service
  • Logging off and logging back on again.

However, if the system is rebooted and no users log on afterwards, no instances of Syncthing will be auto-started.

That’s because systemd starts and stops user services at logon and logoff – i.e., Syncthing only runs for a user when the user is interactively logged in. As soon as the user logs off, it’s like issuing the command systemctl --user stop syncthing.service.

In order for a user service to persist between interactive login sessions, log on as the intended user and issue the following command:

loginctl enable-linger

It tells systemd that you want all enabled user services for the intended user to auto-start at system boot time and to continue running whether or not the intended user is interactively logged on.

With the Syncthing service running 24x7x365, the only times it’ll appear disconnected to other Syncthing devices is if there’s a connectivity issue.

1 Like

Thansk for the detailed response.

Are you saying that the problem is syncthing.service is not running? Syncthing has been running for 4+ hours on both computers. The service started as soon as I logged in.

Active: active (running) since Wed 2022-12-28 11:11:34 EST; 4h 0min ago

Why would the two computers not connect to each other to synconize?

Yes, that’s at least one of the issues. I bet if you do a last, the line that says “still logged in” for the user is at least 4+ hours old.

If you were to log off, within a few seconds any Syncthing peer that’s linked to the Syncthing instance on that particular computer would update the status to “Disconnected”.

I’d need to see at least screenshots of Syncthing’s web GUI (with the relevant panels expanded) to be able to debug further because there are all kinds of other external factors besides Syncthing itself that can cause sync failures.

Alternatively, if sharing more details isn’t possible, check under Actions → Logs. Besides the default log output, there are a bunch of debugging features that can be toggled on/off.

(This forum also has a direct message feature if you’d prefer that instead.)

Thanks for your help. I found the solution to the problem.

I looked at another post on the same issue and found something interesting.

It is possible to specify the devices by IP address and port instead of “dynamic”. That way devices connect faster. In the Remote Devices > Edit > Advanced, I deleted the word “dynamic” and added tcp://192.168.0.33:22022. On the other host I added tcp://192.168.0.34:22022 and they connected instantly. I no longer see the word “Disconnected”.

Client A: 192.168.0.33

Client B: 192.168.0.34

Everything is working fine now.

1 Like

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