Subject: Re: how to get to single-user mode?
To: James Wetterau <jwjr@name.net>
From: Frederick Bruckman <fb@enteract.com>
List: netbsd-help
Date: 11/23/1998 13:57:35
On Mon, 23 Nov 1998, James Wetterau wrote:

> I was unable to find out how to bring a running system down to single
> user mode cleanly in the man pages or FAQ's, other than the suggestion
> that I:
> 
> kill -s TERM 1
> 
> from the init(8) man pages.  

"shutdown now" or "shutdown +1" is the way I usually do it. If things
get out of hand, you could also drop into the debugger and

db> kill 1
db> c

> I tried this last night after patching my kernel and it didn't seem to
> work.  The system simply stopped responding to the keyboard entirely.

Sound likes that simply killed "init" without propagating the signal.
Also, the NetBSD kernel is loaded completely into memory. The /netbsd
file is only used, AFAIK, for a handful of utilities. This has two
consequences: 1) There is no instability introduced by replacing the
kernel file--the only consequence is usually that "dmesg" won't work
without the -N switch (to the old kernel). 2) You have to reboot
completely to actually _use_ the new kernel.

> I waited for about 45 seconds and then reset my machine.  It rebooted
> quickly and the new kernel came up without any problems, except that
> fsck fixed up some trouble in the superblocks.  This happened of
> course because I was planning to fsck from single user mode,

You want to come up in single-user mode. In that case, NetBSD mounts
only the root file-system, and that as read only, so that it's safe to
run fsck on all partitions. The exact way to do this is port
specific--see your port docs, or boot(8).

> So, I'm wondering, what's the right way, if there is one, to take the
> machine down to single-user mode?  Also, if the man pages are
> incorrect, whom do I report that to to get them fixed?  Also, is my
> system buggy if kill -s TERM init doesn't work?  Finally, could this
> be a byproduct of having replaced /netbsd with the new /netbsd before
> the kill?  Going down to single user mode after replacing the old
> kernel with the new one is the recommended procedure for BSD system in
> the SA Handbook, but possibly that information is inaccurate for
> NetBSD?

I hope that answers most of your questions. Myself, I don't see why
you wouldn't want to use "shutdown". You may wish to make a doc change
request for the init man page; see send-pr(1).