From nobody@FreeBSD.org Fri Aug 23 09:48:37 2002 Return-Path: Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8DAF337B400 for ; Fri, 23 Aug 2002 09:48:37 -0700 (PDT) Received: from www.freebsd.org (www.FreeBSD.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id 506E243E65 for ; Fri, 23 Aug 2002 09:48:37 -0700 (PDT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.12.4/8.12.4) with ESMTP id g7NGmaOT028755 for ; Fri, 23 Aug 2002 09:48:36 -0700 (PDT) (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.12.4/8.12.4/Submit) id g7NGmaxG028754; Fri, 23 Aug 2002 09:48:36 -0700 (PDT) Message-Id: <200208231648.g7NGmaxG028754@www.freebsd.org> Date: Fri, 23 Aug 2002 09:48:36 -0700 (PDT) From: Hal Burch To: freebsd-gnats-submit@FreeBSD.org Subject: sysinstall sorts /etc/rc.conf during netboot X-Send-Pr-Version: www-1.0 >Number: 41949 >Category: bin >Synopsis: sysinstall(8): sysinstall sorts /etc/rc.conf during netboot >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-sysinstall >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Aug 23 09:50:04 PDT 2002 >Closed-Date: >Last-Modified: Tue Jul 13 13:48:57 UTC 2010 >Originator: Hal Burch >Release: 4.5-RELEASE-p19 >Organization: Lumeta Corporation >Environment: FreeBSD devscan2.prod.lumeta.com 4.5-RELEASE-p19 FreeBSD 4.5-RELEASE-p19 #0: Mon Aug 19 14:03:25 EDT 2002 root@devscan2.prod.lumeta.com:/usr/src/sys/compile/LDS2_2 i386 >Description: Sysinstall sorts /etc/rc.conf after a netboot. If packages append to the rc.conf, this can cause bad behavior (especially multiline ifs, for example). This sort seems fraught with danger, including putting a "inetd_enable=YES" after a package-added "inetd_enable=NO" (or vice-versa, depending on what you think the behavior "should be"). There are many hacks around it, but I do not like anf of the ones I've heard. You could also use rc.conf.local, which sysinstall does not appear to mess with, but I would prefer to save that for truly "local" configurations to the machine, not things we plan to do on all of our systems. Amusingly, it reorders the comments that sysinstall itself adds to the file. >How-To-Repeat: Create a package that appends multiline ifs to /etc/rc.conf and install a FreeBSD system including it via netboot. >Fix: Delete lines 416-419 of /usr/src/release/sysinstall/config.c that do the sorting. However, this was probably deliberately added for a reason, so does not really address whatever that reason was. It does, however, make tracking changes easier, especially if the "sysinstall generated deltas" was timestamped. Another option is to add "rc.conf.sysinstall" to rc_conf_files in /etc/defaults/rc.conf, listed first, and change where sysinstall does its changes, but then there's another file to worry about and check. >Release-Note: >Audit-Trail: Responsible-Changed-From-To: freebsd-bugs->freebsd-qa Responsible-Changed-By: johan Responsible-Changed-When: Fri Aug 23 12:40:38 PDT 2002 Responsible-Changed-Why: Over to maintainer group. http://www.freebsd.org/cgi/query-pr.cgi?pr=41949 From: Hal Burch To: freebsd-gnats-submit@freebsd.org Cc: Subject: Re: misc/41949: sysinstall sorts /etc/rc.conf during netboot Date: Wed, 10 Sep 2003 16:33:05 -0400 Proposed fix. This patch adds two variables to config: quickInstall (default NO) YES turns off sleep(2) after starting shell on VTY4 and sleep(1) after successful installation of package sortRcConf (default YES) NO turns off the sort of /etc/rc.conf even when running as init. Also fixes parantheses bug in tcpip.c: was doing DITEM_STATUS(foo == DITEM_SUCCESS) instead of DITEM_STATUS(foo) == DITEM_SUCCESS. I did not find any operational difficulties with this. Note that this patch was made before sysinstall was moved to usr.sbin. diff -c /usr/src/release/sysinstall/config.c ./config.c *** /usr/src/release/sysinstall/config.c Mon Sep 30 16:18:47 2002 --- ./config.c Mon Oct 21 23:23:28 2002 *************** *** 415,421 **** fclose(rcSite); /* Tidy up the resulting file if it's late enough in the installation for sort and uniq to be available */ ! if (RunningAsInit && file_readable("/usr/bin/sort") && file_readable("/usr/bin/uniq")) (void)vsystem("sort /etc/rc.conf | uniq > /etc/rc.conf.new && mv /etc/rc.conf.new /etc/rc.conf"); } --- 415,421 ---- fclose(rcSite); /* Tidy up the resulting file if it's late enough in the installation for sort and uniq to be available */ ! if (RunningAsInit && file_readable("/usr/bin/sort") && file_readable("/usr/bin/uniq") && !variable_cmp(VAR_SORT_RCCONF,"NO")) (void)vsystem("sort /etc/rc.conf | uniq > /etc/rc.conf.new && mv /etc/rc.conf.new /etc/rc.conf"); } Common subdirectories: /usr/src/release/sysinstall/help and ./help diff -c /usr/src/release/sysinstall/package.c ./package.c *** /usr/src/release/sysinstall/package.c Mon Oct 21 22:47:14 2002 --- ./package.c Mon Oct 28 17:07:03 2002 *************** *** 239,245 **** /* Now catch any stragglers */ while (wait3(&tot, WNOHANG, NULL) > 0); ! sleep(1); restorescr(w); } } --- 239,246 ---- /* Now catch any stragglers */ while (wait3(&tot, WNOHANG, NULL) > 0); ! if (ret != DITEM_SUCCESS || variable_cmp(VAR_QUICK, "YES") != 0) ! sleep(1); restorescr(w); } } diff -c /usr/src/release/sysinstall/sysinstall.h ./sysinstall.h *** /usr/src/release/sysinstall/sysinstall.h Mon Oct 21 23:10:52 2002 --- ./sysinstall.h Mon Oct 21 23:23:41 2002 *************** *** 166,171 **** --- 166,172 ---- #define VAR_PORTS_PATH "ports" #define VAR_PPP_ENABLE "ppp_enable" #define VAR_PPP_PROFILE "ppp_profile" + #define VAR_QUICK "quickInstall" #define VAR_RELNAME "releaseName" #define VAR_ROOT_SIZE "rootSize" #define VAR_ROUTER "router" *************** *** 173,178 **** --- 174,180 ---- #define VAR_ROUTERFLAGS "router_flags" #define VAR_SERIAL_SPEED "serialSpeed" #define VAR_SLOW_ETHER "slowEthernetCard" + #define VAR_SORT_RCCONF "sortRcConf" #define VAR_SWAP_SIZE "swapSize" #define VAR_TAPE_BLOCKSIZE "tapeBlocksize" #define VAR_TRY_DHCP "tryDHCP" diff -c /usr/src/release/sysinstall/system.c ./system.c *** /usr/src/release/sysinstall/system.c Mon Oct 21 23:10:52 2002 --- ./system.c Mon Oct 28 17:07:23 2002 *************** *** 511,517 **** WINDOW *w = savescr(); msgNotify("Starting an emergency holographic shell on VTY4"); ! sleep(2); restorescr(w); } else { --- 511,517 ---- WINDOW *w = savescr(); msgNotify("Starting an emergency holographic shell on VTY4"); ! if (variable_cmp(VAR_QUICK,"YES") != 0) sleep(2); restorescr(w); } else { diff -c /usr/src/release/sysinstall/tcpip.c ./tcpip.c *** /usr/src/release/sysinstall/tcpip.c Mon Oct 21 23:10:52 2002 --- ./tcpip.c Mon Oct 21 23:32:01 2002 *************** *** 649,662 **** return devs[0]; } if (cnt == 1) { ! if (DITEM_STATUS(tcpOpenDialog(devs[0]) == DITEM_SUCCESS)) rval = devs[0]; } else if (variable_get(VAR_NONINTERACTIVE) && variable_get(VAR_NETWORK_DEVICE)) { devs = deviceFind(variable_get(VAR_NETWORK_DEVICE), DEVICE_TYPE_NETWORK); cnt = deviceCount(devs); if (cnt) { ! if (DITEM_STATUS(tcpOpenDialog(devs[0]) == DITEM_SUCCESS)) rval = devs[0]; } } --- 649,662 ---- return devs[0]; } if (cnt == 1) { ! if (DITEM_STATUS(tcpOpenDialog(devs[0])) == DITEM_SUCCESS) rval = devs[0]; } else if (variable_get(VAR_NONINTERACTIVE) && variable_get(VAR_NETWORK_DEVICE)) { devs = deviceFind(variable_get(VAR_NETWORK_DEVICE), DEVICE_TYPE_NETWORK); cnt = deviceCount(devs); if (cnt) { ! if (DITEM_STATUS(tcpOpenDialog(devs[0])) == DITEM_SUCCESS) rval = devs[0]; } } Responsible-Changed-From-To: freebsd-bugs->freebsd-sysinstall Responsible-Changed-By: gavin Responsible-Changed-When: Tue Jul 13 13:48:57 UTC 2010 Responsible-Changed-Why: Over to maintainer(s) http://www.freebsd.org/cgi/query-pr.cgi?pr=41949 >Unformatted: