From anders@totem.fix.no  Sun Nov  2 16:21:31 2003
Return-Path: <anders@totem.fix.no>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP
	id 5442716A4CE; Sun,  2 Nov 2003 16:21:31 -0800 (PST)
Received: from totem.fix.no (totem.fix.no [80.91.36.20])
	by mx1.FreeBSD.org (Postfix) with ESMTP
	id 53F1B43FD7; Sun,  2 Nov 2003 16:21:30 -0800 (PST)
	(envelope-from anders@totem.fix.no)
Received: from localhost (totem.fix.no [80.91.36.20])
	by totem.fix.no (Postfix) with ESMTP
	id 2F57F9851C; Mon,  3 Nov 2003 01:21:38 +0100 (CET)
Received: from totem.fix.no ([80.91.36.20])
 by localhost (totem.fix.no [80.91.36.20]) (amavisd-new, port 10024) with LMTP
 id 28393-04-2; Mon,  3 Nov 2003 01:21:37 +0100 (CET)
Received: by totem.fix.no (Postfix, from userid 1000)
	id 7AA6B98465; Mon,  3 Nov 2003 01:21:37 +0100 (CET)
Message-Id: <20031103002137.7AA6B98465@totem.fix.no>
Date: Mon,  3 Nov 2003 01:21:37 +0100 (CET)
From: Anders Nordby <anders@FreeBSD.org>
Reply-To: Anders Nordby <anders@FreeBSD.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc: trhodes@FreeBSD.org, simon@FreeBSD.org, re@FreeBSD.org,
	rwatson@FreeBSD.org, anders@FreeBSD.org, alfred@FreeBSD.org
Subject: Recent sysinstall changes wipes out rc.conf contents
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         58850
>Category:       bin
>Synopsis:       Recent sysinstall changes wipes out rc.conf contents
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    trhodes
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Nov 02 16:30:18 PST 2003
>Closed-Date:    Wed Jun 09 14:45:32 GMT 2004
>Last-Modified:  Wed Jun 09 14:45:32 GMT 2004
>Originator:     anders@FreeBSD.org
>Release:        FreeBSD 4.9-RELEASE
>Organization:
Fluxpod Information eXchange
>Environment:

FreeBSD neta 4.9-RELEASE FreeBSD 4.9-RELEASE #0: Mon Oct 27 17:51:09 GMT 2003     root@freebsd-stable.sentex.ca:/usr/obj/usr/src/sys/GENERIC  i386

FreeBSD neta 5.1-RELEASE FreeBSD 5.1-RELEASE #0: Thu Jun  5 02:55:42 GMT 2003     root@wv1u.btc.adaptec.com:/usr/obj/usr/src/sys/GENERIC  i386

>Description:

Recent changes to sysinstall/config.c empties rc.conf in automated
installations.

>How-To-Repeat:

Set up a PXE automated install environment according to
http://www.freebsd.org/doc/en_US.ISO8859-1/articles/pxe/. Create a custom
package that adds data to /etc/rc.conf during installation using pkg-install.
Watch how rc.conf is emptied on install clients after throdes' changes to
config.c:

root@neta:~# cat /etc/rc.conf

# -- sysinstall generated deltas -- # Mon Nov  3 07:09:40 2003
# Created: Mon Nov  3 07:09:40 2003
# Enable network daemons for user convenience.
# Please make all changes to this file, not to /etc/defaults/rc.conf.
# This file now contains just the overrides from /etc/defaults/rc.conf.
hostname="booter"
ifconfig_fxp0="DHCP"
root@neta:~# 

Proof of concept: make that custom package add data to a temporary rc.conf file
instead, and of course, it is not emptied.

>Fix:

Re-do patch 1.156.2.34 -> 1.156.2.35 in src/release/sysinstall/config.c
(RELENG_4) and 1.210 -> 1.211 in src/usr.sbin/sysinstall/config.c (HEAD).

Work-around for your custom PXE post-installation fixup/rc.conf modification
package:

