Single user mode

David B. Thomas dt at yenta.alb.nm.us
Tue May 7 02:09:58 AEST 1991


car at 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.



More information about the Comp.sys.3b1 mailing list