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

Syncthing Icon does not work with Ubuntu snap version of syncthing #35

Open
trevor87 opened this issue Jun 30, 2018 · 18 comments
Open

Syncthing Icon does not work with Ubuntu snap version of syncthing #35

trevor87 opened this issue Jun 30, 2018 · 18 comments

Comments

@trevor87
Copy link

Hi!

Thanks for your useful extension, I used it quite a lot so far!

Now I switched to the snap version of syncthing on ubuntu since it is always updated to the current released version and I noticed that it does not work with Syncthing Icon anymore.. What would have to be done to adapt the current version of the extension to the snap version? Would it be sufficient to just change the paths for the config folder and the binary?

Greetings
Trevor

@jaystrictor
Copy link
Owner

Not sure, since I have zero experience with snaps, so far.

What exactly does "does not work .. anymore" mean? Are there any errors? What is the output of
journalctl -b /usr/bin/gnome-shell | grep syncthing?

Furthermore, I am not sure whether systemctl can access the runtime information of the syncthing process. It may be sandboxed. The extension currently uses systemctl --user is-active syncthing.service to check for the activity of syncthing.
You should check what a similar systemctl --user status syncthing.service outputs.

@trevor87
Copy link
Author

Thanks for your quick response!
By "does not work" I mean: Syncthing is running but the tray icon shows that it is not. Also if syncthing is not running I can not start it using the icon.


Jun 30 20:52:56 Linux org.gnome.Shell.desktop[2213]:   inflating: /home/trevor/.local/share/gnome-shell/extensions/[email protected]@posteo.de/sax.js
Jun 30 20:52:56 Linux org.gnome.Shell.desktop[2213]:   inflating: /home/trevor/.local/share/gnome-shell/extensions/[email protected]@posteo.de/icons/exchange.svg
Jun 30 20:52:56 Linux org.gnome.Shell.desktop[2213]:   inflating: /home/trevor/.local/share/gnome-shell/extensions/[email protected]@posteo.de/icons/question.svg
Jun 30 20:52:56 Linux org.gnome.Shell.desktop[2213]:   inflating: /home/trevor/.local/share/gnome-shell/extensions/[email protected]@posteo.de/filewatcher.js
Jun 30 20:52:56 Linux org.gnome.Shell.desktop[2213]:   inflating: /home/trevor/.local/share/gnome-shell/extensions/[email protected]@posteo.de/schemas/org.gnome.shell.extensions.syncthing.gschema.xml
Jun 30 20:52:56 Linux org.gnome.Shell.desktop[2213]:   inflating: /home/trevor/.local/share/gnome-shell/extensions/[email protected]@posteo.de/icons/syncthing-logo-symbolic.svg
Jun 30 20:52:56 Linux org.gnome.Shell.desktop[2213]:   inflating: /home/trevor/.local/share/gnome-shell/extensions/[email protected]@posteo.de/stylesheet.css
Jun 30 20:52:56 Linux org.gnome.Shell.desktop[2213]:   inflating: /home/trevor/.local/share/gnome-shell/extensions/[email protected]@posteo.de/icons/syncthing-logo.svg
Jun 30 20:52:56 Linux org.gnome.Shell.desktop[2213]:   inflating: /home/trevor/.local/share/gnome-shell/extensions/[email protected]@posteo.de/webviewer.js
Jun 30 20:52:56 Linux org.gnome.Shell.desktop[2213]:   inflating: /home/trevor/.local/share/gnome-shell/extensions/[email protected]@posteo.de/icons/database.svg
Jun 30 20:52:56 Linux org.gnome.Shell.desktop[2213]:   inflating: /home/trevor/.local/share/gnome-shell/extensions/[email protected]@posteo.de/prefs.js
Jun 30 20:52:56 Linux org.gnome.Shell.desktop[2213]:   inflating: /home/trevor/.local/share/gnome-shell/extensions/[email protected]@posteo.de/extension.js
Jun 30 20:52:56 Linux org.gnome.Shell.desktop[2213]:   inflating: /home/trevor/.local/share/gnome-shell/extensions/[email protected]@posteo.de/icons/pause.svg
Jun 30 20:52:56 Linux org.gnome.Shell.desktop[2213]:   inflating: /home/trevor/.local/share/gnome-shell/extensions/[email protected]@posteo.de/icons/exclamation-triangle.svg
Jun 30 20:52:56 Linux org.gnome.Shell.desktop[2213]:   inflating: /home/trevor/.local/share/gnome-shell/extensions/[email protected]@posteo.de/README.md
Jun 30 20:52:56 Linux org.gnome.Shell.desktop[2213]:   inflating: /home/trevor/.local/share/gnome-shell/extensions/[email protected]@posteo.de/convenience.js
Jun 30 20:52:56 Linux org.gnome.Shell.desktop[2213]:   inflating: /home/trevor/.local/share/gnome-shell/extensions/[email protected]@posteo.de/schemas/gschemas.compiled
Jun 30 20:52:56 Linux org.gnome.Shell.desktop[2213]:  extracting: /home/trevor/.local/share/gnome-shell/extensions/[email protected]@posteo.de/metadata.json
Jun 30 20:52:56 Linux gnome-shell[2213]: Failed to connect to syncthing daemon at URI 'http://localhost:8384': 403 Forbidden
Jun 30 20:52:57 Linux gnome-shell[2213]: JS WARNING: [/home/trevor/.local/share/gnome-shell/extensions/[email protected]@posteo.de/sax.js 118]: reference to undefined property "position"
Jun 30 20:52:57 Linux gnome-shell[2213]: JS WARNING: [/home/trevor/.local/share/gnome-shell/extensions/[email protected]@posteo.de/sax.js 358]: reference to undefined property "c"
Jun 30 20:52:57 Linux gnome-shell[2213]: JS WARNING: [/home/trevor/.local/share/gnome-shell/extensions/[email protected]@posteo.de/sax.js 951]: reference to undefined property "ns"
Jun 30 20:52:57 Linux gnome-shell[2213]: Failed to connect to syncthing daemon at URI 'http://127.0.0.1:8384': 403 Forbidden
Jun 30 20:52:59 Linux gnome-shell[2213]: Failed to connect to syncthing daemon at URI 'http://127.0.0.1:8384': 403 Forbidden
Jun 30 20:53:03 Linux gnome-shell[2213]: Failed to connect to syncthing daemon at URI 'http://127.0.0.1:8384': 403 Forbidden
Jun 30 20:53:11 Linux gnome-shell[2213]: Failed to connect to syncthing daemon at URI 'http://127.0.0.1:8384': 403 Forbidden
Jun 30 20:53:21 Linux org.gnome.Shell.desktop[2213]: Failed to start syncthing.service: Unit syncthing.service not found.
Jun 30 20:53:21 Linux gnome-shell[2213]: Failed to connect to syncthing daemon at URI 'http://127.0.0.1:8384': 403 Forbidden
Jun 30 20:53:22 Linux gnome-shell[2213]: Failed to connect to syncthing daemon at URI 'http://127.0.0.1:8384': 403 Forbidden
Jun 30 20:53:24 Linux gnome-shell[2213]: Failed to connect to syncthing daemon at URI 'http://127.0.0.1:8384': 403 Forbidden
Jun 30 20:53:28 Linux gnome-shell[2213]: Failed to connect to syncthing daemon at URI 'http://127.0.0.1:8384': 403 Forbidden
Jun 30 20:53:36 Linux gnome-shell[2213]: Failed to connect to syncthing daemon at URI 'http://127.0.0.1:8384': 403 Forbidden
Jun 30 20:53:46 Linux gnome-shell[2213]: Failed to connect to syncthing daemon at URI 'http://127.0.0.1:8384': 403 Forbidden
Jun 30 20:53:56 Linux gnome-shell[2213]: Failed to connect to syncthing daemon at URI 'http://127.0.0.1:8384': 403 Forbidden
Jun 30 20:54:06 Linux gnome-shell[2213]: Failed to connect to syncthing daemon at URI 'http://127.0.0.1:8384': 403 Forbidden
Jun 30 20:54:16 Linux gnome-shell[2213]: Failed to connect to syncthing daemon at URI 'http://127.0.0.1:8384': 403 Forbidden
Jun 30 20:54:26 Linux gnome-shell[2213]: Failed to connect to syncthing daemon at URI 'http://127.0.0.1:8384': 403 Forbidden
Jun 30 20:54:36 Linux gnome-shell[2213]: Failed to connect to syncthing daemon at URI 'http://127.0.0.1:8384': 403 Forbidden
Jun 30 20:54:46 Linux gnome-shell[2213]: Failed to connect to syncthing daemon at URI 'http://127.0.0.1:8384': 403 Forbidden
Jun 30 20:54:56 Linux gnome-shell[2213]: Failed to connect to syncthing daemon at URI 'http://127.0.0.1:8384': 403 Forbidden
Jun 30 20:55:06 Linux gnome-shell[2213]: Failed to connect to syncthing daemon at URI 'http://127.0.0.1:8384': 403 Forbidden
Jun 30 20:55:16 Linux gnome-shell[2213]: Failed to connect to syncthing daemon at URI 'http://127.0.0.1:8384': 403 Forbidden

It is weird that it cannot connect since I can connect without problems using firefox..

@jaystrictor
Copy link
Owner

This could be a duplicate of #16 / #21.
Trusting a TLS certificate by user interaction is not supported by the Gnome javascript interpreter, so currently the extension does not work when using TLS.
Check whether you are using TLS and consider deactivating it.

@trevor87
Copy link
Author

trevor87 commented Jul 1, 2018

By TLS do you mean using the GUI over https? I have this disabled and connect without https.

Does the extension rely on the config directory? If so, I would have to change the path somehow, because with the snap the config dir is in /home/trevor/snap/syncthing/common/syncthing

@jaystrictor
Copy link
Owner

By TLS do you mean using the GUI over https? I have this disabled and connect without https.

Yes, I meant https. So this is not the problem, ok.

Does the extension rely on the config directory?

Yes, the config path ~/.config/syncthing/config.xml is pretty much hardcoded for the extension.

To change the Web Interface URI, start gnome-shell-extension-prefs and change the settings for Syncthing Icon: Turn off Automatic Configuration and specify the correct URI (the one that works with Firefox). Does this solve your problem?

@trevor87
Copy link
Author

trevor87 commented Jul 1, 2018

Unfortunately entering the URL manually doesn't fix it (it was the same URL anyway). I also created a softlink from ~/.config/syncthing/ to ~/snap/syncthing/common/syncthing but that didn't help either.

@jaystrictor
Copy link
Owner

When you enter the URI manually, you also have to copy the API key from your config file to the corresponding field in the Syncthing Icon configuration box. I forgot to mention that, sorry.

@trevor87
Copy link
Author

trevor87 commented Jul 1, 2018

OK we're definitely getting closer! Now I can at least see the shared folders in the dropdown menu. But still it doesn't show that syncthing is running, even though it is and I cannot connect to the web interface from the extensions dropdown menu.

These are the remaining errors:

Jul 01 17:49:19 Linux gnome-shell[7013]: JS WARNING: [/home/trevor/.local/share/gnome-shell/extensions/[email protected]@posteo.de/extension.js 203]: reference to undefined property "state"
Jul 01 17:49:19 Linux gnome-shell[7013]: JS WARNING: [/home/trevor/.local/share/gnome-shell/extensions/[email protected]@posteo.de/extension.js 91]: reference to undefined property "state"
Jul 01 17:49:30 Linux org.gnome.Shell.desktop[7013]: Failed to start syncthing.service: Unit syncthing.service not found.
Jul 01 17:49:33 Linux org.gnome.Shell.desktop[7013]: Failed to start syncthing.service: Unit syncthing.service not found.

@jaystrictor
Copy link
Owner

The Syncthing Icon extension starts and stops Syncthing via systemd as a systemd user service. The above logging messages just say that there is no such systemd user service.

How do you start and stop Syncthing via snap?

@trevor87
Copy link
Author

I startup syncthing on system startup using the command:

syncthing -no-browser -home="/home/trevor/snap/syncthing/common/syncthing"

@jaystrictor
Copy link
Owner

Generally, you should start syncthing via the systemd user session as stated in the Requirements section of the README.md. Then the On/Off button should work and you should be able to connect to the web interface.

Having said that, I guess it should be possible to rewrite the extension such that it also supports other technologies like flatpak and snap. I will look into it.

@jaystrictor
Copy link
Owner

There is an open issue in the syncthing bug tracker on how to manage a syncthing snap user service.
I hope this will be resolved soon.

@trevor87
Copy link
Author

trevor87 commented Oct 7, 2018

Hi! I just got the extension to work using snap + system.d.

I created a file called ~/.config/systemd/user/syncthing.service with the following contents:

[Unit]
Description=Syncthing - Open Source Continuous File Synchronization
Documentation=man:syncthing(1)

[Service]
ExecStart=/snap/bin/syncthing -no-browser -no-restart -logflags=0 -home="/home/trevor/snap/syncthing/common/syncthing"
Restart=on-failure
SuccessExitStatus=3 4
RestartForceExitStatus=3 4

[Install]
WantedBy=default.target

and then used the commands:

systemctl --user enable syncthing.service
systemctl --user start syncthing.service

in case that does not work straight away try systemctl --user daemon-reload

Also make sure that no other instance of syncthing is running, else you got weird errors.

To debug use: journalctl -e --user-unit=syncthing.service

Hope this helps anybody!

@qkiel
Copy link

qkiel commented Oct 26, 2018

Hi,
@trevor87 thanks for a great solution :]

I've modified my file a little bit because I didn't understand some of the lines in yours. Mine looks like this (notice that path to syncthing folder doeasn't start with /):

[Unit]
Description=Syncthing - Open Source Continuous File Synchronization
Documentation=man:syncthing(1)

[Service]
ExecStart=/snap/bin/syncthing -no-browser -home="snap/syncthing/common/syncthing"
Restart=on-failure

[Install]
WantedBy=multi-user.target

I've also found a useful command to check service status:

systemctl --user status syncthing.service

@trevor87
Copy link
Author

Happy to hear that it helped! :] Thanks for sharing!

I didn't understand all lines either, I just took the official user systemd file from the syncthing project on github and modified it a bit.

@jaystrictor
Copy link
Owner

The latest commit should now support reading the config file from $HOME/snap/syncthing/common/syncthing and parsing it automatically. Thus the extension now connects to syncthing automatically if started via the snap package.

However to start the syncthing snap package you still need to manually install the user unit as explained above.

@lalop
Copy link

lalop commented Oct 17, 2019

I run the syncthing instance via systemd, I can start and stop the service with the icon, web inrterface and sync work but the icon has a waring with no message
Capture du 2019-10-17 14-46-51

Did I miss something ?

@jaystrictor
Copy link
Owner

@lalop Perhaps a different issue. I updated the issue template. Could you file a new bug report for that?

@lalop lalop mentioned this issue Oct 18, 2019
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

4 participants