a) Create a temporary rc.conf script.
b) Create a /usr/local/etc/rc.d script that adds the contents of your temporary
rc.conf to the real one upon the next reboot, deletes itself and then does
another reboot.
>Release-Note:
>Audit-Trail:

From: "Simon L. Nielsen" <simon@FreeBSD.org>
To: Anders Nordby <anders@FreeBSD.org>
Cc: FreeBSD-gnats-submit@FreeBSD.org, trhodes@FreeBSD.org,
	rwatson@FreeBSD.org, re@FreeBSD.org, alfred@FreeBSD.org
Subject: Re: bin/58850: Recent sysinstall changes wipes out rc.conf contents
Date: Tue, 4 Nov 2003 00:19:42 +0100

 --pAwQNkOnpTn9IO2O
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable
 
 On 2003.11.03 01:21:37 +0100, Anders Nordby wrote:
 
 > Recent changes to sysinstall/config.c empties rc.conf in automated
 > installations.
 
 I can't really see why this fails, so I will have to set up a test
 environment to reproduce the problem.  I hope to get this done tomorrow.
 
 If anybody else has any ideas as to why this fails, please let me know.
 
 > root@neta:~# cat /etc/rc.conf
 >=20
 > # -- sysinstall generated deltas -- # Mon Nov  3 07:09:40 2003
 > # Created: Mon Nov  3 07:09:40 2003
 > # Enable network daemons for user convenience.
 > # Please make all changes to this file, not to /etc/defaults/rc.conf.
 > # This file now contains just the overrides from /etc/defaults/rc.conf.
 > hostname=3D"booter"
 > ifconfig_fxp0=3D"DHCP"
 > root@neta:~#=20
 
 Are theese all the variables you are expecting to see in rc.conf (minus
 the one from your package of course)?  That is, does sysinstall itself
 set all the rc.conf variables it is supposed to?
 
 Just to be sure:  Your package contain a script like the "post" script
 script from the PXE article, but set the conf variable directly to
 /etc/rc.conf, correct?
 
 --=20
 Simon L. Nielsen
 FreeBSD Documentation Team
 
 --pAwQNkOnpTn9IO2O
 Content-Type: application/pgp-signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.2.3 (FreeBSD)
 
 iD8DBQE/puKMh9pcDSc1mlERArlwAJ9BeTTTyEIFj18VPL2S3hBMZCxFmgCfXl46
 awi/hXt2Q+HilIYMezWZTAE=
 =kTiE
 -----END PGP SIGNATURE-----
 
 --pAwQNkOnpTn9IO2O--

From: "Simon L. Nielsen" <simon@FreeBSD.org>
To: Anders Nordby <anders@FreeBSD.org>
Cc: FreeBSD-gnats-submit@FreeBSD.org, trhodes@FreeBSD.org,
	rwatson@FreeBSD.org, re@FreeBSD.org, alfred@FreeBSD.org
Subject: Re: bin/58850: Recent sysinstall changes wipes out rc.conf contents
Date: Tue, 4 Nov 2003 00:35:34 +0100

 --oj4kGyHlBMXGt3Le
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable
 
 On 2003.11.03 01:21:37 +0100, Anders Nordby wrote:
 >=20
 > >Synopsis:       Recent sysinstall changes wipes out rc.conf contents
 > >Environment:
 >=20
 > FreeBSD neta 4.9-RELEASE FreeBSD 4.9-RELEASE #0: Mon Oct 27 17:51:09 GMT =
 2003     root@freebsd-stable.sentex.ca:/usr/obj/usr/src/sys/GENERIC  i386
 >=20
 > FreeBSD neta 5.1-RELEASE FreeBSD 5.1-RELEASE #0: Thu Jun  5 02:55:42 GMT =
 2003     root@wv1u.btc.adaptec.com:/usr/obj/usr/src/sys/GENERIC  i386
 
 I just noticed... Does this problem also happen on FreeBSD 5.1-RELEASE?
 Because 5.1-R did not contain the MTA selection code (and therefore not
 config.c v. 1.211).
 
 --=20
 Simon L. Nielsen
 FreeBSD Documentation Team
 
 --oj4kGyHlBMXGt3Le
 Content-Type: application/pgp-signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.2.3 (FreeBSD)
 
 iD8DBQE/puZEh9pcDSc1mlERAh+VAJ0fSFxKc3MqFRcQ1hWbpY4+3bEC8QCfVDpP
 hgkjM4GGRShhWA4xfRBUJ4w=
 =S+w+
 -----END PGP SIGNATURE-----
 
 --oj4kGyHlBMXGt3Le--
