[comp.sys.3b1] Single user mode

car@ramecs.UUCP (Chris Rende) (05/04/91)

When I use "/etc/shutdown" I get the message telling me to press RETURN
to reboot. I'd like the system to go into single user mode instead.
(With a shell). Then, "init 2" could be used to start the system back up.

Who/what is detecting the transition into single user mode and displaying
that message? And how can it be changed?

I did a quick scan of wmgr, smgr, ph, init, shutdown, and the kernel and
couldn't find it.

car.
-- 
Christopher A. Rende           Central Cartage (Nixdorf/Pyramid/SysVR2/BSD4.3)
uunet!edsews!rphroy!trux!car   Multics,DTSS,Unix,Shortwave,Scanners,UnixPC/3B1
car@trux.mi.org                Minix 1.2,PC/XT,Mac+,TRS-80 Model I,1802 ELF
trux!ramecs!car     "I don't ever remember forgetting anything." - Chris Rende

john@chance.UUCP (John R. MacMillan) (05/06/91)

|When I use "/etc/shutdown" I get the message telling me to press RETURN
|to reboot. I'd like the system to go into single user mode instead.
|(With a shell). Then, "init 2" could be used to start the system back up.
|
|Who/what is detecting the transition into single user mode and displaying
|that message? And how can it be changed?

That's coming from /etc/profile.  When /etc/shutdown does the "init s",
a shell ends up running that runs /etc/profile.  If the run level is
"S", profile completes the shutdown (in a somewhat half-assed manner,
IMHO; it kills things before running scripts in /etc/shutdaemon that
might have shut them down cleanly).

dt@yenta.alb.nm.us (David B. Thomas) (05/06/91)

car@ramecs.UUCP (Chris Rende) writes:

>When I use "/etc/shutdown" I get the message telling me to press RETURN
>to reboot. I'd like the system to go into single user mode instead.
>(With a shell). Then, "init 2" could be used to start the system back up.

Ooooh ah _hate_ that!  I set up two ways of dealing with that.  #1 -- I
changed /etc/profile so that I get a shell in single user mode, like normal
unix:

# /etc/profile
trap '' 1 2 3

# the following fails if utmp is corrupt.  need to devise a fix.
set `who -r`

# if we've just entered single-user mode, handle it specially
if [ "$3" = "S" ]
then
	echo Entering single-user mode... > /dev/syscon
	/bin/ps -el > /dev/syscon 2>&1
	sync;sync;sync
	/bin/sh < /dev/syscon > /dev/syscon 2>&1
	exit 0
fi
#rest of /etc/profile here.

That way, when entering single user mode, you just get a shell.  You might
have to kill processes by hand before you can reboot safely, though, since
/etc/killall is no longer run.

I use single user mode only for emergencies, or if I'm just about to reboot.
Other than that, I have created an "admin" run level, which does not allow
dial-in users, and which doesn't run cron or other daemons, but which does
allow console and other local logins.

I was going to post my inittab file, but I've done so many nonsklarkish hacks
to it that I really can't post it without posting a bunch of other little
shell scripts and things that work with it.  I'd be happy to post or email
if there is interest.

					little david
				still MGR hacking -- report soon!
-- 
Unix is not your mother.

wwm@wa8tzg.mi.org (Bill Meahan) (05/07/91)

In article <1991May6.160958.21766@yenta.alb.nm.us> dt@yenta.alb.nm.us (David B. Thomas) writes:
>car@ramecs.UUCP (Chris Rende) writes:
>
>

		[...]

>I was going to post my inittab file, but I've done so many nonsklarkish hacks
>to it that I really can't post it without posting a bunch of other little
>shell scripts and things that work with it.  I'd be happy to post or email
>if there is interest.
>
>					little david
>				still MGR hacking -- report soon!
>-- 
>Unix is not your mother.

Sounds good to me!  Post 'em, Dan-o.

-- 
Bill Meahan (WA8TZG)             |   Programming is simple:
wwm@wa8tzg.mi.org  OR            |
uunet!mailrus!sharkey!wa8tzg!wwm |   All you have to do is put the right
"Home for Cybernetic Orphans"    |   numbers in the right memory locations!