Search code examples
fedora

Snap apps giving "error while loading shared libraries" and "cannot open shared object file: No such file or directory" when opened


Some snap apps (namely discord and telegram-desktop), stopped opening when I turned my laptop on this morning (Fedora 31 64bit), and when opened from terminal discord shows this:

~/ discord                                                                                                                                              
WARNING: cgroup v2 is not fully supported yet, proceeding with partial confinement
/snap/discord/109/usr/share/discord/Discord: error while loading shared libraries: libX11.so.6: cannot open shared object file: No such file or directory

and telegram-desktop shows this:

~/ telegram-desktop                                                                                                                                               
WARNING: cgroup v2 is not fully supported yet, proceeding with partial confinement
/snap/telegram-desktop/1561/bin/telegram-desktop: error while loading shared libraries: libQt5Widgets.so.5: cannot open shared object file: No such file or directory

both packages are installed, and I'm a bit stumped after searching threads and forums for most of the morning, nothing I tried worked, reinstalling them, trying different versions of the libraries and then the apps, installing 32bit versions, and on and on. Any help, prompts, ideas, or just general rambling about what the issue could be is much appreciated.

TLDR: Snap apps giving "error while loading shared libraries" and "cannot open shared object file: No such file or directory" when opened. Packages that are missing are installed correctly, so I'm stumped.


Solution

  • The warning is not your issue.

    The real problem is simply you miss some dependencies in your snaps: for some reason snap is not installing all the requiered depdencies, while it should. In an Ubuntu I have telegram-desktop and it works fine and I did this check:

    snap list
    

    to list the actual snaps.

    And next I did check all the interdependencies by looking at the connections with:

    snap connections telegram-desktop
    

    this on my Utbuntu machine yields:

    Interface                             Plug                                    Slot                                                  Notes
    alsa                                  telegram-desktop:alsa                   -                                                     -
    audio-playback                        telegram-desktop:audio-playback         :audio-playback                                       -
    audio-record                          telegram-desktop:audio-record           -                                                     -
    content[gtk-3-themes]                 telegram-desktop:gtk-3-themes           gtk-common-themes:gtk-3-themes                        -
    content[icon-themes]                  telegram-desktop:icon-themes            gtk-common-themes:icon-themes                         -
    content[kde-frameworks-5-core18-all]  telegram-desktop:kde-frameworks-5-plug  kde-frameworks-5-core18:kde-frameworks-5-core18-slot  -
    content[sound-themes]                 telegram-desktop:sound-themes           gtk-common-themes:sound-themes                        -
    desktop                               telegram-desktop:desktop                :desktop                                              -
    desktop-legacy                        telegram-desktop:desktop-legacy         :desktop-legacy                                       -
    gsettings                             telegram-desktop:gsettings              :gsettings                                            -
    home                                  telegram-desktop:home                   :home                                                 -
    network                               telegram-desktop:network                :network                                              -
    network-manager                       telegram-desktop:network-manager        -                                                     -
    opengl                                telegram-desktop:opengl                 :opengl                                               -
    pulseaudio                            telegram-desktop:pulseaudio             :pulseaudio                                           -
    removable-media                       telegram-desktop:removable-media        -                                                     -
    unity7                                telegram-desktop:unity7                 :unity7                                               -
    wayland                               telegram-desktop:wayland                :wayland                                              -
    x11                                   telegram-desktop:x11                    :x11                                                  -
    

    next I have found that the library libQt5Widgets.so.5 you are missing is provided by kde-frameworks-5-core18

     sudo find /snap -name libQt5Widgets.so
    
     /snap/kde-frameworks-5-core18/32/usr/lib/x86_64-linux-gnu/libQt5Widgets.so
    

    I don't know if on fedora you could use:

    snap install kde-frameworks-5-core18
    

    to fix your missing dependency.

    On the other side on Fedora and similar distros you could try to use flatpak instaead of snap: flatpak comes as default app-package manager for the Fedora family.

    First you need to add flathub as a flatpak remote repository:

    sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
    

    next you can search:

    flatpak search discord
    flatpak search telegram
    

    and next install the apps:

    sudo flatpak install com.discordapp.Discord
    sudo flatpak install org.telegram.desktop
    

    I tested this on a CentOS virtual machine (I dont' have a fedora ready to test, but CentOS is close enough) and I got them both correctly working.