Troubleshooting

deb error packages database contains unused *

This error message can be encountered during deb package builds:

 ⚬ ERROR: error while running task <id>: Command reprepro --basedir /var/lib/fatbuildr/registry/default/deb --component main --list-format '${$architecture}|${version}\n' list bullseye fatbuildr failed with exit code 255: Error: packages database contains unused 'ubuntu22.04|main|amd64' database.
This usually means you removed some component, architecture or even
a whole distribution from conf/distributions.
In that case you most likely want to call reprepro clearvanished to get rid
of the databases belonging to those removed parts.
(Another reason to get this error is using conf/ and db/ directories
 belonging to different reprepro repositories).
To ignore use --ignore=undefinedtarget.
There have been errors!

As stated in the error message, this error can happen when reprepro, the tool used by Fatbuildr manages APT repository, detects entities in repository database later removed from repository distributions configuration file. This can typically happen with Fatbuildr after failed attempts to build deb packages for a new distribution.

The way to clear this error is to run this command:

$ sudo -u fatbuildr reprepro --basedir /var/lib/fatbuildr/registry/$instance/deb clearvanished

Where $instance is the name of the Fatbuildr instance (ex: default in the above example error message).

deb error already registered with different checksums!

During deb packages builds, reprepro can complain about conflicting packages files already present in APT repository while the respective files cannot be found while exploring the repository content. When this happens, this error message can be encountered at build time:

File "pool/main/<p>/<package>.deb" is already registered with different checksums!
md5 expected: <md5a>, got: <md5b>
sha1 expected: <sha1a>, got: <sha256b>
sha256 expected: <sha256a>, got: <sha256b>
size expected: <sizea>, got: <sizeb>

With valid package file path and checksum values in placeholders.

This may happen when the reprepro database references files that have been removed for filesystem, due to various kind of runtime errors. Such missing files can be listed with the following command:

$ sudo -u fatbuildr reprepro --basedir /var/lib/fatbuildr/registry/$instance/deb dumpunreferenced

Where $instance is the name of the Fatbuildr instance (ex: default in the above example error message).

If the previous command returns any value, it is highly recommended to delete all these references with this second command:

$ sudo -u fatbuildr reprepro --basedir /var/lib/fatbuildr/registry/$instance/deb deleteunreferenced

This should clear all unexpected error messages related to conflicting checksums.

deb error Cannot bind debian directory!

This error message can be encountered during Deb package builds:

 ⚬ INFO: Using artifact source tarball from cache /var/cache/fatbuildr/default/<tarball>
 ⚬ INFO: Building source Deb packages for <artifact>
 ⚬ INFO: Adding entry to changelog
debchange: fatal error at line 651:
Cannot find debian directory!
Are you in the correct directory?
 ⚬ ERROR: error while running task <id>: Command /usr/libexec/fatbuildr/u-nspawn --directory /var/lib/fatbuildr/images/default/deb.img --bind /usr/share/fatbuildr/images/deb --bind /usr/share/fatbuildr/images/common --quiet --register=no --keep-unit --user fatbuildr --bind /var/lib/fatbuildr/workspaces/default/<id> --bind /var/cache/fatbuildr/default/<artifact> --chdir /var/lib/fatbuildr/workspaces/default/<id>/<artifact>-<version> --setenv DEBEMAIL=<email> --setenv 'DEBFULLNAME=<name>' debchange --create --package <artifact> --newversion <version> --distribution bullseye --force-distribution '<message>' failed with exit code 13
 ⚬ INFO: Task failed

This can happen because the UID/GID of the fatbuildr system user in deb container image does not match the UID/GID on the host.

Check the UID/GID of the fatbuildr user on the host:

$ id fatbuildr

Then check the UID/GID of the fatbuildr system user in the deb image on the associated instance:

$ fatbuildrctl images shell -f deb id fatbuildr

If it does not match the host, the UID/GID of the user must be changed in the container image by editing /etc/passwd and /etc/group file. This should be fix the previous error.

There is a logic involved in Fatbuildr to create the fatbuildr system user in container images with the same UID/GID as on the host. Unfortunately, it is not reliable in all situations. Typically, if base package create system users at image creation time and allocate the same UID/GID before Fatbuildr has the opportunity to tune the image, it may fail.

rpm error Command failed: /usr/sbin/usermod -u 998 mockbuild

This error message can be encountered during RPM package builds:

Mock Version: 3.0
INFO: Mock Version: 3.0
ERROR: Command failed:
 # /usr/sbin/usermod -u 998 mockbuild
 ⚬ ERROR: Error while running prescript: Command /usr/libexec/fatbuildr/u-nspawn --directory /var/lib/fatbuildr/images/default/rpm.img --bind /usr/share/fatbuildr/images/rpm --bind /usr/share/fatbuildr/images/common --quiet --register=no --keep-unit --user fatbuildr --bind /var/lib/fatbuildr/workspaces/default/a10e8176-677d-4afd-bfdc-ff99e47708fd --bind /var/cache/fatbuildr/default/fatbuildr --bind /var/lib/fatbuildr/registry/default/rpm mock --root rocky-8-x86_64 --enable-plugin fatbuildr_derivatives --plugin-option fatbuildr_derivatives:repo=/var/lib/fatbuildr/registry/default/rpm --plugin-option fatbuildr_derivatives:distribution=el8 --plugin-option fatbuildr_derivatives:derivatives=main --plugin-option fatbuildr_derivatives:keyring=/var/lib/fatbuildr/workspaces/default/a10e8176-677d-4afd-bfdc-ff99e47708fd/keyring.asc --dnf-cmd install wget failed with exit code 8

One solution to clear this error is to clean and scrub the build environment with the following commands:

$ fatbuildrctl images shell -f rpm -- mock --root $environment --clean
$ fatbuildrctl images shell -f rpm -- mock --root $environment --scrub all

Where $environment is the name of the build environment (ex: rocky-8-x86_64 in the above example error message), and $instance is the name of the Fatbuildr instance (ex: default in the above example error message).