[comp.sys.att] UNIXPC operating sans run-level; HOW?

thad@cup.portal.com (Thad P Floryan) (12/15/89)

Anyone ever see UNIX operating withOUT being in a run-level?  Seriously.

Had a major power failure here, and the UPS on two systems pooped-out before
I could get to the systems and perform an orderly shutdown.

Rebooting after power was restored caused the systems to undergo a forced
second reboot each time, and attempts to shutdown afterwards WOULDN'T shutdown
and, instead, left me at a "pseudo" root prompt but still logged-in under the
username I was just-prior logged in as (sic).  Entering a ^D then forced a
prompt for "Enter run level: " (as from ``init''), but things still weren't
right afterwards.

ONLY after about 5 rapid shutdowns and reboots did things appear to return to
normal (and no files lost), but EVERY time before things returned to normal I
noticed the following:

	$ who -r
	$

Yes, that's correct, NO runlevel! The output should have been something like:

	$ who -r
	   .      run-level 2  Dec 12 19:43    2   0   S
	$

which it became (again) after the 5th (or so) reboot.

The OTHER weird occurrence (until the system automagically re-acquired a
run-level), was that logging in via any method (console, RS-232, StarLAN,
on-board modem) would cause the following display (and the parameters, as
displayed, do NOT exist in ANY .profile on the systems or in /etc/profile
or in /etc/localprofile ):

	Welcome to ThadLABS System #2, AT&T UNIX System V, Release 3.51

	Please login: thad
	Password:
	EDITOR=/bin/ed
	FCEDIT=/bin/ed
	HOME=/u/thad
	IFS=    

	LOGNAME=thad
	MAIL=/usr/mail/thad
	MAILCHECK=600
	PATH=:/bin:/usr/bin
	PPID=351
	PS2=> 
	PS3=#? 
	RANDOM=28844
	SECONDS=2
	SHELL=/bin/ksh
	TMOUT=0
	_=3

	Please type the terminal name and press RETURN:  dt80

	           1% of the storage space is available.

	ksh 351/352> 


Except for the "lack" of a runlevel (before the problem cleared up) and the
weird output during login, the systems otherwise "felt" like they were acting
normally except for the troublesome shutdowns and reboots.

Any ideas as to what might have caused this and why several shutdown & reboot
cyles would have cleared up the symptoms?  The systems that experienced these
anomalies were UNIXPCs (aka 7300 aka 3B1) running versions 3.51 and 3.51a of
the SysV kernel (for the UNIXPC).

Thad Floryan [ thad@cup.portal.com (OR) ..!sun!portal!cup.portal.com!thad ]

jr@amanue.UUCP (Jim Rosenberg) (12/18/89)

In article <25060@cup.portal.com> thad@cup.portal.com (Thad P Floryan) writes:
>Anyone ever see UNIX operating withOUT being in a run-level?  Seriously.
>
>ONLY after about 5 rapid shutdowns and reboots did things appear to return to
>normal (and no files lost), but EVERY time before things returned to normal I
>noticed the following:
>
>	$ who -r
>	$
>
>Yes, that's correct, NO runlevel! The output should have been something like:
>
>	$ who -r
>	   .      run-level 2  Dec 12 19:43    2   0   S

I've never had the pleasure of access to source code, so I thereby don't
qualify as a true wizard; count what I'm saying as speculation -- but it may be
right anyway.  :-)

My impression is that who is nothing but a nice front end to show the status of
/etc/utmp, and utmp *CAN* become hosed.  In fact utmp corruption seems to be
one of the major risk factors for power loss without graceful shutdown.  I
would guess that who -r, rather than actually "talking to" init to find out the
run level, is simply reporting from /etc/utmp the utmp entry for run level that
it *EXPECTS* to be there.  The run level is really an internal state of init.
The fact that who -r is not reporting the run level does not really mean you're
running "without" a run level.  It just means that who can't find out what the
run level is.

I believe that communication with init is pretty much one-way:  init receives
information from user processes by signals.  I don't believe there's a way to
establish a channel to init to have it actually tell you what the run level is.
All you can do is hope to pick up the right information on the *LOGGING* of the
run level.  And if your file system is damaged ...
-- 
 Jim Rosenberg
     CIS: 71515,124                         decvax!idis! \
     WELL: jer                                   allegra! ---- pitt!amanue!jr
     BIX: jrosenberg                  uunet!cmcl2!cadre! /

dklann@heurikon.UUCP (David Klann) (12/18/89)

In article <25060@cup.portal.com> thad@cup.portal.com (Thad P Floryan) writes:
>Anyone ever see UNIX operating withOUT being in a run-level?  Seriously.

I have seen this kind of thing before too!  I'm quite sure that the
missing run level means that the /etc/utmp file was messed up.

I have no idea where the display of shell environment is coming from.
Maybe there is something in /bin/ksh or /bin/sh that spits it out for
some reason?!?

David Klann
dklann@heurikon.com

jrw@mtune.ATT.COM (Jim Webb) (12/19/89)

In article <361@heurikon.UUCP>, dklann@heurikon.UUCP (David Klann) writes:
> In article <25060@cup.portal.com> thad@cup.portal.com (Thad P Floryan) writes:
> >Anyone ever see UNIX operating withOUT being in a run-level?  Seriously.
> 
> I have seen this kind of thing before too!  I'm quite sure that the
> missing run level means that the /etc/utmp file was messed up.

Correct.  "who -r" just looks for an entry in /etc/utmp....

> I have no idea where the display of shell environment is coming from.
> Maybe there is something in /bin/ksh or /bin/sh that spits it out for
> some reason?!?

If who -r does not find such an entry, it does not print anything.
So, if somewhere in an rc-type shell script, someone says:

		set `who -r`

the set command will be run WITHOUT any arguments, and will thus
print out the environment instead of setting the positional parameters
to the output of the who -r command.  Saying

		set - `who -r`

will stop the environment from being printed, but won't do much for
the script relying on $7 or whatever for the run-level :-)

-- 
Jim Webb                "Out of Phase -- Get Help"               att!mtune!jrw
#include <std/disclaimer.h>                                  jrw@mtune.att.com

dklann@heurikon.UUCP (David Klann) (12/20/89)

In article <8162@mtune.ATT.COM> jrw@mtune.ATT.COM (Jim Webb) writes:
> [ ... ]
>
>the set command will be run WITHOUT any arguments, and will thus
>print out the environment instead of setting the positional parameters
>to the output of the who -r command.  Saying
>
>		set - `who -r`
>-- 
>Jim Webb                "Out of Phase -- Get Help"               att!mtune!jrw
>#include <std/disclaimer.h>                                  jrw@mtune.att.com

Ahhhhh!  Makes perfect sense now!  Thanks for clearing it up Jim!

David Klann
dklann@heurikon.com