Reproducible Builds on AlmaLinux with the AlmaLinux Build System (ABS)
Learn how to use AlmaLinux’s built‑in ABS to produce RHEL‑compatible binaries from source. The guide covers requirements, a minimal design, trust boundaries, operational checks, and failure modes that may force a design change.
09 Sept 2025, 18:12 UTC

Why Reproducible Builds Matter on AlmaLinux
AlmaLinux’s commitment to binary compatibility with Red Hat Enterprise Linux (RHEL) is built on the AlmaLinux Build System (ABS). ABS lets you rebuild any RHEL‑derived package from source, producing an identical binary that is signed with the AlmaLinux GPG key. This guarantees that your custom builds are trustworthy, auditable, and fully compliant with the distribution’s security policies.
1. Requirements Checklist
- ABS package – Install with
dnf install abs. Verify withrpm -q abs. - Mock or rpmbuild – ABS relies on
mockto create isolated chroots. Ensuremockis present:dnf install mock. - Source RPMs (SRPMs) – Obtain from the AlmaLinux Vault or debuginfo repositories. SRPMs are signed with the AlmaLinux GPG key.
- GPG key – The AlmaLinux key should be imported into your keyring. Check with
rpm -qi gpg-pubkeyfor a key ending inalmalinux.org. - Disk space & CPU – Large packages (e.g., kernel, Mesa) can consume >10 GB and several hours of CPU time.
2. Minimal Design: A Single Mock Chroot Build
The smallest, most reliable workflow uses a dedicated mock configuration that mirrors the target RHEL release. For example, to rebuild httpd-2.4.46-1.el8 for AlmaLinux 8 on an x86_64 host, follow:
# 1. Locate the SRPM
srpm_path="/srv/almalinux/vault/8.6/os/x86_64/SRPMS/httpd-2.4.46-1.el8.src.rpm"
# 2. Rebuild in the appropriate mock chroot
mock -r almalinux-8-x86_64 rebuild $srpm_path
# 3. Verify the output RPM
output_dir="~/rpmbuild/RPMS/x86_64"
for rpm in $output_dir/*.rpm; do
rpm -K $rpm
rpm -qp --qf "%{NVR}\n" $rpm
done
Key points:
- The
almalinux-8-x86_64.cfgmock file pulls the exact build dependencies from the AlmaLinux mirrors. - ABS does not modify the spec file; it uses the upstream spec unchanged, preserving binary compatibility.
- The build runs as an unprivileged user inside the chroot, ensuring isolation.
3. Trust and Data Boundaries
| Component | Trust Boundary | Verification Step |
|---|---|---|
| Source RPM | Signed by AlmaLinux GPG key | rpm -K httpd-2.4.46-1.el8.src.rpm |
| Mock Chroot | Runs as non‑root, isolated environment | Inspect /etc/mock/almalinux-8-x86_64.cfg for root:mock |
| Binary RPM | Signed with AlmaLinux key | rpm -K httpd-2.4.46-1.el8.x86_64.rpm |
| Build Dependencies | Fetched from AlmaLinux mirrors | Check mock.log for Downloading entries |
4. Operational Checks After Build
- Signature Verification –
rpm -K *.rpmshould reportpgp: OKfor all packages. - Filelist Consistency – Compare the filelist of the rebuilt package with the upstream binary. Use
rpm -qlp rebuilt.rpmvs.rpm -qlp upstream.rpmanddiff. - Test Suite Execution – If the SRPM contains a
tests/directory, runmock -r ... --run-testsor manually invokemake testinside the chroot. - NVR Matching – The
Name-Version-Releasestring should match the upstream NVR unless you intentionally modify theReleasefield. - Binary Size & SHA256 – For high assurance, compute
sha256sumof the binary and compare with the upstream checksum if available.
5. Failure Modes and When to Re‑design
- GPG Key Rotation – If AlmaLinux rotates the signing key, previously built binaries will fail
rpm -K. Update your keyring and rebuild. - Missing or Corrupt SRPM – A download error or corrupted SRPM will abort the build. Verify
rpm -q --qf "%{SIGPGP:pgpsig}\n" $srpmbefore building. - Mock Misconfiguration – Incorrect
mockconfig (e.g., wrong repo URLs) leads to missing dependencies. Checkmock.logfor “No such file or directory” errors. - Dependency Changes – Upstream patches that add new build dependencies require updating the mock base image. Use
mock --initto refresh. - Custom Patches or Spec Modifications – Applying patches breaks the binary compatibility guarantee. If you must patch, document the change and consider maintaining a separate build branch.
- Resource Exhaustion – Large builds may exceed disk or CPU limits. Monitor
df -hand CPU usage during the build.
When to Shift to a More Complex Design
If you need to:
- Patch upstream sources for security or feature reasons.
- Integrate with CI/CD pipelines that require reproducible builds across multiple architectures.
- Produce packages for custom target environments (e.g., minimal or embedded).
In those cases, consider:
- Using
ABSwith--patchto apply curated patches. - Creating multiple mock configurations for each target architecture.
- Automating the build with
buildfarmor a containerizedmockrunner.
6. Practical Verification Checklist
- Confirm ABS installation:
rpm -q absreturns a version. - Verify mock config exists:
ls /etc/mock/almalinux-8-x86_64.cfg. - Test a quick build (e.g.,
bashorcoreutils) to ensure the environment works. - Run
rpm -Kon the resulting binary; expectpgp: OK. - Use
rpm -Vto verify file integrity against the spec.
7. Summary
AlmaLinux’s ABS provides a straightforward path to reproducible, RHEL‑compatible binaries. By adhering to the minimal design—using the official mock configuration, unmodified spec files, and signed SRPMs—you maintain the distribution’s security guarantees while enjoying the flexibility of source builds. Operational checks and a clear understanding of failure modes ensure that your builds remain trustworthy and auditable.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.