Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Support systemd syncthing system service together with user service #52

Open
jjchico opened this issue Mar 6, 2020 · 2 comments

Comments

@jjchico
Copy link

jjchico commented Mar 6, 2020

Describe the bug
The syncthing icon extension does not work or behaves wrongly when syncthing has been set up as a system service as in the docs. Either of these may happen:

  1. Syncthing icon is off even if syncthing service ir running.
  2. If "on" is pressed, syncthing user service start fails becouse it is already running as a system service (see logs below). Then, syncthing icon may stay off or may stay off but showing the shared folders correctly for some time.

Screenshots
Captura de pantalla de 2020-03-06 09-57-04

Version information:

  • OS: Ubuntu 18.04.4
  • gnome-shell --version GNOME Shell 3.28.4
  • gjs --version gjs 1.52.5
  • Extension version: "version": 24

Possible solutions

  1. Make syncthing icon to check if syncthing is configured as a system service for the user (by checking the status of [email protected]) and disable the on/off switch in that case, but still connect to the syncthing service if running.

  2. Even better, if syncthing is configured as a system service, use the on/off switch to start/stop the system service instead of the user service (the user must be and admin to use this).

  3. Even better: include an option so the user can select to run syncthing as a system service (only if admin) or a user service like now.

Logs

#### Syncthing running as a system service for the user

$ systemctl -n0 status [email protected][email protected] - Syncthing - Open Source Continuous File Synchronization for jjchico
   Loaded: loaded (/lib/systemd/system/[email protected]; indirect; vendor preset: enabled)
   Active: active (running) since Thu 2020-03-05 10:29:56 CET; 23h ago
     Docs: man:syncthing(1)
 Main PID: 1434 (syncthing)
    Tasks: 25 (limit: 4915)
   CGroup: /system.slice/system-syncthing.slice/[email protected]
           └─1434 /usr/bin/syncthing -no-browser -no-restart -logflags=0

#### The next one fails since syncthing is already running as a system service

