Glibc mismatch

I’m building a snap and getting some errors that I don’t know what to do with:

Priming certbot 
Files from the build host were migrated into the snap to satisfy dependencies that would otherwise not be 
met. This feature will be removed in a future release. If these libraries are needed in the final snap, ensure 
that the following are either satisfied by a stage-packages entry or through a part:
snap/core/current/lib/x86_64-linux-gnu/libbz2.so.1.0
snap/core/current/lib/x86_64-linux-gnu/liblzma.so.5
snap/core/current/lib/x86_64-linux-gnu/libncursesw.so.5
snap/core/current/lib/x86_64-linux-gnu/libtinfo.so.5
snap/core/current/lib/x86_64-linux-gnu/libz.so.1
snap/core/current/usr/lib/x86_64-linux-gnu/libdb-5.3.so
snap/core/current/usr/lib/x86_64-linux-gnu/libpanelw.so.5
The primed files will not work with the current base given the GLIBC mismatch of the primed files and the 
linker version (2.23) used in the base. These are the GLIBC versions required by the primed files that do not 
match and will be patched:
- /home/bsutton/git/orionmonitor/snap-projects/installer/prime/lib/x86_64-linux-gnu/libcrypt-2.26.so -> GLIBC 2.25
- /home/bsutton/git/orionmonitor/snap-projects/installer/prime/usr/bin/python3.6m -> GLIBC 2.25
- /home/bsutton/git/orionmonitor/snap-projects/installer/prime/usr/bin/python3.6 -> GLIBC 2.25

So two questions:

  1. how do I resolve the glibc mismatch.
  2. How do I add the necessary libraries to the stage-packages?
    e.g
    Does:
    snap/core/current/lib/x86_64-linux-gnu/libbz2.so.1.0

become
stage-packages:

  • libbz2.so.1.0

stage-packages describes debian packages, so you need to find out which deb ships the required file:

$ dpkg -S /lib/x86_64-linux-gnu/libbz2.so.1.0
libbz2-1.0:amd64: /lib/x86_64-linux-gnu/libbz2.so.1.0

this would then become:

stage-packages:
  - libbz2-1.0

All in all, you should really use

snapcraft cleanbuild

… so that you build in a clean environment (and with the correct libc) and do not taint the snaps with undefined libs.

Otherwise the snap build will most likely not work on any autobuilder (like launchpad or build.snapcraft.io) unless you are lucky that these particular libs are occasionally around.

so are you saying that if I use ‘snapcraft cleanbuild’ that I won’t need to add libbz2 to the stage-packages?

no, he’s saying you add libbz2-1.0 as a stage package to fix that problem.

Separately he’s saying the glibc issue will go away if you use snapcraft cleanbuild

1 Like

OK, that makes sense. I must say the doco on cleanbuild needs some work!

So the next problem is that a no. of the libs don’t exist on my system and I’m not certain about how to make them available.

e.g.
dpkg -S snap/core/current/lib/x86_64-linux-gnu/libz.so.1
dpkg-query: no path found matching pattern
snap/core/current/lib/x86_64-linux-gnu/libz.so.1

So how do I identify which package needs to be installed to provide the missing libraries.

Note; this is just one example I’m missing half a dozen libraries.

OK, so might have found my own answer:

I change the dpkg path I’m searching for to just be the lib name:

snapcraft prime                                                                    
Failed to fetch stage packages: Error downloading packages for part 
'pi-gation-launch': The package 'libsystemd.so.0' was not found..

So I then ran:

dpkg -S libsystemd.so.0

which listed:

libsystemd0:i386: /lib/i386-linux-gnu/libsystemd.so.0
libsystemd0:amd64: /lib/x86_64-linux-gnu/libsystemd.so.0.19.0
libsystemd0:amd64: /lib/x86_64-linux-gnu/libsystemd.so.0
libsystemd0:i386: /lib/i386-linux-gnu/libsystemd.so.0.19.0

I edit my snapcraft.yaml and added:

stage-packages:
  - /lib/x86_64-linux-gnu/libsystemd.so.0

This seemed to be the ‘best’ choice.

This changed fixed the error but I’m not certain it was the right approach?

Brett

OK so that doesn’t work as expected.

So I’m now getting errors like:

Failed to fetch stage packages: Error downloading packages for part ‘pi-gation-launch’: The package ‘/lib/x86_64-linux-gnu/libsmartcols.so.1’ was not found…

So the lib in question definitely exists on my machine, so why isn’t snapcraft finding it?

stage-packages:
#- libsmartcols.so.1
- /lib/x86_64-linux-gnu/libsmartcols.so.1

OK, so I’m a complete idiot <

I was (obviously) using the lib path rather than the package name.

For the record:

If you get an error like:

Files from the build host were migrated into the snap to satisfy 
dependencies that would otherwise not be 
met. This feature will be removed in a future release. If these libraries are needed in the final snap, ensure 
that the following are either satisfied by a stage-packages entry or 
through a part:
snap/core/current/lib/x86_64-linux-gnu/libbz2.so.1.0

You need to run:

dpkg -S libbz2.so.1.0
libbz2-1.0:amd64: /lib/x86_64-linux-gnu/libbz2.so.1.0.4
libbz2-1.0:amd64: /lib/x86_64-linux-gnu/libbz2.so.1.0

Note the package name is the first word on the response line (before the colon). So in this case you need to add:

stage-packages
  - libbz2-1.0

Thanks for your assistance. Appologies for my stupidity :slight_smile:

2 Likes

Thanks for the solution!