NetBSD Problem Report #59573
From www@netbsd.org Mon Aug 4 22:29:29 2025
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 "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 305071A923A
for <gnats-bugs@gnats.NetBSD.org>; Mon, 4 Aug 2025 22:29:29 +0000 (UTC)
Message-Id: <20250804222928.3D0501A923C@mollari.NetBSD.org>
Date: Mon, 4 Aug 2025 22:29:28 +0000 (UTC)
From: sr@genyosha.net
Reply-To: sr@genyosha.net
To: gnats-bugs@NetBSD.org
Subject: 11.0_BETA install leaves behind /etc/rc.conf.bak.* files
X-Send-Pr-Version: www-1.0
>Number: 59573
>Category: install
>Synopsis: 11.0_BETA install leaves behind /etc/rc.conf.bak.* files
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: martin
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Aug 04 22:30:00 +0000 2025
>Last-Modified: Fri Aug 08 14:10:02 +0000 2025
>Originator: Steve Rikli
>Release: 11.0_BETA
>Organization:
>Environment:
NetBSD 11.0_BETA (GENERIC) #0: Fri Aug 1 17:05:55 UTC 2025 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/i386/compile/GENERIC
>Description:
Freshly-installed NetBSD-11 apparently creates /etc/rc.conf.bak.* files but doesn't clean up before exiting sysinst:
vm07# uname -v
NetBSD 11.0_BETA (GENERIC) #0: Fri Aug 1 17:05:55 UTC 2025 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC
vm07# ls -la /etc/rc.conf /etc/rc.conf.bak.*
-rw-r--r-- 1 root wheel 608 Aug 4 21:12 /etc/rc.conf
-rw------- 1 root wheel 0 Aug 4 21:11 /etc/rc.conf.bak.0axBdV
vm08# uname -v
NetBSD 11.0_BETA (GENERIC) #0: Fri Aug 1 17:05:55 UTC 2025 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/i386/compile/GENERIC
vm08# ls -la /etc/rc.conf /etc/rc.conf.bak.*
-rw-r--r-- 1 root wheel 608 Aug 4 20:58 /etc/rc.conf
-rw------- 1 root wheel 0 Aug 4 20:56 /etc/rc.conf.bak.GuyiFF
The amd64 install is from 20250801170555Z
The i386 install is from 20250801170555Z
There's no apparent harm from the .bak file, it's just untidy.
>How-To-Repeat:
Systems were installed by booting netbsd-INSTALL.gz from the same build as noted for the sets, and using sysinst normally.
>Fix:
>Release-Note:
>Audit-Trail:
From: Steve Rikli <sr@genyosha.net>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: install/59573: 11.0_BETA install leaves behind
/etc/rc.conf.bak.* files
Date: Mon, 4 Aug 2025 17:51:23 -0700
Turns out this issue it not specific to 11.0_BETA; I freshly-installed
another VM with 10.1 and also saw an /etc/rc.conf.bak.* file.
I suspect it's related to steps from "Configure additional items" menu,
likely an intermittent failure during "configure the network", like a
temporary inability to get the client hostname from the local DHCP
server, if I select the option to autoconfigure network.
I noticed for that sysinst menu, if the hostname is pre-filled-in
(because it was supplied by DHCP server during autoconfigure), I don't
end up with an rc.conf.bak.* file.
But if I need to manually enter hostname after autoconfigure, presumably
because the installation client didn't get its hostname from DHCP server
for some reason, then the empty rc.conf.bak.* file is left behind.
If this sounds plausible I can try to replicate, e.g. by explicitly not
sending "option host-name" or similar to the DHCP client from the
server.
Whatever the ultimate cause, it seems like sysinst should try to clean
up after itself and remove these temp files at some point before exit.
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: install/59573: 11.0_BETA install leaves behind
/etc/rc.conf.bak.* files
Date: Tue, 5 Aug 2025 11:09:37 +0200
On Tue, Aug 05, 2025 at 01:05:01AM +0000, Steve Rikli via gnats wrote:
> I noticed for that sysinst menu, if the hostname is pre-filled-in
> (because it was supplied by DHCP server during autoconfigure), I don't
> end up with an rc.conf.bak.* file.
Nice catch!
It happens whenever we try to remove "hostname" or "defaultroute" from
/etc/rc.conf and there is no such variable in there (like as you describe
in a setup where DHCP failed and you enter the hostname manually).
I'll fix it.
Martin
Responsible-Changed-From-To: install-manager->martin
Responsible-Changed-By: martin@NetBSD.org
Responsible-Changed-When: Tue, 05 Aug 2025 09:10:34 +0000
Responsible-Changed-Why:
take
From: RVP <rvp@SDF.ORG>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: install/59573: 11.0_BETA install leaves behind /etc/rc.conf.bak.*
files
Date: Tue, 5 Aug 2025 09:37:15 +0000 (UTC)
On Tue, 5 Aug 2025, Steve Rikli via gnats wrote:
> Turns out this issue it not specific to 11.0_BETA; I freshly-installed
> another VM with 10.1 and also saw an /etc/rc.conf.bak.* file.
>
Yeah, this's been around for some time. I made this patch awhile back, then
forgot to file a PR. Please try:
```
diff -urN a/src/usr.sbin/sysinst/util.c b/src/usr.sbin/sysinst/util.c
--- a/src/usr.sbin/sysinst/util.c 2024-04-26 20:45:43.378592951 +0000
+++ b/src/usr.sbin/sysinst/util.c 2025-02-08 22:30:50.857827469 +0000
@@ -2049,12 +2049,11 @@
hit_enter_to_continue(MSG_rcconf_delete_failed,
NULL);
}
- } else {
- (void)unlink(bakname);
}
}
done:
+ (void)unlink(bakname);
(void)unlink(tempname);
free(rcconf);
free(tempname);
```
-RVP
From: "Kimmo Suominen" <kim@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/59573 CVS commit: src/usr.sbin/sysinst
Date: Tue, 5 Aug 2025 14:52:43 +0000
Module Name: src
Committed By: kim
Date: Tue Aug 5 14:52:43 UTC 2025
Modified Files:
src/usr.sbin/sysinst: util.c
Log Message:
Don't leave temporary file behind.
Fixes PR install/59573.
To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/usr.sbin/sysinst/util.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: Steve Rikli <sr@genyosha.net>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: install/59573: 11.0_BETA install leaves behind
/etc/rc.conf.bak.* files
Date: Tue, 5 Aug 2025 08:24:47 -0700
On Tue, Aug 05, 2025 at 09:10:02AM +0000, Martin Husemann via gnats wrote:
> It happens whenever we try to remove "hostname" or "defaultroute" from
> /etc/rc.conf and there is no such variable in there (like as you describe
> in a setup where DHCP failed and you enter the hostname manually).
I can't follow the code but the explanation sounds reasonable.
I do wonder if there is also(?) some underlying issue with dhcpcd.
Experimenting further, I discovered I can replicate the problemm
conditions simply by netbooting netbsd-INSTALL.gz, and autoconfigure
network at some point during sysinst; it doesn't happen if I boot from
local install media e.g. ISO mounted in the VM's virtual CD/DVD drive.
I suspect the cause is sysinst / dhcpcd has trouble when it tries to
configure an already-configured network interface. Something happens
in dhcpcd to prevent receiving(?)/setting the hostname, at least.
An error message goes by during the network autoconfigure step, the
screen clears and refreshes so it's not easy to catch, but it comes
after a message about "sending Router Solicitation", and I was able
to transcribe most of it; I think it's this:
...
wm0: leased 172.16.0.169 for 43200 seconds
wm0: leased 172.16.0.169 for 43200 seconds
wm0: renew in 21600 seconds, rebind in 37800 seconds
wm0: renew in 21600 seconds, rebind in 37800 seconds
wm0: writing lease: /var/db/dhcpcd/wm0.lease
wm0: writing lease: /var/db/dhcpcd/wm0.lease
wm0: IP address 172.16.0.169/24 already exists
wm0: IP address 172.16.0.169/24 already exists
wm0: keeping route to 172.16.0.0/24
wm0: keeping route to 172.16.0.0/24
wm0: adding default route via 172.16.0.1
wm0: adding default route via 172.16.0.1
wm0: executing: /libexec/dhcpcd-run-hooks BOUND
wm0: executing: /libexec/dhcpcd-run-hooks BOUND
wm0: Invalid hostname: vm09.home.genyosha.net
forked to background
forked to background
assertion "ifp != NULL" failed: file "/usr/src/lib/libc/net/getifaddrs.c", line 303 function "_freeifaddrs"
That "invalid hostname" line seems pretty suspicious, even though that's
the hostname being correctly provided by the local ISC DHCP server. I
don't know why most of the messages are repeated.
Re-tried autoconfigure network step after sets are extracted, still no
hostname set, and sysinst briefly shows these messages before the screen
redraws:
sending signal HUP to pid 510
sending signal HUP to pid 510
assertion "ifp != NULL" failed: file "/usr/src/lib/libc/net/getifaddrs.c", line 303 function "_freeifaddrs"
The assertion error looks the same as from the first set of messages.
FYI pid 510 in that case was: dhcpcd: wm0 [ip4] [ip6]
An indicator that something has gone wrong during autoconfigure is the
sysinst prompt to set the hostname is empty -- no pre-filled-in value.
If NetBSD had successfully set the hostname received from DHCP server by
that point, there would be a hostname value in that sysinst prompt.
Is this a separate bug from the rc.conf.bak.* cleanup issue?
I'll also mention that sysinst lets me not enter a hostname (i.e. just
hit [Enter]), which put this setting in rc.conf:
hostname=.home.genyosha.net
sysinst presumably tried to join "" and ".home.genyosha.net" (the
correct DNS Domain there) into a fqdn, getting an invalid result. This
can cause problems e.g. with postfix startup, among other things.
If I reconfigure my DHCP server to not send domain-name or domain-search,
sysinst allows blank Host Name and DNS Domain, resulting in rc.conf with:
hostname=
which is actually better, since dhcpcd presumably handles setting the
hostname at that point.
Is this a different bug too?
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/59573 CVS commit: [netbsd-11] src/usr.sbin/sysinst
Date: Fri, 8 Aug 2025 14:07:45 +0000
Module Name: src
Committed By: martin
Date: Fri Aug 8 14:07:45 UTC 2025
Modified Files:
src/usr.sbin/sysinst [netbsd-11]: util.c
Log Message:
Pull up following revision(s) (requested by kim in ticket #4):
usr.sbin/sysinst/util.c: revision 1.78
Don't leave temporary file behind.
Fixes PR install/59573.
To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.77.4.1 src/usr.sbin/sysinst/util.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/59573 CVS commit: [netbsd-10] src/usr.sbin/sysinst
Date: Fri, 8 Aug 2025 14:08:53 +0000
Module Name: src
Committed By: martin
Date: Fri Aug 8 14:08:53 UTC 2025
Modified Files:
src/usr.sbin/sysinst [netbsd-10]: util.c
Log Message:
Pull up following revision(s) (requested by kim in ticket #1146):
usr.sbin/sysinst/util.c: revision 1.78
Don't leave temporary file behind.
Fixes PR install/59573.
To generate a diff of this commit:
cvs rdiff -u -r1.71.2.2 -r1.71.2.3 src/usr.sbin/sysinst/util.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2025
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.