Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Feb 2015 21:27:33 -0800
From:      perryh@pluto.rain.com (Perry Hutchison)
To:        jilles@stack.nl
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: RFC: make init(8) aware of /rescue/sh
Message-ID:  <54e81745.VJ9sLUeKwo661VPr%perryh@pluto.rain.com>
In-Reply-To: <20150214234943.GB1360@stack.nl>
References:  <54db2f2f.gIXyruGSeJuY3FbJ%perryh@pluto.rain.com> <20150214234943.GB1360@stack.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
Jilles Tjoelker <jilles@stack.nl> 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 :)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?54e81745.VJ9sLUeKwo661VPr%perryh>