Why does the S5 init run "/bin/su" instead of "/bin/sh" single-user?
Guy Harris
guy at rlgvax.UUCP
Fri Jun 22 12:28:13 AEST 1984
Somebody asked me why the System V "init" runs "/bin/su" instead of "/bin/sh"
as the single-user shell, pointing out that running "/bin/su" requires a
valid entry for "root" in "/etc/passwd" while running "/bin/sh" doesn't.
The idea of single-user mode was that providing a usable shell in that mode
should require as few parts of UNIX to be working as possible; obviously,
the root file system must be somewhat usable, and "/etc/init", "/dev/console",
and "/bin/sh" must be usable (and possibly some of the funny links the S5
"init" uses to refer to "/dev/console"), and "/.profile" mustn't have a
problem, but it shouldn't require anything else other than, of course, the
commands you wish to run.
The only reasons I can think of are:
1) They want "su" to log the super-user shell in "/usr/adm/sulog".
2) They want "su", which is run as "su -", to do all the things
that an "su -" does, like a "chdir" to "root"'s home directory
(which is useless unless it isn't "/"), setting the environment
including PATH (which "/etc/init" could do itself), etc..
As far as I'm concerned, none of those reasons override the desire to have
a single-user shell assume that as little of the system works as possible,
so that you can fix it without having to restore the root file system.
You aren't supposed to do much in single-user mode, anyway. A good system
won't even linger in single-user mode when booted; it'll check the file
systems and go right to multi-user mode (or whatever you call "fully up"
mode on a single-user workstation).
Anybody got a good reason which overrides even that desire?
Guy Harris
{seismo,ihnp4,allegra}!rlgvax!guy
More information about the Comp.unix.wizards
mailing list