From owner-svn-src-all@FreeBSD.ORG Sat Jan 1 00:34:55 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 72C1D1065672; Sat, 1 Jan 2011 00:34:55 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) by mx1.freebsd.org (Postfix) with ESMTP id 0CB688FC25; Sat, 1 Jan 2011 00:34:55 +0000 (UTC) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010::132]) by mx1.stack.nl (Postfix) with ESMTP id 1E30135994D; Sat, 1 Jan 2011 01:34:54 +0100 (CET) Received: by turtle.stack.nl (Postfix, from userid 1677) id 11EED1730D; Sat, 1 Jan 2011 01:34:54 +0100 (CET) Date: Sat, 1 Jan 2011 01:34:54 +0100 From: Jilles Tjoelker To: Erik Trulsson Message-ID: <20110101003453.GA61932@stack.nl> References: <201012301806.oBUI6VcW046731@svn.freebsd.org> <20101231144308.GA55052@stack.nl> <20101231165552.GA24854@owl.midgard.homeip.net> <20101231190058.GA79467@freebsd.org> <20101231223114.GA26424@owl.midgard.homeip.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20101231223114.GA26424@owl.midgard.homeip.net> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, Alexander Best , svn-src-all@freebsd.org, src-committers@freebsd.org, Pawel Jakub Dawidek Subject: Re: svn commit: r216823 - head/sbin/shutdown X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Jan 2011 00:34:55 -0000 On Fri, Dec 31, 2010 at 11:31:14PM +0100, Erik Trulsson wrote: > On Fri, Dec 31, 2010 at 07:00:58PM +0000, Alexander Best wrote: > > another thought: running 'reboot' instead of 'shutdown -r now' *can* cause > > harm to the system, because an important rc.shutdown script wasn't executed. > > however running 'shutdown -r now' in single-user mode e.g. will cause a few > > sterr warnings; however it *cannot* cause any harm. > Oh, yes, it can! (And I have been burnt by it once, after which I got > very careful about not using 'shutdown -r now' from single user mode.) > Take a look at /etc/rc.d/mixer > At shutdown it saves the current state of the soundcard mixer values > into a file and at start it restores the mixer values from that file. > If you boot into single user mode the start function will of course not > be executed leaving the mixer values at their default values. If you > then use 'shutdown' these default values are what will be saved, > overwriting whatever values had been saved before, while if you had > instead had used 'reboot' the old saved values would have been left > untouched. > If you never change the mixer values from their defaukt you won't notice > anything, but otherwise it might take a while to figure out why the > sound is at the 'wrong' volume. > This is one example I have found where bad things can happen if you use > 'shutdown' when you should have used 'reboot'. I am fairly sure that > there are other instances that I just haven't run into (yet.) Yes, but I consider this a bug in either init or the rc system. The problem already exists if shutdown is used from single-user. Ctrl+Alt+Del also signals init, causing proper shutdown from multi-user but mixer value loss from single-user. If it is a bug in init, init should not run rc.shutdown when it has not run any /etc/rc things, in the assumption that rc.shutdown shuts down the things that /etc/rc has started. Furthermore, this seems reasonable because rc.shutdown is also run when the system goes from multi-user to single-user; it seems strange to run it another time when the system goes down from single-user. If it is a bug in /etc/rc.d/mixer, /etc/rc.d/mixer should somehow track if it has been started, and ignore any stops if not. This seems less general than changing init. If it is a bug in /etc/rc, it should do the above tracking somehow for all scripts. -- Jilles Tjoelker