From owner-freebsd-hackers@FreeBSD.ORG Sat Feb 21 05:48:48 2015 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 33D9DDB8 for ; Sat, 21 Feb 2015 05:48:48 +0000 (UTC) Received: from agora.rdrop.com (agora.rdrop.com [IPv6:2607:f678:1010::34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1188E682 for ; Sat, 21 Feb 2015 05:48:47 +0000 (UTC) Received: from agora.rdrop.com (66@localhost [127.0.0.1]) by agora.rdrop.com (8.13.1/8.12.7) with ESMTP id t1L5mZMW049851 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 20 Feb 2015 21:48:36 -0800 (PST) (envelope-from perryh@pluto.rain.com) Received: (from uucp@localhost) by agora.rdrop.com (8.13.1/8.14.2/Submit) with UUCP id t1L5mYw7049850; Fri, 20 Feb 2015 21:48:34 -0800 (PST) (envelope-from perryh@pluto.rain.com) Received: from fbsd81 by pluto.rain.com (4.1/SMI-4.1-pluto-M2060407) id AA25894; Fri, 20 Feb 15 21:27:33 PST Date: Fri, 20 Feb 2015 21:27:33 -0800 From: perryh@pluto.rain.com (Perry Hutchison) To: jilles@stack.nl Subject: Re: RFC: make init(8) aware of /rescue/sh Message-Id: <54e81745.VJ9sLUeKwo661VPr%perryh@pluto.rain.com> References: <54db2f2f.gIXyruGSeJuY3FbJ%perryh@pluto.rain.com> <20150214234943.GB1360@stack.nl> In-Reply-To: <20150214234943.GB1360@stack.nl> User-Agent: nail 11.25 7/29/05 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Feb 2015 05:48:48 -0000 Jilles Tjoelker wrote: > On Wed, Feb 11, 2015 at 02:30:07AM -0800, Perry Hutchison wrote: > > Seems to me it might be desirable for init(8) to fall back > > to /rescue/sh for single-user mode if neither the default > > (kenv:init_shell) nor /bin/sh is usable. Thoughts? [patch snipped] > It is already possible to type "/rescue/sh" at the prompt > (the Makefile always compiles with -DDEBUGSHELL). Of course, provided one remembers that /rescue/sh exists :) I use /rescue so rarely that I did not remember its existence when this situation arose a little over a week ago. (I did, however, remember that I have an emergency shell in /sbin; worst case I would have booted off the distribution flash drive, which I keep handy in case of boot troubles.) Part of the reason for adding an automatic fallback to /rescue/sh is to jog the admin's memory, in case something is messed up badly enough that other parts of /rescue might also be needed. > This must be done manually but also covers the case where > /bin/sh exists but rtld or shared libraries are missing or > broken. That case is already covered, indeed it is exactly what led to the incident mentioned above. (/bin/sh was fine, but one of its shared libs was missing.) > I'm not really sure this is worth the extra code. If we follow that line of reasoning to its logical conclusion, we should also remove the automatic fallback to _PATH_BSHELL. After all, if the system fails to boot because kenv:init_shell is set to something broken, one can always enter /bin/sh manually. BTW the amount of "extra code" is trifling compared to the overall size of init :)