snapcrafters / signal-desktop

Unofficial Signal Desktop installer for Linux
https://snapcraft.io/signal-desktop
GNU Affero General Public License v3.0
35 stars 14 forks source link

[Bug]: `undefined symbol` when launching using `/snap/bin/signal-desktop`, no error when launching using `/snap/signal-desktop/463/opt/Signal/signal-desktop` #113

Closed lestephane closed 3 months ago

lestephane commented 1 year ago

What happened?

I typed signal-desktop <ENTER> in the command line prompt, and got an undefined symbol error

~ $ echo $PATH
/home/SCRUBBED/.asdf/shims:/home/linuxbrew/.linuxbrew/opt/asdf/libexec/bin:/home/linuxbrew/.linuxbrew/bin:/usr/local/bin:/usr/bin:/bin:/snap/bin
~ $ which signal-desktop 
/snap/bin/signal-desktop
~ $ LD_DEBUG=libs signal-desktop
    104243: find library=libc.so.6 [0]; searching
    104243:  search cache=/etc/ld.so.cache
    104243:   trying file=/lib/x86_64-linux-gnu/libc.so.6
    104243: 
    104243: 
    104243: calling init: /lib64/ld-linux-x86-64.so.2
    104243: 
    104243: 
    104243: calling init: /lib/x86_64-linux-gnu/libc.so.6
    104243: 
    104243: find library=libpthread.so.0 [0]; searching
    104243:  search cache=/etc/ld.so.cache
    104243:   trying file=/lib/x86_64-linux-gnu/libpthread.so.0
    104243: 
    104243: find library=libc.so.6 [0]; searching
    104243:  search cache=/etc/ld.so.cache
    104243:   trying file=/lib/x86_64-linux-gnu/libc.so.6
    104243: 
    104243: 
    104243: calling init: /lib64/ld-linux-x86-64.so.2
    104243: 
    104243: 
    104243: calling init: /lib/x86_64-linux-gnu/libc.so.6
    104243: 
    104243: 
    104243: calling init: /lib/x86_64-linux-gnu/libpthread.so.0
    104243: 
    104243: 
    104243: initialize program: signal-desktop
    104243: 
    104243: 
    104243: transferring control: signal-desktop
    104243: 
/snap/signal-desktop/463/opt/Signal/signal-desktop: symbol lookup error: /snap/signal-desktop/463/gnome-platform/usr/lib/x86_64-linux-gnu/libtasn1.so.6: undefined symbol: , version GLIBC_2.2.5

What should have happened?

The app should start normally, and indeed it does when I use the path to the executable mentioned in the error message:

$ /snap/signal-desktop/463/opt/Signal/signal-desktop
Set Windows Application User Model ID (AUMID) { appUserModelId: 'org.whispersystems.signal-desktop' }
NODE_ENV production
NODE_CONFIG_DIR /snap/signal-desktop/463/opt/Signal/resources/app.asar/config
NODE_CONFIG {}
ALLOW_CONFIG_MUTATIONS undefined
HOSTNAME undefined
NODE_APP_INSTANCE undefined
SUPPRESS_NO_CONFIG_WARNING undefined
SIGNAL_ENABLE_HTTP undefined
userData: /home/lestephane/.config/Signal
config/get: Successfully read user config file
config/get: Successfully read ephemeral config file
...
(runs normally)

Those two executables are definitely not the same as evidenced by running sha256sum

$ sha256sum /snap/bin/signal-desktop  /snap/signal-desktop/463/opt/Signal/signal-desktop
288604b5931869d6b9e4c5e47cfaf34b24e99ddd3ac2a5c231d59ade6bd38e42  /snap/bin/signal-desktop
86667caa176fc11295bf6419b8e86ac9bb56db57db4e87d05bfb07ba674636be  /snap/signal-desktop/463/opt/Signal/signal-desktop

Output of snap info $snap_name

$ snap info signal-desktop 
name:      signal-desktop
summary:   Private messaging from your desktop.
publisher: Snapcrafters
store-url: https://snapcraft.io/signal-desktop
contact:   https://github.com/snapcrafters/signal-desktop/issues
license:   AGPL-3.0-only
description: |
  Private messaging from your desktop.

  To use the Signal desktop app, Signal must first be installed on your phone.

  **Are you having issues?**

  Let us know by creating a new issue here: https://github.com/snapcrafters/signal-desktop/issues

  **Authors**

  This snap is maintained by the Snapcrafters community, and is not necessarily endorsed or
  officially maintained by the upstream developers.
commands:
  - signal-desktop
snap-id:      r4LxMVp7zWramXsJQAKdamxy6TAWlaDD
tracking:     latest/stable
refresh-date: today at 18:43 EET
channels:
  latest/stable:    6.9.0 2023-03-09 (463) 193MB -
  latest/candidate: 6.9.0 2023-03-09 (463) 193MB -
  latest/beta:      ↑                            
  latest/edge:      ↑                            
installed:          6.9.0            (463) 193MB -

Output of snap connections $snap_name

$ snap connections signal-desktop 
Interface               Plug                                   Slot                            Notes
audio-playback          signal-desktop:audio-playback          :audio-playback                 -
audio-record            signal-desktop:audio-record            :audio-record                   -
browser-support         signal-desktop:browser-support         :browser-support                -
camera                  signal-desktop:camera                  :camera                         -
content[gnome-42-2204]  signal-desktop:gnome-42-2204           gnome-42-2204:gnome-42-2204     -
content[gtk-3-themes]   signal-desktop:gtk-3-themes            gtk-common-themes:gtk-3-themes  -
content[icon-themes]    signal-desktop:icon-themes             gtk-common-themes:icon-themes   -
content[sound-themes]   signal-desktop:sound-themes            gtk-common-themes:sound-themes  -
desktop                 signal-desktop:desktop                 :desktop                        -
desktop-legacy          signal-desktop:desktop-legacy          :desktop-legacy                 -
gsettings               signal-desktop:gsettings               :gsettings                      -
home                    signal-desktop:home                    :home                           -
network                 signal-desktop:network                 :network                        -
opengl                  signal-desktop:opengl                  :opengl                         -
removable-media         signal-desktop:removable-media         -                               -
screen-inhibit-control  signal-desktop:screen-inhibit-control  :screen-inhibit-control         -
unity7                  signal-desktop:unity7                  :unity7                         -
wayland                 signal-desktop:wayland                 :wayland                        -
x11                     signal-desktop:x11                     :x11                            -

Output of snap version

$ snap version
snap    2.58.2
snapd   2.58.2
series  16
pop     22.04
kernel  6.0.6-76060006-generic

Relevant log output

Mar 15 20:01:42 pop-os kernel: [41130.165151] audit: type=1400 audit(1678903302.257:448): apparmor="DENIED" operation="open" profile="/snap/snapd/18357/usr/lib/snapd/snap-confine" name="/etc/pop-os/os-release" pid=105718 comm="snap-confine" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Mar 15 20:01:42 pop-os kernel: [41130.175366] audit: type=1400 audit(1678903302.265:449): apparmor="DENIED" operation="open" profile="snap-update-ns.signal-desktop" name="/etc/pop-os/os-release" pid=105743 comm="5" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
Mar 15 20:01:42 pop-os kernel: [41130.184543] audit: type=1400 audit(1678903302.273:450): apparmor="DENIED" operation="open" profile="snap.signal-desktop.signal-desktop" name="/etc/pop-os/os-release" pid=105718 comm="snap-exec" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
Mar 15 20:01:42 pop-os kernel: [41130.226993] audit: type=1400 audit(1678903302.317:451): apparmor="DENIED" operation="open" profile="snap.signal-desktop.signal-desktop" name="/etc/pop-os/os-release" pid=105765 comm="snapctl" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
Mar 15 20:01:42 pop-os kernel: [41130.239411] audit: type=1400 audit(1678903302.329:452): apparmor="DENIED" operation="open" profile="snap.signal-desktop.signal-desktop" name="/etc/pop-os/os-release" pid=105771 comm="snapctl" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0

Teminal output of app

No response

lestephane commented 1 year ago