Responsible-Changed-From-To: freebsd-bugs->trhodes 
Responsible-Changed-By: trhodes 
Responsible-Changed-When: Mon Nov 3 15:47:09 PST 2003 
Responsible-Changed-Why:  
I'm looking into this, assign to me. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=58850 

From: Tom Rhodes <trhodes@FreeBSD.org>
To: "Simon L. Nielsen" <simon@FreeBSD.org>
Cc: Anders Nordby <anders@FreeBSD.org>,
	FreeBSD-gnats-submit@FreeBSD.org, rwatson@FreeBSD.org,
	re@FreeBSD.org, alfred@FreeBSD.org
Subject: Re: bin/58850: Recent sysinstall changes wipes out rc.conf contents
Date: Mon, 3 Nov 2003 18:46:43 -0500

 On Tue, 4 Nov 2003 00:19:42 +0100
 "Simon L. Nielsen" <simon@FreeBSD.org> wrote:
 
 > On 2003.11.03 01:21:37 +0100, Anders Nordby wrote:
 > 
 > > Recent changes to sysinstall/config.c empties rc.conf in automated
 > > installations.
 > 
 > I can't really see why this fails, so I will have to set up a test
 > environment to reproduce the problem.  I hope to get this done tomorrow.
 > 
 > If anybody else has any ideas as to why this fails, please let me know.
 
 My thoughts are that the script may be overwriting rc.conf, but not
 having a copy here doesn't help.
 
 FWIW, I built a handful of make releases while testing this patch
 before the commit.  The sysinstall utility wrote rc.conf exactly
 as expected in my tests.  FYI, I tested a new install each time,
 selecting a different option and rebooted to be sure everything
 worked.
 
 -- 
 Tom Rhodes

From: "Simon L. Nielsen" <simon@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org, anders@FreeBSD.org
Cc:  
Subject: Re: bin/58850: Recent sysinstall changes wipes out rc.conf contents
Date: Fri, 7 Nov 2003 13:26:27 +0100

 --3V7upXqbjpZ4EhLz
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 Hello
 
 If possible, it would be really helpful if people who have this problem
 could try the attached patch for sysinstall, and tell what the content
 of rc.conf afterwards.
 
 The patch should work for both STABLE and CURRENT.
 
 It's also at
 http://simon.nitro.dk/freebsd/files/sysinstall-rcconf-debug.patch .
 
 -- 
 Simon L. Nielsen
 FreeBSD Documentation Team
 No GPG to avoid gnats messing up the attachment
 
 --3V7upXqbjpZ4EhLz
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="sysinstall-rcconf-debug.patch"
 
 Index: config.c
 ===================================================================
 RCS file: /home/ncvs/src/usr.sbin/sysinstall/config.c,v
 retrieving revision 1.216
 diff -u -r1.216 config.c
 --- config.c	28 Sep 2003 05:21:23 -0000	1.216
 +++ config.c	7 Nov 2003 11:55:28 -0000
 @@ -422,6 +422,8 @@
  	while(fgets(line, sizeof(line), rcOld)) {
  	    if(line[0] == '#' || variable_check2(line) != 0)
  		fprintf(rcSite, "%s", line);
 +	    else
 +		fprintf(rcSite, "#REMOVED: %s", line);
  	}
  	fclose(rcOld);
      } else {
 
 --3V7upXqbjpZ4EhLz--
State-Changed-From-To: open->closed 
State-Changed-By: trhodes 
State-Changed-When: Wed Jun 9 14:44:25 GMT 2004 
State-Changed-Why:  
Closed; feedback timeout. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=58850 
>Unformatted:
