libX11.so.6 not found on PopOS

Hello,

My snap VHDPlus (classic confinement) is working on Ubuntu 20.10 just fine. On POPOS however, it crashes with: liblibX11.so.6: cannot open shared object file: No such file or directory

Just for context. My app is self contained and just dumped into the package. While the original dump is working, it does not work anymore after prime.

I tried adding libx11-6 to stage packages without success. Any Idea what could be wrong?

this should be libX11.so.6 you’ve somehow doubled up lib

Here is the full message:

Unable to load shared library ‘libX11.so.6’ or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibX11.so.6: cannot open shared object file: No such file or directory

I have no Idea what could cause this. Ubuntu 20 works fine, POPOS 21 or Arch linux does not

Can someone please help? This is quite important

I think you should start a shell snap run --shell <snap>.<app> and then inspect LD_LIBRARY_PATH. It may point to incorrect location, or a location that you need may be missing there. Also, it would be useful to first confirm that libX11.so.6 is indeed in the snap.

it’s a classic snap, so you really do not want to use LD_LIBRARY_PATH. You’ve bitten quite a task by packaging in classic mode, which requires a lot of work to get right. Classic snaps must not access any shared libraries from the host system, so you need to ensure that RPATHs are appropriately set to begin with.

I can’t find libX11.so.6 in the snap itself when I do snapcraft try. Somehow Ubuntu 20 can use it’s own libX11 while POPOS can’t. (I guess)

I have absolutely no idea how to resolve this issue :confused:

A place to start is to try staging libx11-6. Check the RPATH of your application binary to ensure it’s looking for libX11.so.6 in the right place e.g. $ORIGIN/usr/lib/x86_64-linux-gnu:/snap/core20/current/lib/x86_64-linux-gnu.

To check the RPATH you can use readelf --dynamic {your-binary} e.g. readelf --dynamic /snap/vhdplus/current/VHDPlus. Sorry if I’m teaching you to suck eggs, just wanted to be thorough.

There is a libX11.so.6 in your snap but it’s not in a directory listed in your application’s RPATH currently. Just FYI, your snap doesn’t run on my Ubuntu 21.04 system either - same error message.

Thank you very much! I managed to resolve the issue. If anyone has the same problem, I fixed it similar to this:

Hopefully it works on all platforms now
1 Like