Zotero snap failing with `version GLIBC_PRIVATE not defined in file libc.so.6`

Ubuntu 17.10. I’m trying to build a Zotero snap from the official tarball. When I run the snap, I get the following error:

$ zotero-standalone.zotero 
/snap/zotero-standalone/x1/zotero-bin: relocation error: /snap/zotero-standalone/x1/lib/x86_64-linux-gnu/libdl.so.2: symbol _dl_catch_error, version GLIBC_PRIVATE not defined in file libc.so.6 with link time reference

I have no idea what’s going on here. Any pointers?

My snapcraft.yaml file:

name: zotero-standalone
version: 5.0.22
summary: Zotero Standalone
description: |
  Zotero Standalone

confinement: devmode

parts:
  geekbench4:
    plugin: dump
    source: https://www.zotero.org/download/client/dl?channel=release&platform=linux-x86_64&version=5.0.22
    source-type: tar
apps:
  zotero:
    command: zotero

did you properly use “snapcraft cleanbuild” to build this snap (to make sure you do not taint the strict snap with libraries from your host system?)

Thanks @orga, this got me a bit further. Now I get the following error:

$ zotero-standalone.zotero 
XPCOMGlueLoad error for file /snap/zotero-standalone/x1/libmozgtk.so:
libgtk-3.so.0: cannot open shared object file: No such file or directory
Couldn't load XPCOM.

You’ll need to add build dependencies as build-packages (these aren’t included in the final snap) and dependencies as stage-packages. See here for more info.

build.snapcraft.io (and I think cleanbuild, though I’m not sure?!) use Ubuntu 16.04 to get their packages. So searching for libgtk in Ubuntu Xenial (16.04), we get this. This indicates that you need to add libgtk-3-0 to your snapcraft.yaml as a stage-package.

It would help you if you could find something in Zotero’s documentation that says what its dependencies for Linux distros are :slight_smile:

Awesome, thanks! I got a bit further.

I used the desktop-gtk3 part to pull in the dependencies as described here: https://github.com/ubuntu/snapcraft-desktop-helpers/blob/master/snapcraft.yaml#L13

However, when I launch the app with desktop-launch then I get a segfault:

(zotero:17861): Gtk-WARNING **: Error loading theme icon 'edit-clear' for stock: 
Segmentation fault (core dumped)

This is on Ubuntu 17.10 with Wayland. If I logout and log back into the X session, the snap works correctly. Running an unsnapped Zotero works without issue on wayland.

When I launch it without desktop-launch then it launches but I get a bunch of errors and the characters aren’t loaded correctly.

(zotero:6634): Gtk-WARNING **: Locale not supported by C library.
	Using the fallback 'C' locale.

(zotero:6634): GdkPixbuf-WARNING **: Cannot open pixbuf loader module file '/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders.cache': No such file or directory

This likely means that your installation is broken.
Try running the command
  gdk-pixbuf-query-loaders > /usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders.cache
to make things work again for the time being.
Gtk-Message: Failed to load module "canberra-gtk-module"
Gtk-Message: Failed to load module "canberra-gtk-module"

(zotero:6634): Gtk-WARNING **: Could not find the icon 'edit-find'. The 'hicolor' theme
was not found either, perhaps you need to install it.
You can get a copy from:
	http://icon-theme.freedesktop.org/releases

(zotero:6634): Gtk-WARNING **: Error loading theme icon 'edit-find' for stock: Icon 'edit-find' not present in theme ubuntu-mono-dark

(zotero:6634): Gtk-WARNING **: Error loading theme icon 'image-missing' for stock: Icon 'image-missing' not present in theme ubuntu-mono-dark

(zotero:6634): GLib-GObject-CRITICAL **: g_object_ref: assertion 'G_IS_OBJECT (object)' failed

(zotero:6634): Gtk-WARNING **: Error loading theme icon 'edit-find' for stock: Icon 'edit-find' not present in theme ubuntu-mono-dark

(zotero:6634): Gtk-WARNING **: Error loading theme icon 'image-missing' for stock: Icon 'image-missing' not present in theme ubuntu-mono-dark

(zotero:6634): GLib-GObject-CRITICAL **: g_object_ref: assertion 'G_IS_OBJECT (object)' failed

(zotero:6634): Gtk-WARNING **: Error loading theme icon 'edit-clear' for stock: 

(zotero:6634): Gtk-WARNING **: Error loading theme icon 'image-missing' for stock: Icon 'image-missing' not present in theme ubuntu-mono-dark

(zotero:6634): GLib-GObject-CRITICAL **: g_object_ref: assertion 'G_IS_OBJECT (object)' failed

(zotero:6634): Gtk-WARNING **: Error loading theme icon 'edit-clear' for stock: 

(zotero:6634): Gtk-WARNING **: Error loading theme icon 'image-missing' for stock: Icon 'image-missing' not present in theme ubuntu-mono-dark

