RFC: make init(8) aware of /rescue/sh
Perry Hutchison
perryh at pluto.rain.com
Sat Feb 21 05:48:48 UTC 2015
Jilles Tjoelker <jilles at 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 :)
More information about the freebsd-hackers
mailing list