NetBSD Problem Report #60600
From www@netbsd.org Sat Aug 15 16:58:00 2026
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
client-signature RSA-PSS (2048 bits) client-digest SHA256)
(Client CN "mail.netbsd.org", Issuer "YR2" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 4C8811A923C
for <gnats-bugs@gnats.NetBSD.org>; Sat, 15 Aug 2026 16:58:00 +0000 (UTC)
Message-Id: <20260815165758.BB5801A923E@mollari.NetBSD.org>
Date: Sat, 15 Aug 2026 16:57:58 +0000 (UTC)
From: thorpej@me.com
Reply-To: thorpej@me.com
To: gnats-bugs@NetBSD.org
Subject: ldconfig should not default to "YES", because the presence of a.out shlibs is vanishingly rare
X-Send-Pr-Version: www-1.0
X-From4GNATS: "thorpej@me.com via gnats" <gnats-admin@NetBSD.org>
>Number: 60600
>Category: bin
>Synopsis: ldconfig should not default to "YES", because the presence of a.out shlibs is vanishingly rare
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people
>State: closed
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Sat Aug 15 17:00:01 +0000 2026
>Closed-Date: Wed Sep 02 13:49:44 +0000 2026
>Last-Modified: Wed Sep 02 13:49:44 +0000 2026
>Originator: Jason Thorpe
>Release: NetBSD 11.99.7
>Organization:
Retrogrouches'R'Us
>Environment:
Any slow-ish historically a.out machine will suffice
>Description:
On platforms that previously had a.out shared libraries, ldconfig(8) is run at boot time i order to update the a.out shared library hints file. While I'm sure this is well-intentioned, any system installed in the last 20 years almost certainly does not have a.out shared libraries lingering around, and so whatever work ldconfig(8) does is entirely frivilous and serves no purpose.
The assertion was made in passing that "it's supposed to be fast", and while that might be true on some machines, it's not necessarily true on others. ldconfig(8) ends up doing a fair amount of I/O. It scans directories for files matching the pattern "lib*.so.*" (this matching is open-coded, achieved by matching substrings), and then for each file matching that pattern, it opens it, and reads the first small bit of it looking for a ZMAGIC a.out header with the EX_DYNAMIC bit set.
On a fresh NetBSD/hb68k install, there are 408 files that match the "lib*.so.*" pattern in /usr/lib, which is a directory that is consulted by default by ldconfig(8). So, for a fresh system with no a.out shared libraries, ldconfig(8) will open 408 files and read an a.out header from each, only to not find what it's looking for.
Exactly half of those files are symlinks, e.g. libskey.so.2 -> libskey.so.2.0. So exactly half of these opens/reads are completely redundant.
Now let's consider the cost of the I/O. Half of those 408 reads will hit the buffer cache (because of the symlinks), so it's not entirely all bad news. And a small handful of them may also hit the buffer cache due to the (ELF) shared libraries already being in-use during boot. However, there are a significant number of them that won't be in use during boot, and this means real I/O costs that have to be paid.
Even though the ldconfig(8) program only reads an a.out header, of course the file system is going to bring in more data than that. It will, at mininum, bring in one PAGE_SIZE chunk of data, which in this example is going to be 4KB.
The wrap030 system has a PIO-only ATA disk interface, and it's not uncommon for these sorts of systems to be used with CompactFlash type devices. CF devices often support only single-sector PIO transfers, so that 4KB page turns into 8 individual 512-byte PIO reads.
Assuming that 200 of the library checks result in a buffer cache miss, that's 1600 single-sector PIO reads in total. This is, as you might imagine, not fast on a 25MHz 68030.
>How-To-Repeat:
Boot an I/O-constrained m68k system.
>Fix:
The "ldconfig" setting in /etc/defaults/rc.conf should default to NO. People who want/need to pay this cost can do so by setting it to YES in /etc/rc.conf.
>Release-Note:
>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/60600 CVS commit: src/etc/defaults
Date: Sun, 16 Aug 2026 05:25:55 -0400
Module Name: src
Committed By: christos
Date: Sun Aug 16 09:25:55 UTC 2026
Modified Files:
src/etc/defaults: rc.conf
Log Message:
PR/60600: Jason Thorpe: Turn off ldconfig by default; all architectures have
been using ELF for the past 20+ years.
To generate a diff of this commit:
cvs rdiff -u -r1.168 -r1.169 src/etc/defaults/rc.conf
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Wed, 02 Sep 2026 13:49:44 +0000
State-Changed-Why:
applied by christos
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.