$ systemctl --user -n0 status syncthing.service
● syncthing.service - Syncthing - Open Source Continuous File Synchronization
   Loaded: loaded (/usr/lib/systemd/user/syncthing.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2020-03-06 09:55:46 CET; 8min ago
     Docs: man:syncthing(1)
  Process: 27190 ExecStart=/usr/bin/syncthing -no-browser -no-restart -logflags=0 (code=exited, status=1/FAILURE)
 Main PID: 27190 (code=exited, status=1/FAILURE)

#### The next one looks fine

$ journalctl -b /usr/bin/gnome-shell | grep syncthingicon
mar 06 09:09:14 valhalla org.gnome.Shell.desktop[15839]:    creating: /home/jjchico/.local/share/gnome-shell/extensions/[email protected]@posteo.de/icons/hicolor/
mar 06 09:09:14 valhalla org.gnome.Shell.desktop[15839]:    creating: /home/jjchico/.local/share/gnome-shell/extensions/[email protected]@posteo.de/icons/hicolor/symbolic/
mar 06 09:09:14 valhalla org.gnome.Shell.desktop[15839]:   inflating: /home/jjchico/.local/share/gnome-shell/extensions/[email protected]@posteo.de/schemas/gschemas.compiled
mar 06 09:09:14 valhalla org.gnome.Shell.desktop[15839]:   inflating: /home/jjchico/.local/share/gnome-shell/extensions/[email protected]@posteo.de/saxes.js
mar 06 09:09:14 valhalla org.gnome.Shell.desktop[15839]:   inflating: /home/jjchico/.local/share/gnome-shell/extensions/[email protected]@posteo.de/icons/hicolor/scalable/status/pause.svg
mar 06 09:09:14 valhalla org.gnome.Shell.desktop[15839]:   inflating: /home/jjchico/.local/share/gnome-shell/extensions/[email protected]@posteo.de/systemd.js
mar 06 09:09:14 valhalla org.gnome.Shell.desktop[15839]:    creating: /home/jjchico/.local/share/gnome-shell/extensions/[email protected]@posteo.de/icons/hicolor/scalable/apps/
mar 06 09:09:14 valhalla org.gnome.Shell.desktop[15839]:   inflating: /home/jjchico/.local/share/gnome-shell/extensions/[email protected]@posteo.de/filewatcher.js
mar 06 09:09:14 valhalla org.gnome.Shell.desktop[15839]:   inflating: /home/jjchico/.local/share/gnome-shell/extensions/[email protected]@posteo.de/icons/hicolor/scalable/apps/syncthing.svg
mar 06 09:09:14 valhalla org.gnome.Shell.desktop[15839]:   inflating: /home/jjchico/.local/share/gnome-shell/extensions/[email protected]@posteo.de/webviewer.js
mar 06 09:09:14 valhalla org.gnome.Shell.desktop[15839]:    creating: /home/jjchico/.local/share/gnome-shell/extensions/[email protected]@posteo.de/icons/hicolor/symbolic/apps/
mar 06 09:09:14 valhalla org.gnome.Shell.desktop[15839]:   inflating: /home/jjchico/.local/share/gnome-shell/extensions/[email protected]@posteo.de/stylesheet.css
mar 06 09:09:14 valhalla org.gnome.Shell.desktop[15839]:   inflating: /home/jjchico/.local/share/gnome-shell/extensions/[email protected]@posteo.de/icons/hicolor/scalable/status/question.svg
mar 06 09:09:14 valhalla org.gnome.Shell.desktop[15839]:   inflating: /home/jjchico/.local/share/gnome-shell/extensions/[email protected]@posteo.de/convenience.js
mar 06 09:09:14 valhalla org.gnome.Shell.desktop[15839]:   inflating: /home/jjchico/.local/share/gnome-shell/extensions/[email protected]@posteo.de/icons/hicolor/scalable/status/exclamation-triangle.svg
mar 06 09:09:14 valhalla org.gnome.Shell.desktop[15839]:   inflating: /home/jjchico/.local/share/gnome-shell/extensions/[email protected]@posteo.de/icons/hicolor/scalable/status/database.svg
mar 06 09:09:14 valhalla org.gnome.Shell.desktop[15839]:   inflating: /home/jjchico/.local/share/gnome-shell/extensions/[email protected]@posteo.de/schemas/org.gnome.shell.extensions.syncthing.gschema.xml
mar 06 09:09:14 valhalla org.gnome.Shell.desktop[15839]:   inflating: /home/jjchico/.local/share/gnome-shell/extensions/[email protected]@posteo.de/icons/hicolor/symbolic/apps/syncthing-symbolic.svg
mar 06 09:09:14 valhalla org.gnome.Shell.desktop[15839]:   inflating: /home/jjchico/.local/share/gnome-shell/extensions/[email protected]@posteo.de/extension.js
mar 06 09:09:14 valhalla org.gnome.Shell.desktop[15839]:   inflating: /home/jjchico/.local/share/gnome-shell/extensions/[email protected]@posteo.de/icons/hicolor/scalable/status/exchange.svg
mar 06 09:09:14 valhalla org.gnome.Shell.desktop[15839]:   inflating: /home/jjchico/.local/share/gnome-shell/extensions/[email protected]@posteo.de/prefs.js
mar 06 09:09:14 valhalla org.gnome.Shell.desktop[15839]:   inflating: /home/jjchico/.local/share/gnome-shell/extensions/[email protected]@posteo.de/syncthing_api.js
mar 06 09:09:14 valhalla org.gnome.Shell.desktop[15839]:  extracting: /home/jjchico/.local/share/gnome-shell/extensions/[email protected]@posteo.de/metadata.json
mar 06 09:09:14 valhalla gnome-shell[15839]: [syncthingicon] found syncthing config file in /home/jjchico/.config/syncthing
@jaystrictor
Copy link
Owner

In the documentation of Syncthing Icon, i.e. the file README.md, it is clearly stated that only the user service of systemd is supported. So demand for supporting the system service as well is considered a feature request.

Speaking for myself, I don't need such a feature and I don't have much time left right now to implement it. However, I am sincerely grateful for pull requests. So if you want to work on it, go ahead.

@jaystrictor jaystrictor changed the title Wrong behaviour when syncthing is set up as a system service Feature request: Support systemd syncthing system service together with user service Mar 8, 2020
@jjchico
Copy link
Author

jjchico commented Mar 8, 2020

You are right. It is a feature request.

I understand that fully supporting the system service mode in addition to the user service is quite some work, but maybe a compromise solution would be something like "if syncthing is already running and the user service is not, do not worry who started it, just use the instance already running and disable the on/off switch".

I am not really a programmer myself and I am not familiar with the language syncthing icon is written in, but I may eventually give it a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants