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

Provide a 'snap' package #1109

Open
jsamr opened this issue Apr 2, 2018 · 30 comments
Open

Provide a 'snap' package #1109

jsamr opened this issue Apr 2, 2018 · 30 comments

Comments

@jsamr
Copy link

jsamr commented Apr 2, 2018

Snaps are easy to use, on the rise and portable, let's go for it !

@PeterDaveHello
Copy link
Member

@jsamr would you like to send a pull request for it?

@PeterDaveHello
Copy link
Member

Instead of snap package, I more like to provide deb package first.

@jsamr
Copy link
Author

jsamr commented Apr 6, 2018

@PeterDaveHello Unfortunately I don't have much time (plus I don't really know how snap works).
However since I want to study snap work-cycle for personal projects, I might do it at some point, perhaps during June. I'll keep you informed.

@PeterDaveHello
Copy link
Member

@jsamr take your time ;)

@tokkenno
Copy link

tokkenno commented Apr 4, 2019

Hi, I created a script for snap:

snapcraft.yaml

name: transgui
version: 5.16.0
summary: Transmission GUI
description: |
  Transmission Remote GUI is feature rich cross platform front-end 
  to remotely control Transmission daemon via its RPC protocol. 
  It is faster and has more functionality than builtin Transmission 
  web interface.

confinement: strict
base: core18
grade: stable

parts:
  transgui:
    plugin: dump
    source: ./
    stage-packages:
      - libx11-6
      - libgdk-pixbuf2.0-0
      - libgtk2.0-0

apps:
  transgui:
    desktop: transgui.desktop
    plugs:
    - desktop
    - desktop-legacy
    - wayland
    - x11
    - unity7
    - network
    - home
    command: transgui

and the transgui.desktop file:

[Desktop Entry]
Version=1.0
Name=TransGUI
GenericName=Transmission GUI
Comment=Remote control a Transmission instance
Name[es]=TransGUI
GenericName[es]=Interfaz de usuario de Transmission
Comment[es]=Controla remotamente una instancia de Transmission
Exec=@bindir@/transgui
TryExec=@bindir@/transgui
Terminal=false
Type=Application
Categories=Internet;
MimeType=application/x-bittorrent
X-KDE-Protocols=magnet
Keywords=Torrent;Transmission;

I have published it in snapcraft with the transgui-unofficial id to test it and so that you can publish it with the transgui id when you have time. You can install them with the command snap install transgui-unofficial but you won't be able to see it on the web or in the store if you don't have the link: https://snapcraft.io/transgui-unofficial

If you make an official version, let me know to remove the unofficial version.

Regards!!

@PeterDaveHello
Copy link
Member

@tokkenno awesome, ley me take a look, thanks.

@PeterDaveHello
Copy link
Member

transgui was reserved on snapcrapt.io, I've requested the name and dig into snap packing 🏃‍♂️

@PeterDaveHello PeterDaveHello self-assigned this Jun 26, 2019
@PeterDaveHello
Copy link
Member

Here is a test build of snap package, would you guys like to try it and give some feedback?
https://drive.google.com/file/d/1D9V1y0txNCUN-LefyTMayiJruzrtG0Q3/view?usp=sharing

@tokkenno
Copy link

tokkenno commented Jun 26, 2019

It works more or less well for me. Just a few details:

SSL/TLS suport is not compiled when try to download GeoIP database:
Screenshot-20190626192101-706x272

Icon isn't showed on gnome menus:
Screenshot-20190626192107-86x87

GTK theme inside snap is not well integrated, has classic GTK theme (native in background, snap in front):
Screenshot-20190626192945-1537x1623

And finally, the snap is called 5.17 but the version that opens is 5.16:
Screenshot-20190626192429-585x129

@PeterDaveHello
Copy link
Member

@tokkenno thank you for the feedback! I'm also working on a new version during this peroid.
Try this one please:
https://drive.google.com/file/d/129b10fV4K5tWHWZsjNjZKJvFCrEHQMnH/view?usp=sharing

@tokkenno
Copy link

@PeterDaveHello Now is 5.17 👍 and it works just as well as the previous version... but it still have the other 3 "bugs"

@PeterDaveHello
Copy link
Member

I'm still working on SSL/TLS support is not compiled issue, I don't have an Ubuntu desktop environment yet, needs more time to tune it.

@PeterDaveHello
Copy link
Member

@tokkenno try this one please:
https://drive.google.com/file/d/1JJotc3_H2uVqe8MaTg60f02KjtYeIOp9/view?usp=sharing

Both SSL & icon issue should be fixed.

@tokkenno
Copy link

@PeterDaveHello Yes, SSL & icon fixed. If you could fix the GTK theme, everything would be perfect.

Take a look: https://forum.snapcraft.io/t/how-to-use-the-system-gtk-theme-via-the-gtk-common-themes-snap/6235

@PeterDaveHello
Copy link
Member

@tokkenno I'm working on it but no ETA yet.

@PeterDaveHello
Copy link
Member

@tokkenno please help confirm if this help GTK issue:
https://drive.google.com/file/d/1Zw1ARgH9L-AQwsE3Z7rRwCxQfNZP9ASP/view?usp=sharing

@PeterDaveHello
Copy link
Member

@jsamr would you also like to help test it?

@tokkenno
Copy link

@PeterDaveHello No, the interface still has the classic theme in the build 35

@PeterDaveHello
Copy link
Member

@tokkenno I have uploaded snapcraft.yaml here to see if anyone would like to help:
https://github.com/transmission-remote-gui/transgui/blob/master/snap/snapcraft.yaml

pull requests are welcome, only need to copy desktop file to project root to build the pacakge, see if you have any idea help resolve the theme issue please.

@tokkenno
Copy link

@PeterDaveHello Ok, when I have some free time, I'll take a look at it. Good job. Greetings!

@PeterDaveHello PeterDaveHello pinned this issue Aug 10, 2019
@PeterDaveHello PeterDaveHello unpinned this issue Aug 10, 2019
@alexhaydock
Copy link

alexhaydock commented Apr 3, 2020

I'm interested in this and would love to see it on the Snap Store, but I'm quite new to Snaps and running into some issues getting the snap to build correctly.

Am I right in thinking that your use of plugin: dump means that the Snap build process does not actually build the software and you're building locally with make && make zipdist before running snapcraft? That's not ideal but should work in theory (but I'm struggling to test it, as Ubuntu 19.10 is just throwing compiler errors for me when I try and build transgui in the regular way.)

Also, without a base specified for the Snap, it will default to using the core libraries based on Ubuntu 16.04. I believe it is recommended to use base: core18 now, which would build the app against 18.04 libraries.

I also think that adding gsettings to the list of plugs: might help the theming issue for users on Wayland. From the link posted by @tokkenno earlier:

On a Wayland session, GTK instead uses the GSettings API to read the users preferences directly, bypassing the display server. So plugging the gsettings interface is also necessary.

Edit: Please disregard this comment. Check below for a working Snap.

@alexhaydock
Copy link

I've done some work on putting together a functional Snap package with working GTK2 theming. (see PR above)

I'd be happy to set this up in the Snap store and maintain it if you wanted, but users are more likely to trust a package maintained by the main transgui developers so I'm submitting this PR with working snapcraft.yaml and transgui.desktop file.

Right now it definitely builds fine for the amd64 package and should in theory build fine for i386, but the snapcraft.yaml would need a few tweaks to support the ARM platforms that transgui currently supports.

Let me know if you have any questions.

@alexhaydock
Copy link

I've packaged up a proof of concept version of this Snap that should be working just fine and ready to install directly from the Snap Store, with strict confinement and full GTK2 theming integration.

I would appreciate feedback and testing from anyone interested, especially users on i386 or armhf platforms.

Get it from the Snap Store

You should be able to install with:

sudo snap install transgui-test

I've committed all the appropriate files to produce the Snap and opened the above PR for them, so this can be maintained upstream if desired. It should be minimal effort really as it should just involve incrementing the application version in snapcraft.yaml to push an upgrade to the store.

@jpbaril
Copy link

jpbaril commented May 10, 2020

I tried I think alexhaydock version from the SnapCraft store (installed from the Ubuntu Software app) on a new wipe+install of Ubuntu 20.04.
When I start the app, I see it for a fraction of second then it closes.
I can't seem to launch it from command line so I don't know exactly what is happening.

Here are some logs found in Logs app:

11:23:50 snapd: storehelpers.go:438: cannot refresh: snap has no updates available: "ao", "authy", "chromium", "core", "core18", "gnome-3-28-1804", "gnome-3-34-1804", "gtk-common-themes", "gtk2-common-themes", "mailspring", "snap-store", "snapd", "transgui-test", "vlc" 11:22:33 systemd: gnome-launched-transgui-test_transgui-test.desktop-45460.scope: Succeeded. 11:22:33 transgui: IA__gtk_widget_realize: assertion 'GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed 11:22:33 kernel: audit: type=1400 audit(1589124153.498:5845): apparmor="DENIED" operation="file_lock" profile="snap.transgui-test.transgui" name="/snap/transgui-test/14/lang/transgui.fr" pid=45460 comm="transgui" requested_mask="w" denied_mask="w" fsuid=1000 ouid=0 11:22:33 transgui: AVC apparmor="DENIED" operation="file_lock" profile="snap.transgui-test.transgui" name="/snap/transgui-test/14/lang/transgui.fr" pid=45460 comm="transgui" requested_mask="w" denied_mask="w" fsuid=1000 ouid=0 01:03:50 snapd: storehelpers.go:438: cannot refresh: snap has no updates available: "ao", "authy", "chromium", "core", "core18", "gnome-3-28-1804", "gnome-3-34-1804", "gtk-common-themes", "gtk2-common-themes", "mailspring", "snap-store", "snapd", "transgui-test", "vlc" 9 mai 18:45:39 systemd: gnome-launched-transgui-test_transgui-test.desktop-37545.scope: Succeeded. 9 mai 18:45:39 transgui: IA__gtk_widget_realize: assertion 'GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed 9 mai 18:45:39 kernel: audit: type=1400 audit(1589064339.008:4392): apparmor="DENIED" operation="file_lock" profile="snap.transgui-test.transgui" name="/snap/transgui-test/14/lang/transgui.fr" pid=37545 comm="transgui" requested_mask="w" denied_mask="w" fsuid=1000 ouid=0 9 mai 18:45:39 transgui: AVC apparmor="DENIED" operation="file_lock" profile="snap.transgui-test.transgui" name="/snap/transgui-test/14/lang/transgui.fr" pid=37545 comm="transgui" requested_mask="w" denied_mask="w" fsuid=1000 ouid=0 9 mai 18:45:11 systemd: gnome-launched-transgui-test_transgui-test.desktop-37460.scope: Succeeded. 9 mai 18:45:11 transgui: IA__gtk_widget_realize: assertion 'GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed 9 mai 18:45:11 kernel: audit: type=1400 audit(1589064311.444:4391): apparmor="DENIED" operation="file_lock" profile="snap.transgui-test.transgui" name="/snap/transgui-test/14/lang/transgui.fr" pid=37460 comm="transgui" requested_mask="w" denied_mask="w" fsuid=1000 ouid=0 9 mai 18:45:11 transgui: AVC apparmor="DENIED" operation="file_lock" profile="snap.transgui-test.transgui" name="/snap/transgui-test/14/lang/transgui.fr" pid=37460 comm="transgui" requested_mask="w" denied_mask="w" fsuid=1000 ouid=0 9 mai 18:44:51 kernel: audit: type=1400 audit(1589064291.712:4390): apparmor="DENIED" operation="file_lock" profile="snap.transgui-test.transgui" name="/snap/transgui-test/14/lang/transgui.fr" pid=37227 comm="transgui" requested_mask="w" denied_mask="w" fsuid=1000 ouid=0 9 mai 18:44:51 transgui: AVC apparmor="DENIED" operation="file_lock" profile="snap.transgui-test.transgui" name="/snap/transgui-test/14/lang/transgui.fr" pid=37227 comm="transgui" requested_mask="w" denied_mask="w" fsuid=1000 ouid=0 9 mai 18:44:48 5: update.go:85: cannot change mount namespace according to change mount (/snap/gtk-common-themes/1506/share/gtk2/Materia-dark-compact /snap/transgui-test/14/data-dir/themes/Materia-dark-compact none bind,ro 0 0): cannot write to "/snap/gtk-common-themes/1506/share/gtk2/Materia-dark-compact" because it would affect the host in "/snap" 9 mai 18:23:50 snapd: storehelpers.go:438: cannot refresh: snap has no updates available: "ao", "authy", "chromium", "core", "core18", "gnome-3-28-1804", "gnome-3-34-1804", "gtk-common-themes", "gtk2-common-themes", "mailspring", "snap-store", "snapd", "transgui-test", "vlc" 7 mai 19:48:46 apparmor_parser: AVC apparmor="STATUS" operation="profile_load" profile="unconfined" name="snap.transgui-test.transgui" pid=830 comm="apparmor_parser" 7 mai 19:48:46 systemd: Mounted Mount unit for transgui-test, revision 14. 7 mai 19:48:46 kernel: Mounting Mount unit for transgui-test, revision 14...

@alexhaydock
Copy link

alexhaydock commented May 10, 2020 via email

@jpbaril
Copy link

jpbaril commented May 10, 2020

Are you using Wayland do you know?

Yes

Or maybe NVIDIA drivers?

Should not, as I'm using intel igpu. (Also have a dedicated nvidia card but not used by Ubuntu)

You should be able to launch it from a terminal with snap run transgui-test to see if there’s any log output.

Here is the output:
erreur : impossible de trouver l'application "transgui-test" dans "transgui-test"
Translation: error: impossible to find application "transgui-test" in "transgui-test"

@alexhaydock
Copy link

alexhaydock commented May 10, 2020 via email

@alexhaydock
Copy link

alexhaydock commented May 10, 2020

Actually, I have been able to reproduce this by logging into a Wayland session on Ubuntu 20.04.

Try running:

DISABLE_WAYLAND=1 transgui-test.transgui

It seems to be the case that the application is segfaulting because GTK2 apps do not play well with Wayland. If the above command works for you as it does for me then I'll work on getting the DISABLE_WAYLAND environment variable integrated into the Snap config later tonight.

Thanks for helping debug 😄


Strangely I don't see the issue when launching the Snap from the .desktop icon it creates in the GNOME3 launcher of the default Ubuntu desktop, but I do when running directly with transgui-test.transgui in a terminal. I wonder if this is a case of GNOME3 or some other bit of the stack detecting a GTK2 application and dealing with Wayland incompatibility transparently when the app gets launched from a .desktop file.

Either way, if I set DISABLE_WAYLAND=1 in the environment variables configured for the Snap then it should launch properly on Wayland systems no matter what kind of DE or method is used to launch it.

@jpbaril
Copy link

jpbaril commented May 10, 2020

More info.
I logged in a Xorg session and launched Transgui. It did not crash.
As it was my first run of trasngui I was welcomed with a server connection pop-up window.
I filled the info and all worked.
I relogged in my usual Wayland session and launched trangui.
It worked!
Could that be the server connection popup window that cause the problem in Wayland session ?

@alexhaydock
Copy link

I think just generally GTK2 apps don't play well with Wayland and sometimes the right environment variables (that should cause XWayland to be used instead) don't get set for some reason.

The solution in this case seems to be explicitly setting those variables inside the Snapcraft.yaml file that builds the Snap. I've pushed a commit that should solve this to the branch that builds my test snap and it should be ready for release to the store in a little while so you can pull it in with a snap refresh and it should hopefully just work in Wayland. 😃

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

No branches or pull requests

5 participants