Alternative packaging and shared libraries
Quick answer
Flatpak and Snap deliver applications through distinct packaging systems. Source builds and native distribution packages follow other workflows. A program may also need shared libraries at runtime.
Prepare the practice environment
Use an ordinary user in a disposable VM of the distribution named in the example. For Debian examples use python3 lab-fixtures/packages/setup.py from the extracted package root, enter the printed directory and check pwd; alternatively create a private directory with mktemp -d. Use a fresh directory per example, export LC_ALL=C and Bash with set -o pipefail. Do not use sudo. Keep -s and --no-download on every APT simulation. Skip missing tools; do not install them merely to run an example. On Alpine the simple query also works in a compatible sh. Outputs vary by installed versions and repository state. Stop on unexpected failure.
How it works
Flatpak uses application IDs, runtimes and remotes; isolation depends on permissions. Snap uses snapd, revisions, channels and confinement that varies by package. Neither guarantees complete isolation or replaces the OS package manager. Building from source needs trusted code, dependencies and an uninstall/update strategy; do not run unknown build scripts as root. ELF binaries can declare shared library dependencies in dynamic tags. readelf -d inspects direct NEEDED entries without running the binary; ldd resolves dependencies in the current environment and must only be used on trusted executables. A missing library may reflect architecture, loader or package mismatch, not just a missing filename. Do not download random shared objects or create arbitrary compatibility symlinks.
A NEEDED entry in the ELF dynamic section names a declared direct dependency; it does not identify the exact file the loader will select on every machine. ldd on the trusted system executable illustrates resolution in the current environment, potentially including transitive dependencies. A successful lookup is not a test of application behavior, and library resolution can differ between architectures and environments. For Flatpak, an application listing identifies installed applications, not all effective permissions or the host package inventory.
Try the examples
readelf -d /usr/bin/true | grep '(NEEDED)' >/dev/null && printf 'direct dependencies found\n'The trusted Debian executable is dynamically linked in this environment. Inspect readelf -d output directly to see names; other builds may be static.
Expected stdout:
direct dependencies foundldd /usr/bin/true | grep 'libc.so.6' >/dev/null && printf 'libc entry found\n'The installed trusted GNU true uses glibc here; paths and memory addresses vary. This is not a security or completeness check.
Expected stdout:
libc entry foundRun only in a VM where Flatpak is installed; the application list may be empty. For a separate Snap VM use snap list; daemon availability matters.
Manual example; not executed locally. Follow its stated environment restrictions.
Common mistakes
Never run ldd on an untrusted executable. Prefer static inspection in an isolated environment; even parsers are not a security sandbox. Do not mix library binaries from unrelated distributions.
Practice
Inspect /usr/bin/true using readelf in a disposable Debian VM. Explain direct dependencies versus resolved locations, and when native packages, Flatpak or Snap may be appropriate.
Related references
Study: flatpak, snap, readelf, ldd. These are reference names, not deployed links.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Alternative packaging and shared libraries — Knowledge Check
Apply package-management concepts to the stated distribution and query-only lab.
Which command statically inspects ELF dynamic tags?
Why avoid ldd on an untrusted program?
What does flatpak list --app show?
Can a source build require a maintenance plan?