NetBSD Problem Report #42495

From  Tue Dec 22 15:39:23 2009
Return-Path: <>
Received: from ( [])
	by (Postfix) with ESMTP id A038363C501
	for <>; Tue, 22 Dec 2009 15:39:23 +0000 (UTC)
Message-Id: <>
Date: Tue, 22 Dec 2009 15:39:23 +0000 (UTC)
Subject: Corrupt db files created by cross-built wd_mkdb and cap_mkdb
X-Send-Pr-Version: www-1.0

>Number:         42495
>Category:       toolchain
>Synopsis:       Corrupt db files created by cross-built pwd_mkdb and cap_mkdb
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Dec 22 15:40:00 +0000 2009
>Closed-Date:    Sun Jul 13 03:10:50 +0000 2014
>Last-Modified:  Sun Jul 13 03:10:50 +0000 2014
>Originator:     Mark Lang
>Release:        5.0.1
Linux 2.6.26-2-powerpc64 #1 SMP ppc64 GNU/Linux
I am cross-compiling a NetBSD 5.0.1 system.  The target arch is i386.  The build host arch is Debian Linux powerpc64 ('lenny').  Everything built without errors:

 ./ -U -j2 tools
 ./ -u -U -j 2 kernel=SOEKRIS_4801
 ./ -u -U -j 2 build
 ./ -u -U distribution
 ./ -U -u sets

I un-tarred the sets into an empty directory on the build host which is the NFS-mounted rootfs for the netbooting target machine (a Soekris 4801).  After booting the just-built system on the Soekris, I observed the following problems:

/etc/pwd.db is 260MB.  Any operations on it emit an error message.
/etc/spwd.db is likewise 260MB

These anomalies are in the $DESTDIR files, and consequently the sets:

$ tar tvzf release/i386/binary/sets/etc.tgz | grep pwd
-rw-r--r-- root/wheel 268712332 2009-12-20 15:08 ./etc/pwd.db
-rw-r--r-- root/wheel 268703884 2009-12-20 15:08 ./etc/spwd.db

Being more interested in getting my Soekris system working than figuring out what went wrong, I worked around this by replacing those two files with proper ones from another i386 NetBSD 5.0 box, and then updating them with pwd_mkdb.

However, further investigation revealed additional corrupt db files in the target filesystem (and in the $DESTDIR):

$ ls -l rootfs/usr/share/misc/ | fgrep db
-r--r--r-- 1 root root 269115652 2009-12-20 10:26 termcap.db
-r--r--r-- 1 root root 268599556 2009-12-20 10:19 vgrindefs.db

As an experiment, on the Debian powerpc machine, I then manually ran the toolchain nbcap_mkdb using essentially the same command as is found in src/usr.bin/vgrind/Makefile:

$ toolchain/bin/nbcap_mkdb -l -f vgrindefs.src src/usr.bin/vgrind/vgrindefs.src

And see that it creates a 260MB db file:

$ ls -l vgrindefs.src.db
-rw-r--r-- 1 mcl mcl 268599556 2009-12-22 08:48 vgrindefs.src.db

And which is corrupt.  On the target machine:

soekris# db hash /usr/share/misc/vgrindefs.db
db: Opening database `/usr/share/misc/vgrindefs.db': Inappropriate file type or format

This all seems to indicate that the nbcap_mkdb and nbpwd_mkdb executables have bugs when they are cross-compiled (at least, when the build machine is Linux powerpc).

$ file toolchain/bin/nbcap_mkdb
toolchain/bin/nbcap_mkdb: ELF 32-bit MSB executable, PowerPC or cisco 4500, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.8, with unknown capability 0x41000000 = 0xf676e75, not stripped

$ ldd toolchain/bin/nbcap_mkdb =>  (0x00100000) => /usr/lib/ (0x0ffcb000) => /lib/ (0x0fe45000)
        /lib/ (0xf7fce000)

At the end of the day: it is not possible to successfully cross-build an error-free complete NetBSD 5.0.1 i386 system using a Linux powerpc system as the build host.




State-Changed-From-To: open->feedback
State-Changed-When: Sat, 31 Dec 2011 19:48:01 +0000
Sorry this got ignored for two years... did you ever discover anything more?
Do you know if it still happens with more recent code (e.g. 5.1_STABLE or

State-Changed-From-To: feedback->closed
State-Changed-When: Sun, 13 Jul 2014 03:10:50 +0000
Feedback timeout. Also, I recall fixing at least one similar problem
(that is, monster .db files) and much of the code has been turned over
since this PR was filed anyway. If the problem recurs, or still happens,
please write in and/or file a new PR.


NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD:,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.