It looks like a symlink is causing the apparmor issue (similar issue reported here: https://github.com/pop-os/pop/issues/1850).

~ $ ls -la /etc/os-release
lrwxrwxrwx 1 root root 17 Oct 21 20:16 /etc/os-release -> pop-os/os-release

But this does not explain why launching the more specific /snap/signal-desktop/463/opt/Signal/signal-desktop works. Should they not both fail?

lestephane commented 1 year ago

I see, the /snap/bin/signal-desktop is a symlink to a shared /usr/bin/snap wrapper, which explains why the checksums differed. The wrapper must be trying to detect the os-release to decide how to launch the 'real' signal-desktop executable.

 $ ls -la /snap/bin/signal-desktop 
lrwxrwxrwx 1 root root 13 Mar 15 18:43 /snap/bin/signal-desktop -> /usr/bin/snap
lucyllewy commented 1 year ago

The reason that launching via /snap/signal-desktop/463/opt/Signal/signal-desktop behaves differently is that by calling that file you are completely bypassing the snap system so signal is loading libraries off your host. This negates all confinement and may lead to random errors that we, as the packagers, cannot fix.

As to the issue with the symlink this is unfortunately something we cannot fix either. It might be possible for snapd or apparmor to be altered to allow the symlink but this isn't supported by apparmor as an intentional decision, so we may not be able to get a fix for this for some time.

lestephane commented 1 year ago

This is the upstream issue in pop-os: https://github.com/pop-os/pop/issues/2146 I'll set up a hard link on my machine for now.

lestephane commented 1 year ago

making /etc/os-release a hardlink does not make the original problem go away (ie the undefined symbol is still there). Since there is now no apparmor violation, the problem must lie elsewhere...

~ $ signal-desktop 
cat: error while loading shared libraries: cat: unsupported version 0 of Verneed record
/snap/signal-desktop/463/gnome-platform/usr/lib/x86_64-linux-gnu/libtasn1.so.6: undefined symbol: , version GLIBC_2.2.5
Failed to load module: /home/lestephane/snap/signal-desktop/common/.cache/gio-modules/libgiognutls.so
g_module_open() failed for /snap/signal-desktop/463/gnome-platform/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-svg.so: /snap/signal-desktop/463/gnome-platform/usr/lib/x86_64-linux-gnu/libuuid.so.1: unsupported version 0 of Verdef record
/snap/signal-desktop/463/gnome-platform/usr/lib/x86_64-linux-gnu/libgtk-3-0/gtk-query-immodules-3.0: /snap/signal-desktop/463/gnome-platform/usr/lib/x86_64-linux-gnu/libuuid.so.1: unsupported version 0 of Verdef record
/snap/signal-desktop/463/gnome-platform/usr/lib/x86_64-linux-gnu/libgtk-3-0/gtk-query-immodules-3.0: error while loading shared libraries: /snap/signal-desktop/463/gnome-platform/usr/lib/x86_64-linux-gnu/libuuid.so.1: unsupported version 0 of Verneed record
ERROR: /snap/signal-desktop/463/gnome-platform/usr/lib/x86_64-linux-gnu/libgtk-3-0/gtk-query-immodules-3.0 exited abnormally with status 127
/snap/signal-desktop/463/opt/Signal/signal-desktop: /snap/signal-desktop/463/gnome-platform/usr/lib/x86_64-linux-gnu/libuuid.so.1: unsupported version 0 of Verdef record
/snap/signal-desktop/463/opt/Signal/signal-desktop: error while loading shared libraries: /snap/signal-desktop/463/gnome-platform/usr/lib/x86_64-linux-gnu/libuuid.so.1: unsupported version 0 of Verneed record
lucyllewy commented 1 year ago
unsupported version 0 of Verneed record

This error comes from your kernel containing a bug in the squashfs code, and will be the cause of your issue. I believe it was fixed in Linux 6.0.7 but you're still on 6.0.6.

Reference on the Snapcraft Forum

jnsgruk commented 3 months ago

This is very outdated by now, and I think unrelated to the snap packaging - at least where the application is being launched outside of the confinement. Closing for now, but can reopen if needed.