(zotero:6634): GLib-GObject-CRITICAL **: g_object_ref: assertion 'G_IS_OBJECT (object)' failed
method return time=1508079094.586127 sender=:1.97 -> destination=:1.132 serial=6 reply_serial=2

My snapcraft.yaml file:

name: zotero-standalone
version: 5.0.22
summary: Zotero Standalone
description: |
  Zotero Standalone

confinement: devmode

apps:
  zotero:
#    command: zotero
    command: desktop-launch $SNAP/zotero
    plugs:
      - x11
parts:
  zotero-standalone:
    plugin: dump
    source: https://www.zotero.org/download/client/dl?channel=release&platform=linux-x86_64&version=5.0.22
    source-type: tar
    stage-packages:
      - libxt6
    after:
      - desktop-gtk3

The chances are that seccomp is killing your application causing the segfault message when you start with desktop-launch. To diagnose, try installing snappy-debug and running the scanlog which will advise any missing plugs that it knows about:

sudo snap install snappy-debug
sudo snap connect snappy-debug:log-observe
/snap/bin/snappy-debug.security scanlog

Now run your app in a separate terminal (make sure your snap is set to use the desktop-launch script!)

/snap/bin/zotero

i think you want a bit more than the x11 interface fo you app

x11 will ony allow you to talk to the display server, you want something like unity7 or one of th enew desktop interfaces as well…

Thanks for that link, very helpful!

To be clear: I’m installing the snap in devmode, so everything should still work, even if I didn’t add the correct plugs.

I went all-out, and added all the plugs I could think of, but I still get the exact same behavior: a segfault on Ubuntu 17.10 default (wayland) session, a working app on Ubuntu 17.10 xorg session.

My snapcraft.yaml

name: zotero-standalone
version: 5.0.22
summary: Zotero Standalone
description: |
  Zotero Standalone

confinement: devmode

apps:
  zotero:
#    command: zotero
    command: desktop-launch $SNAP/zotero
    plugs:
      - x11
      - wayland
      - network-control
      - network-observe
      - firewall-control
      - home
      - gsettings
      - account-control
      - mount-observe
      - unity7
      - browser-support
      - desktop-legacy
      - desktop
      - network
      - process-control
      - system-observe
parts:
  zotero-standalone:
    plugin: dump
    source: https://www.zotero.org/download/client/dl?channel=release&platform=linux-x86_64&version=5.0.22
    source-type: tar
    stage-packages:
      - libxt6
    after:
      - desktop-gtk3

apparmor log

= AppArmor =
Time: Oct 16 13:34:14
Log: apparmor="ALLOWED" operation="open" profile="snap.zotero-standalone.zotero" name="/proc/28511/net/arp" pid=28511 comm=4C696E6B204D6F6E69746F72 requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
File: /proc/28511/net/arp (read)
Suggestions:
* adjust program to not access '@{PROC}/@{pid}/net/arp'
* add one of 'firewall-control, network-control, network-observe' to 'plugs'

= AppArmor =
Time: Oct 16 13:34:14
Log: apparmor="ALLOWED" operation="open" profile="snap.zotero-standalone.zotero" name="/proc/28511/mountinfo" pid=28511 comm=43616368653220492F4F requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
File: /proc/28511/mountinfo (read)
Suggestions:
* adjust program to not access '@{PROC}/@{pid}/mountinfo'
* add 'mount-observe' to 'plugs'

= AppArmor =
Time: Oct 16 13:34:16
Log: apparmor="ALLOWED" operation="open" profile="snap.zotero-standalone.zotero" name="/proc/28511/mountinfo" pid=28511 comm="zotero-bin" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
File: /proc/28511/mountinfo (read)
Suggestions:
* adjust program to not access '@{PROC}/@{pid}/mountinfo'
* add 'mount-observe' to 'plugs'

OK, so I was wrong about seccomp. That’s progress at least :slight_smile:

You might be able to get some hints by running the app through strace, but that is in-depth and difficult to read the output, and may not be helpful anyway. It still a good thing to try, though. Using strace might, for example, allow you to correlate that a particular syscall returned a result the app didn’t expect, such as being unable to find a particular library.

This doesn’t get me much further.

Running strace on wayland just hangs. Running strace on xorg gives the following error message:

$ sudo strace -u merlijn -e '!select,_newselect,clock_gettime' -f -D -vv -o ./hello-world.trace /snap/bin/zotero-standalone.zotero
Error: GDK_BACKEND does not match available displays

Trace from wayland strace: http://paste.ubuntu.com/25753825/

Anybody that can help out? I’d really like to see this application snapped…

I just got this snapped recently, would love to get some feedback.

Great! I created a PR with some improvements.

For future reference; I fixed the Wayland issue described in this thread by forcing fallback to xwayland with an environment variable: https://github.com/extraymond/zotero-snap/pull/1/commits/aa12703d86d03caa8c9d8228722ea649f557eeb8

Thx mate! Already merged, I will push to stable now.