check_deps_portable.sh is a cross‑distribution ELF dependency scanner. It:
- runs
lddon a target binary or shared object, - maps each resolved
.sopath to its owning package (installed DB first; repo search as a fallback), - suggests build/development packages (
-dev/-develor equivalents) using distro‑specific heuristics.
This helps you quickly list runtime packages and find headers/devel packages you might need to compile against the same libraries on another machine.
The script auto‑detects the distro family via /etc/os-release and supports:
- Debian/Ubuntu/Kali/Pop!_OS:
dpkg -S,apt-file search - RHEL/CentOS/Alma/Rocky/Amazon Linux/Fedora:
rpm -qf,dnf|yum provides(orrepoquery) - openSUSE/SLES:
rpm -qf,zypper what-provides - Arch/Manjaro:
pacman -Qo,pacman -F(file database required) - Alpine:
apk info -W,apk search -x - Gentoo:
equery b(requiresgentoolkit) - Void:
xbps-query -o,xbps-query -Rs
If your distribution isn’t listed but is compatible with one of these families, the script will likely still work.
- POSIX shell + common CLI tools
ldd(from your system libc tooling, e.g.glibc/libc-bin/musl-utils)- For repository search (fallback when a file isn’t owned locally), install the family‑specific tools:
- Debian/Ubuntu:
apt-file(sudo apt update && sudo apt install -y apt-file && sudo apt-file update) - RHEL/Fedora:
dnf/yum(orrepoquery) with configured repos - openSUSE:
zypper - Arch:
pacman -Fyonce to enable file database - Alpine:
apkalready included; repo indexes must be available - Gentoo:
app-portage/gentoolkitforequery - Void:
xbps-query
- Debian/Ubuntu:
The script still works in “installed DB only” mode if repo search tools are missing; it just won’t suggest owners for files not installed from packages.
chmod +x check_deps_portable.sh./check_deps_portable.sh /path/to/your/binary./check_deps_portable.sh /usr/bin/curl- A list of resolved
.sofiles with their owning package (from local DB when possible). - When a file is not owned locally, up to a few candidate providers from repos (“cand:” lines).
- A Runtime packages summary (unique)
- A Suggested build packages summary (heuristic; may include
-dev/-develpackages or toolchain groups likebase-devel)
Different families use different conventions:
- Debian/Ubuntu:
libfooN→libfoo-dev - RHEL/Fedora/SUSE:
libfoo→libfoo-devel - Alpine: often
libfoo→libfoo-dev - Arch/Void/Gentoo: dev headers may come from toolchain groups (
base-devel) or from the main package; suggestions are best‑effort.
Treat the suggestions as hints; verify exact package names in your repos.
- No output from repo search: ensure you’ve initialized the search index:
- Debian/Ubuntu:
apt-file update - Arch:
sudo pacman -Fy - Gentoo:
sudo emerge --ask app-portage/gentoolkit
- Debian/Ubuntu:
- Custom or bundled libraries: the script will report “no owner; maybe custom/copy” when it can’t find a package.
- Containers/minimal images: you may need to install the package query tools first.
- The script reads
lddoutput. Avoid running it on untrusted binaries from unknown sources on production systems. - Repository queries may disclose package names/versions to your configured mirrors (standard package manager behavior).
- MIT