Syncthing broke

No Idea what’s happening here:

Broadcast message from systemd-journald@syncloud (Wed 2024-02-21 19:12:48 UTC):

nginx[5454]: 2024/02/21 19:12:47 [emerg] 5454#0: bind() to unix:/var/snap/syncthing/common/web.socket failed (98: Address already in use)


Message from syslogd@syncloud at Feb 21 19:12:48 ...
  nginx: 2024/02/21 19:12:47 [emerg] 5454#0: bind() to unix:/var/snap/syncthing/common/web.socket failed (98: Address already in use)

Accessing the Syncthing web UI gave Error 502 Bad Gateway.
So I did snap disable syncthing to kill it and the error messages disappeared. How to fix? I didn’t do any manual app configuration or app installation lately – maybe this is an issue with a different snap app that got updated recently?

Cheers

Can you show the version you have?

snap list

There was an update in v129 to fix that

Name       Version  Rev   Tracking       Publisher  Notes
gogs       249      249   latest/stable  syncloud✓  -
grocy      74       74    latest/stable  syncloud✓  -
nextcloud  775      775   latest/stable  syncloud✓  -
platform   2046     2046  latest/stable  syncloud✓  base
syncthing  129      129   latest/stable  syncloud✓  disabled

This happened when trying to re-enable it:

root@syncloud:~# snap enable syncthing
2024-02-22T17:01:23Z INFO added auto-connect task
Start snap "syncthing" (129) services                                          -
Broadcast message from systemd-journald@syncloud (Thu 2024-02-22 17:01:37 UTC):

nginx[14225]: 2024/02/22 17:01:37 [emerg] 14225#0: bind() to unix:/var/snap/syncthing/common/web.socket failed (98: Address already in use)


Message from syslogd@syncloud at Feb 22 17:01:37 ...
  nginx: 2024/02/22 17:01:37 [emerg] 14225#0: bind() to unix:/var/snap/syncthing/common/web.socket failed (98: Address already in use)
Start snap "syncthing" (129) services                                          \
Broadcast message from systemd-journald@syncloud (Thu 2024-02-22 17:01:37 UTC):

nginx[14225]: 2024/02/22 17:01:37 [emerg] 14225#0: bind() to unix:/var/snap/syncthing/common/web.socket failed (98: Address already in use)

Start snap "syncthing" (129) services                                          |
Broadcast message from systemd-journald@syncloud (Thu 2024-02-22 17:01:38 UTC):

nginx[14225]: 2024/02/22 17:01:37 [emerg] 14225#0: bind() to unix:/var/snap/syncthing/common/web.socket failed (98: Address already in use)


Message from syslogd@syncloud at Feb 22 17:01:38 ...
  nginx: 2024/02/22 17:01:37 [emerg] 14225#0: bind() to unix:/var/snap/syncthing/common/web.socket failed (98: Address already in use)
Start snap "syncthing" (129) services                                          |
Broadcast message from systemd-journald@syncloud (Thu 2024-02-22 17:01:38 UTC):

nginx[14225]: 2024/02/22 17:01:37 [emerg] 14225#0: bind() to unix:/var/snap/syncthing/common/web.socket failed (98: Address already in use)


Message from syslogd@syncloud at Feb 22 17:01:38 ...
  nginx: 2024/02/22 17:01:37 [emerg] 14225#0: bind() to unix:/var/snap/syncthing/common/web.socket failed (98: Address already in use)
Start snap "syncthing" (129) services                                          /
Broadcast message from systemd-journald@syncloud (Thu 2024-02-22 17:01:39 UTC):

nginx[14225]: 2024/02/22 17:01:37 [emerg] 14225#0: bind() to unix:/var/snap/syncthing/common/web.socket failed (98: Address already in use)


Message from syslogd@syncloud at Feb 22 17:01:39 ...
  nginx: 2024/02/22 17:01:37 [emerg] 14225#0: bind() to unix:/var/snap/syncthing/common/web.socket failed (98: Address already in use)
Start snap "syncthing" (129) services                                          -
Broadcast message from systemd-journald@syncloud (Thu 2024-02-22 17:01:39 UTC):

nginx[14225]: 2024/02/22 17:01:37 [emerg] 14225#0: still could not bind()


Message from syslogd@syncloud at Feb 22 17:01:39 ...
  nginx: 2024/02/22 17:01:37 [emerg] 14225#0: still could not bind()
2024-02-22T17:01:41Z INFO Waiting for "snap.syncthing.syncthing.service" to
stop.
error: cannot perform the following tasks:
- Start snap "syncthing" (129) services (systemctl command [start snap.syncthing.nginx.service] failed with exit status 1: Job for snap.syncthing.nginx.service failed because the control process exited with error code.
See "systemctl status snap.syncthing.nginx.service" and "journalctl -xe" for details.
)
root@syncloud:~# systemctl status snap.syncthing.nginx.service
Unit snap.syncthing.nginx.service could not be found.

journalctl -xe includes a lot of personal info. Would it be worth filtering?
snap remove then snap install will not remove my syncthing configuration, right?

Can you run this:

cat /snap/syncthing/current/bin/service.nginx.sh

And then

snap restart syncthing

Do not run remove as it will remove the config, make sure you make a backup first from the app page.
Let’s try to understand what is happening first before removing anything.
Nginx service removes this file on start, if it fails to do so probably aomething wrong with filesystem.
Let’s see what commands above produce first.

root@syncloud:~# cat /snap/syncthing/current/bin/service.nginx.sh
cat: /snap/syncthing/current/bin/service.nginx.sh: No such file or
directory
root@syncloud:~# cat /snap/syncthing/129/bin/service.nginx.sh
#!/bin/bash -e

DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )

. /var/snap/syncthing/current/config/syncthing.env

/bin/rm -f ${SNAP_COMMON}/common/web.socket
/bin/rm -f ${SNAP_COMMON}/log/nginx*.log
timeout 60 /bin/bash -c 'until echo > /dev/tcp/localhost/'$SYNCTHIN
G_PORT'; do sleep 10; done'
exec ${DIR}/nginx/sbin/nginx -c ${SNAP_DATA}/config/nginx.conf -p $
{DIR}/nginx -e stderr
root@syncloud:~# snap restart syncthing
error: cannot perform the following tasks:
- Run service command "restart" for services ["syncthing"] of snap
"syncthing" (systemctl command [stop snap.syncthing.syncthing.servi
ce] failed with exit status 5: Failed to stop snap.syncthing.syncth
ing.service: Unit snap.syncthing.syncthing.service not loaded.
)

Could you send logs from Settings - Support (include support) please?

Ok nothing in the logs.

Can you do

snap start syncthing
root@syncloud:~# snap start syncthing
2024-02-24T00:11:00Z INFO While trying to stop previously started
service "snap.syncthing.nginx.service": systemctl command [stop
snap.syncthing.nginx.service] failed with exit status 5: Failed to
stop snap.syncthing.nginx.service: Unit
snap.syncthing.nginx.service not loaded.

2024-02-24T00:11:00Z INFO While trying to stop previously started
service "snap.syncthing.syncthing.service": systemctl command [stop
snap.syncthing.syncthing.service] failed with exit status 5: Failed
to stop snap.syncthing.syncthing.service: Unit
snap.syncthing.syncthing.service not loaded.

error: cannot perform the following tasks:
- Run service command "start" for services ["syncthing"] of snap "s
yncthing" (systemctl command [start snap.syncthing.syncthing.servic
e] failed with exit status 5: Failed to start snap.syncthing.syncth
ing.service: Unit snap.syncthing.syncthing.service not found.
)

Sorry it is still disabled, can you run

snap enable syncthing 
root@syncloud:~# snap enable syncthing
Start snap "syncthing" (129) services                                                        /
Broadcast message from systemd-journald@syncloud (Sat 2024-02-24 13:31:04 UTC):

nginx[7212]: 2024/02/24 13:31:04 [emerg] 7212#0: bind() to unix:/var/snap/syncthing/common/web.socket failed (98: Address already in use)


Message from syslogd@syncloud at Feb 24 13:31:04 ...
  nginx: 2024/02/24 13:31:04 [emerg] 7212#0: bind() to unix:/var/snap/syncthing/common/web.socket failed (98: Address already in use)
Start snap "syncthing" (129) services                                                        /
Broadcast message from systemd-journald@syncloud (Sat 2024-02-24 13:31:04 UTC):

nginx[7212]: 2024/02/24 13:31:04 [emerg] 7212#0: bind() to unix:/var/snap/syncthing/common/web.socket failed (98: Address already in use)


Message from syslogd@syncloud at Feb 24 13:31:04 ...
  nginx: 2024/02/24 13:31:04 [emerg] 7212#0: bind() to unix:/var/snap/syncthing/common/web.socket failed (98: Address already in use)
Start snap "syncthing" (129) services                                                        -
Broadcast message from systemd-journald@syncloud (Sat 2024-02-24 13:31:05 UTC):

nginx[7212]: 2024/02/24 13:31:04 [emerg] 7212#0: bind() to unix:/var/snap/syncthing/common/web.socket failed (98: Address already in use)


Message from syslogd@syncloud at Feb 24 13:31:05 ...
  nginx: 2024/02/24 13:31:04 [emerg] 7212#0: bind() to unix:/var/snap/syncthing/common/web.socket failed (98: Address already in use)
Start snap "syncthing" (129) services                                                        \
Broadcast message from systemd-journald@syncloud (Sat 2024-02-24 13:31:05 UTC):

nginx[7212]: 2024/02/24 13:31:04 [emerg] 7212#0: bind() to unix:/var/snap/syncthing/common/web.socket failed (98: Address already in use)


Message from syslogd@syncloud at Feb 24 13:31:05 ...
  nginx: 2024/02/24 13:31:04 [emerg] 7212#0: bind() to unix:/var/snap/syncthing/common/web.socket failed (98: Address already in use)
Start snap "syncthing" (129) services                                                        |
Broadcast message from systemd-journald@syncloud (Sat 2024-02-24 13:31:06 UTC):

nginx[7212]: 2024/02/24 13:31:04 [emerg] 7212#0: bind() to unix:/var/snap/syncthing/common/web.socket failed (98: Address already in use)


Message from syslogd@syncloud at Feb 24 13:31:06 ...
  nginx: 2024/02/24 13:31:04 [emerg] 7212#0: bind() to unix:/var/snap/syncthing/common/web.socket failed (98: Address already in use)
Start snap "syncthing" (129) services                                                        /
Broadcast message from systemd-journald@syncloud (Sat 2024-02-24 13:31:06 UTC):

nginx[7212]: 2024/02/24 13:31:04 [emerg] 7212#0: still could not bind()

error: cannot perform the following tasks:
- Start snap "syncthing" (129) services (systemctl command [start snap.syncthing.nginx.service] failed with exit status 1: Job for snap.syncthing.nginx.service failed because the control process exited with error code.
See "systemctl status snap.syncthing.nginx.service" and "journalctl -xe" for details.
)

Sorry it took me so long time, start script ia incorrectly removing the file.

Can you run thiese commands:

rm /var/snap/syncthing/common/web.socket
snap enable syncthing

I will publish a fix asap.

Yeah that worked! Thanks :+1:

1 Like