2nv2u / gnome-shell-extension-syncthing-indicator

Put an indicator on the panel signalling the Syncthing daemon status using SystemD
https://extensions.gnome.org/extension/1070/syncthing-indicator/
GNU General Public License v3.0
59 stars 10 forks source link

syncthing-indicator not finding running syncthing instance #27

Closed epe closed 1 week ago

epe commented 1 year ago

Hi! I'm getting this error every 20 seconds: gnome-shell[115898]: [syncthing-indicator-manager:ERROR], Service failed to start, syncthing.service gnome-shell[115898]: error: Syncthing Indicator: daemon-error

Unfortunately I cant find documentation about how the indicator expects synthing to be started?

I have configured syncthing to startup via systemd as described in the syncthing docs. ./systemd/system/multi-user.target.wants/syncthing@username.service ./systemd/system/sleep.target.wants/syncthing-resume.service

what can I do to get it working together?

2nv2u commented 1 year ago

Currently the extension uses the user config for systemd, I'll have a look on howto detect the system wide as well.

doronbehar commented 1 year ago

In my case I run syncthing as a system service and it's api key is located in /var/lib/syncthing/.config/syncthing/config.xml - not readable by any user. It would have been great if it was possible to specify the API key manually.

2nv2u commented 1 year ago

I'll also see if I can create a preference section for settings like this. Bare with me though, I'm not having much time to work on this at the moment.

leoherzog commented 2 weeks ago

When following the official instructions for installing Syncthing with systemd service, they recommend using

systemctl enable syncthing@myuser.service

which installs the service as the local user. This causes gnome-shell-extension-syncthing-indicator to be unable to see the running instance :(

theCapypara commented 1 week ago

@leoherzog read on one paragraph below that: https://docs.syncthing.net/users/autostart.html#how-to-set-up-a-user-service

The plugin only supports user services, otherwise it would need to have root permissions, which would be a giant security risk.

2nv2u commented 1 week ago

Hi @leoherzog, @theCapypara is right, this plugin does not allow you to install the service globally and uses the user section instead.

If it doesn't exist in your local systemd config it will copy the synthing.service file into ~/.config/systemd/user folder and enables it with: systemctl enable syncthing --user.

I might add something like these manual configurations as also requested for the API key in a extension config section though and disable the service buttons since you can't control them anymore as user. Unfortunately I haven't gotten around to it yet.

leoherzog commented 1 week ago

Cool. So for future searchers who, like me, had change Syncthing as described from a system service that used the @user syntax in systemd to a user service:

user@computer:~$ sudo systemctl stop syncthing@user.service

user@computer:~$ sudo systemctl disable syncthing@user.service
Removed '/etc/systemd/system/multi-user.target.wants/syncthing@user.service'.

user@computer:~$ mkdir -p ~/.config/systemd/user/

user@computer:~$ cp /usr/share/syncthing/linux-systemd/user/syncthing.service ~/.config/systemd/user/

# did you get cp: cannot stat '/usr/share/syncthing/linux-systemd/user/syncthing.service': No such file or directory
# this may be needed:
#user@computer:~$ cp /usr/lib/systemd/user/syncthing.service ~/.config/systemd/user/

user@computer:~$ systemctl --user enable syncthing.service
Created symlink '/home/user/.config/systemd/user/default.target.wants/syncthing.service' → '/home/user/.config/systemd/user/syncthing.service'.

user@computer:~$ systemctl --user start syncthing.service

user@computer:~$ systemctl --user status syncthing.service
2nv2u commented 1 week ago

The extension was already capable of detecting if a system service was being used, but it did not take the syncthing@username.service into account which was changed, this has been fixed now.

About the user service btw, your guide is not needed, the syncthing.service file will be copied by the extension if it does not exist in your home systemd config folder. Just simply enable the service in UI and you should be good to go.