pevik
pevik

Reputation: 4801

rpmbuild skip "checking for unpackaged file(s) /usr/lib/rpm/check-files"

While building kernel rpm packagerpmbuild does it's slow "Checking for unpackaged file(s)" check:

$ make -j$(nproc) binrpm-pkg
...
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/user/rpmbuild/BUI
LDROOT/kernel-4.17.0_rc5_next_20180517_3.gd86d9e8_default+-98.x86_64

For kernel even on powerful machine it takes 30 mins. How to avoid that? I've tried to to avoid it with _unpackaged_files_terminate_build, but it didn't help:

echo "%_unpackaged_files_terminate_build    0" >> ~/.rpmmacros

Also adding --nocheck to rpmbuild call to binrpm-pkg target in scripts/package/Makefile didn't help.

But maybe it's something else wrong. When I build with configuration make allyesconfig rpm file has 168MB. RPM file builded with openSUSE Tumbleweed config has 647MB.

Upvotes: 4

Views: 3533

Answers (3)

ListsOfArrays
ListsOfArrays

Reputation: 672

For future reference, the problem line is in buildHost(void) inside build RPM.

Code:

    bhMacro = rpmExpand("%{?_buildhost}", NULL);
    if (strcmp(bhMacro, "") != 0) {
        rasprintf(&hostname, "%s", bhMacro);
    } else {
    hostname = rcalloc(NI_MAXHOST + 1, sizeof(*hostname));
    if (gethostname(hostname, NI_MAXHOST) == 0) {
        struct addrinfo *ai, hints;
        memset(&hints, 0, sizeof(hints));
        hints.ai_flags = AI_CANONNAME;

        if (getaddrinfo(hostname, NULL, &hints, &ai) == 0) {
        strcpy(hostname, ai->ai_canonname);
        freeaddrinfo(ai);
        } else {
        rpmlog(RPMLOG_WARNING,
                    _("Could not canonicalize hostname: %s\n"), hostname);
        }
    }

If you define _buildhost with hostname, it will skip the DNS call.

Example:

rpmbuild -bb --define "_buildhost $(hostname)" ./path/to/spec/file.spec

Note: the install will still hang on the "check files" part, but it's doing other stuff in the background, and the DNS call itself will be skipped.

Upvotes: 1

Sébastien CAPOU
Sébastien CAPOU

Reputation: 41

Got same issue and found out what was happening.

If your rpmbuild is slow to process it doesn't come from /usr/lib/rpm/check-files script:
try to comment all its lines, you'll see that it's still hanging after that, even if this script is basically doing nothing anymore.

Executing :

strace -f -s900 rpmbuild [your args]

You'll see that between hangs, DNS calls are issued (calls to /usr/lib64/libresolv.so library) trying to resolve the hostname of your build machine, which fall on timeout after some time and then retries .

If your machine have a faulty DNS configuration or if your DNS server is not working, the rpmbuild process will hang on each launch.

To avoid those hangs:

  • correct your DNS configuration on your build machine, or
  • sudo rm -f /etc/resolv.conf on your build machine

The real question remaining is: Why a local process like rpmbuild is doing DNS calls?

Upvotes: 4

Aaron D. Marasco
Aaron D. Marasco

Reputation: 6758

Unfortunately, I'm pretty sure you cannot stop it. Is it on a slow drive? Are you in an enterprise environment where /home/user is network-mounted?

What you tried to change simply says "if you find files that I didn't account for, make it a warning not an error."

Upvotes: 1

Related Questions