[comp.unix.questions] What is it?

dfs@doe.carleton.ca (David F. Skoll) (04/25/91)

I use a Sun system, and I've never heard of "Run-Level."

What is it?

--
David F. Skoll

weimer@garden.ssd.kodak.com (Gary Weimer (253-7796)) (04/26/91)

In article <dfs.672587346@pulaski>, dfs@doe.carleton.ca (David F. Skoll)
writes:
|> I use a Sun system, and I've never heard of "Run-Level."
|> 
|> What is it?

A brief description (since I've only had brief exposure to it...)

BSD Unix (?) has three "run levels": Single-user, Multi-user and Halt.
Usually we say the system is: 
     in Single-user mode
     in Multi-user mode
     Down ( 1/2 :-) )

System V (?) Unix has many levels:
     0 == Halt
     3 == normal Multi-user mode
     others (this is were it gets brief :-) )

weimer@ssd.kodak.com ( Gary Weimer )

prl@iis.ethz.ch (Peter Lamb) (04/26/91)

dfs@doe.carleton.ca (David F. Skoll) writes:

>I use a Sun system, and I've never heard of "Run-Level."

>What is it?

Since I looked it up, it seems that it's a SysV term describing the current
state of init.

I've been told that BSD-derived Unixes don't have this, but they do
have two (major) states in init, which exactly correspond to two of the
SysV run levels.

If I move into pedantic mode, Sun (and other BSD-ish) Unices do have a run
level, and the two run levels are single-user and multiuser mode.

And there is not an easy way to discover which mode you are in.


--
Peter Lamb
uucp:  uunet!mcsun!ethz!prl	eunet: prl@iis.ethz.ch	Tel:   +411 256 5241
Integrated Systems Laboratory
ETH-Zentrum, 8092 Zurich

dkeisen@leland.Stanford.EDU (Dave Eisen) (04/26/91)

In article <prl.672602340@iis> prl@iis.ethz.ch (Peter Lamb) writes:
>If I move into pedantic mode, Sun (and other BSD-ish) Unices do have a run
>level, and the two run levels are single-user and multiuser mode.
>
>And there is not an easy way to discover which mode you are in.
>

I don't know about BSD, but on our Xenix box "who am i" is an easy
way to see whether the system is single-user.







-- 
Dave Eisen                           dkeisen@leland.Stanford.EDU
1101 San Antonio Raod, Suite 102     (Gang-of-Four is being taken off the net)
Mountain View, CA 94043
(415) 967-5644

jeffl@NCoast.ORG (Jeff Leyser) (04/27/91)

In post <1991Apr25.171617.13505@ssd.kodak.com>, weimer@ssd.kodak.com says:
!!
!!In article <dfs.672587346@pulaski>, dfs@doe.carleton.ca (David F. Skoll)
!!writes:
!!|> I use a Sun system, and I've never heard of "Run-Level."
!!|> 
!!|> What is it?
!!
!!A brief description (since I've only had brief exposure to it...)
I deal with it daily.
!!
!!BSD Unix (?) has three "run levels": Single-user, Multi-user and Halt.
!!Usually we say the system is: 
!!     in Single-user mode
!!     in Multi-user mode
!!     Down ( 1/2 :-) )
!!
!!System V (?) Unix has many levels:
!!     0 == Halt
!!     3 == normal Multi-user mode
!!     others (this is were it gets brief :-) )

Well, sorta.  In SysV, init has 11 levels, numbered 0-6,a,b,c,S.  Each
line in the /etc/inittab file has a corresponding set of identifiers,
e.g:
s2:23:wait:/etc/rc2 >/dev/console 2>&1 </dev/console
   ^^
   run-levels

What each run-level "means" is somewhat vendor-specific (at least in SysVr3).
On our Motorola boxes, 0 and 6 are shutdown, 1 and S are single users, 2 is
multi-user, 3 is multi-user + RFS, and the rest are user defined.  On
out NCR iron, 0 and S are single-user, 1 is multi-user, 2 is multi-user
+ RFS, 6 is shutdown, and the rest are user defined.  Yes, I have often
shutdown the Motorola when trying to go single-user, and I have also
powered-down NCR boxes when they were only single-user, and hadn't been
sync'ed :^)
-- 
Jeff Leyser                                     jeffl@NCoast.ORG

news@rushpc (News Administrator) (04/27/91)

>|> What is it?
>
>A brief description (since I've only had brief exposure to it...)
>
>System V (?) Unix has many levels:
>     0 == Halt
>     3 == normal Multi-user mode
>     others (this is were it gets brief :-) )
>
>weimer@ssd.kodak.com ( Gary Weimer )

Correction.  In System V Release 3.2:

	0 == Halt
	1 == Single user mode.  Can be entered only from the console.
        2 == Normal multi-user mode.
        3 == Multi-user remote-file-sharing mode.
        4 == User definable multi-user mode.
        5 == Stop UNIX and enter firmware mode.
        6 == Stop UNIX and reboot to the state defined in '/etc/inittab'.
        S == Single user mode.  Terminal that executed this command
             becomes the console.

-- 

John
----
Westminster Colorado
...uunet!rushpc!jjr

mike@bria.UUCP (Michael Stefanik) (04/28/91)

In an article, dkeisen@leland.Stanford.EDU (Dave Eisen) writes:
>I don't know about BSD, but on our Xenix box "who am i" is an easy
>way to see whether the system is single-user.

The drag about XENIX is that there is the capability for who -r and
other such command to work correctly.  Too bad that the init under XENIX
is too brain dead to add those entries to /etc/utmp when it fires up.
Of course, an init that truly knows nothing about /etc/inittab should
be pitched out the door anyway ...

-- 
Michael Stefanik, MGI Inc, Los Angeles | Opinions stated are never realistic
Title of the week: Systems Engineer    | UUCP: ...!uunet!bria!mike
-------------------------------------------------------------------------------
If MS-DOS didn't exist, who would UNIX programmers have to make fun of?

wes@harem.clydeunix.com (Wes Peters) (05/02/91)

In article <1991Apr25.171617.13505@ssd.kodak.com>, weimer@garden.ssd.kodak.com (Gary Weimer (253-7796)) writes:
> BSD Unix (?) has three "run levels": Single-user, Multi-user and Halt.
> Usually we say the system is: 
>      in Single-user mode
>      in Multi-user mode
>      Down ( 1/2 :-) )

       ^^^^^ Note that this is the natural state of all computers.  :-)

> System V (?) Unix has many levels:
>      0 == Halt
>      3 == normal Multi-user mode
>      others (this is were it gets brief :-) )

Not quite.  Actually:
	0 = Shutdown
	1 = Single-user (roughly)
	2 = Normal multi-user
	3 = Another multi-user
	4 = ?????
	5 = Enter monitor program, if present
	6 = Halt

Init state 3 is used to run multi-user, but is differentiated from 2 because
all the startup files can check to see what state you're in.  For instance,
you might define 2 to mean 'multiuser with network running' and 3 to mean
'multiuser with network shut off' or something similar.  Getty, which starts
the login process on terminals amongst other things, can tell what init
state you're in also.

Init state 5 goes into the setup program on my brother's 386, as close as
you can get to a 'monitor' program.  I don't have my System V manuals at
hand, or I'd be able to flush this out a little more for you.

	Wes Peters
-- 
#include <std/disclaimer.h>                               The worst day sailing
My opinions, your screen.                                   is much better than
Raxco had nothing to do with this!                        the best day at work.
     Wes Peters:  wes@harem.clydeunix.com   ...!sun!unislc!harem!wes

alan@ukpoit.co.uk (Alan Barclay) (05/03/91)

In article <1991Apr25.171617.13505@ssd.kodak.com> weimer@ssd.kodak.com writes:
>
>System V (?) Unix has many levels:
>     0 == Halt
>     3 == normal Multi-user mode
>     others (this is were it gets brief :-) )

As with most unix things it really depends on how you've configured it
but normally.

0 == Single user
1 == Multi user (no networking)
3 == Multi user (with networking)
6 == Shutdown

2,4,5 are left to be user defined.

-- 
  Alan Barclay
  iT                                |        E-mail : alan@ukpoit.uucp
  Barker Lane                       |        BANG-STYLE : .....!ukc!ukpoit!alan
  CHESTERFIELD S40 1DY              |        VOICE : +44 246 214241

rcd@ico.isc.com (Dick Dunn) (05/04/91)

alan@ukpoit.co.uk (Alan Barclay) writes about run levels:

> As with most unix things it really depends on how you've configured it

Yes, but there's a strong enough set of conventions in SysVland that it
would be foolish to scramble them around--all you'll do is confuse people.

Alan lists a set of run-level assignments I've never seen before, without
saying what version of UNIX uses them.  It's certainly not SysV...which
confuses the issue since one of the newsgroups in the list is a SysV
group.

> 0 == Single user
More conventionally, 0 is shutdown.

> 1 == Multi user (no networking)
If 0 is used for shutdown, 1 is normally single-user, and 2 is multi-user
with no networking; then
> 3 == Multi user (with networking)
as Alan says.

> 6 == Shutdown
More conventionally, 6 is shutdown and reboot.
-- 
Dick Dunn     rcd@ico.isc.com -or- ico!rcd       Boulder, CO   (303)449-2870
   ...If you plant ice, you're gonna harvest wind.

peter@ficc.ferranti.com (Peter da Silva) (05/04/91)

In article <1991May3.080600.6156@ukpoit.co.uk> alan@ukpoit.co.uk (Alan Barclay) writes:
> 0 == Single user
> 1 == Multi user (no networking)
> 3 == Multi user (with networking)
> 6 == Shutdown

Normally, on System V/386:

	0 == shutdown
	1 == single user
	2 == multi user
	3 == networking

I've used another System V system, but it had 0 == single user, 2 == multi
user, and I added 3 == networking when I installed the network software.
It didn't have a shutdown mode, per se, so long as power was up.
-- 
Peter da Silva.  `-_-'  peter@ferranti.com
+1 713 274 5180.  'U`  "Have you hugged your wolf today?"

lothar@tmcsys.UUCP (L. Hirschbiegel) (05/04/91)

In article <1991May3.185400.4685@ico.isc.com> rcd@ico.isc.com (Dick Dunn) writes:
>alan@ukpoit.co.uk (Alan Barclay) writes about run levels:
>
>> As with most unix things it really depends on how you've configured it
>
   [ text deleted ]
>
>> 0 == Single user
>More conventionally, 0 is shutdown.
>
>> 1 == Multi user (no networking)
>If 0 is used for shutdown, 1 is normally single-user, and 2 is multi-user
>with no networking; then
>> 3 == Multi user (with networking)
>as Alan says.
>
>> 6 == Shutdown
>More conventionally, 6 is shutdown and reboot.
>-- 
>Dick Dunn     rcd@ico.isc.com -or- ico!rcd       Boulder, CO   (303)449-2870
>   ...If you plant ice, you're gonna harvest wind.


Its even more complicated under SystemV. From my manual pages for "init":

SYNOPSIS
			   /etc/init [0123456SsQqabc]

There are also pseudostates a, b and c, which may be defined to run certain
commands, but which do not cause the current runlevel to change.
Sounds like an indexed runlevel to me :-) [ init 3.a ...]
In addition there is a substantial diffence under SysV for runlevel 1 and
runlevel S (both switch to single user state). Runlevel 1 can only be called
from the system console (/dev/console, that is) and unmounts all filesystems
except root.
Runlevel S will keep all mounted filesystems and can be (in theory) called
from any terminal. This terminal will then become the new system console.
The biggest difference between runlevel 1 and S: in level 1 all processes
not associated to the (real) system console will be killed, in level S
only processes spawned by "init" are killed...

Lothar Hirschbiegel

-- 
---------------------------------------------------
| L. Hirschbiegel, AEG - A84, Frankfurt (Germany) |
| email: unido!aega84!lh     tel: -49-69-66414316 | 
---------------------------------------------------

allbery@NCoast.ORG (Brandon S. Allbery KB8JRR/AA) (05/05/91)

As quoted from <230@harem.clydeunix.com> by wes@harem.clydeunix.com (Wes Peters):
+---------------
| Not quite.  Actually:
| 	0 = Shutdown
| 	1 = Single-user (roughly)
| 	2 = Normal multi-user
| 	3 = Another multi-user
| 	4 = ?????
| 	5 = Enter monitor program, if present
| 	6 = Halt
+---------------

S is singleuser, 2 is multiuser without networking, 3 is multiuser with
networking, 4 is unused.  5 may or may not be used, depending on Unix version.

On the systems I have seen (Altos System V R3.1 and SCO UNIX) init 1 prepares
the system for singleuser and does an "init S", and init 0 prepares the system
for shutdown and does an "init 6" (which does "/etc/haltsys").

++Brandon
-- 
Me: Brandon S. Allbery			  Ham: KB8JRR/AA  10m,6m,2m,220,440,1.2
Internet: allbery@NCoast.ORG		       (restricted HF at present)
Delphi: ALLBERY				 AMPR: kb8jrr.AmPR.ORG [44.70.4.88]
uunet!usenet.ins.cwru.edu!ncoast!allbery       KB8JRR @ WA8BXN.OH

dag@fciva.FRANKCAP.COM (Daniel A. Graifer) (05/05/91)

On our Prime EXL's,  which run pretty much Plain Vanilla AT&T SysV 3.1 with
some 3.2 extensions, we have:

	0 - Shutdown System
	1 - Single User Mode
	2 - Normal Multi-User
	3 - Multiuser + remote file sharing
	4 - Undefined by system
	5 - Shutdown and entire ROM diagnostic monitor
	6 - Shutdown and reboot

We've defined to state 4 to be system backup.  A cron job in the wee dawn
hours does a telinit 4 to start the backup process.  We also cleanup the
cron log at that time, since cron isn't running in state 4.

We had to modify some of the scripts in rc2.d:  who -r also contains the
previous run level as well as the current one.  Some of the scripts do
nothing if the previous state isn't 0, eg. RMTMPFILES, and we wanted these
to run coming out of state 4 as well.  (With the backup automated, we've
gone for months without rebooting, so lots of things such as tmp directories
would fill up if we didn't clean them out as part of the nightly backup.)

Dan
-- 
Daniel A. Graifer			Coastal Capital Funding Corp.
Sr. Vice President, Financial Systems	7900 Westpark Dr. Suite A-130
(703)821-3244				McLean, VA  22102
uunet!fciva!dag				fciva.FRANKCAP.COM!dag@uunet.uu.net

yee@aix01.aix.rpi.edu (Crimson Avenger) (05/06/91)

In the AT&T System 5, Release 4 book (Complete Reference by Obsorn McGraw-Hill)
I think you mean system initialization state levels:

State		Function 
0		Power off 
1		Single User mode
2		Multi-user mode
3		Multi-user with network
4		Not used
5		Shutdown to ROM
6		Shutdown and Reboot
s		Single-user mode
S		Single-user with remote console

With these definitions, I don't think some of them apply to PCs, I have a 
PC, but don't have unix up and running yet.  I think a couple of those 
don't apply to the PC, like Power off, or Shutdown to ROM.  I think in some
machine, you can literally power off the computer via a software command.  
Not on PCs yet.

Hope this helps, not sure.  .  

-- 
-- Robert aka Crimson Avenger      (yee@rpi.edu or crimson_avenger@mts.rpi.edu)
   Once a hacker, always a hacker. (usere3jp@rpitsmts.bitnet)

dcon@cbnewsc.att.com (david.r.connet) (05/10/91)

In article <602@fciva.FRANKCAP.COM> dag@fciva.UUCP (Daniel A. Graifer) writes:
>
>On our Prime EXL's,  which run pretty much Plain Vanilla AT&T SysV 3.1 with
>some 3.2 extensions, we have:
>
>	0 - Shutdown System
>	1 - Single User Mode
>	2 - Normal Multi-User
>	3 - Multiuser + remote file sharing
>	4 - Undefined by system
>	5 - Shutdown and entire ROM diagnostic monitor
>	6 - Shutdown and reboot
>
>We've defined to state 4 to be system backup.  A cron job in the wee dawn
>hours does a telinit 4 to start the backup process.  We also cleanup the
>cron log at that time, since cron isn't running in state 4.
>

From the AT&T SVR4 init(1M) man page

0   shut the machine down so it is safe to remove the power.  Have the
    machine remove power if it can.

1   put the system in system administrator mode. All file systems are
    mounted.  Only a small set of essential kernel processes are left
    running.  This mode is for administrative tasks such as installing
    optional utility packages. All files are accessible and no users
    are logged in on the system.
       
2   put the system in multi-user mode.  All multi-user environment
    terminal processes and daemons are spawned.  This state is commonly
    referred to as the multi-user state.
      
3   start the remote file sharing processes and daemons.  Mount and
    advertise remote resources.  Run level 3 extends multi-user mode
    and is known as the remote-file-sharing state.
       
4   is available to be defined as an alternative multi-user environment
    configuration. It is not necessary for system operation and is
    usually not used.
          
5   Stop the UNIX system and go to the firmware monitor.
       
6   Stop the UNIX system and reboot to the state defined by the
    initdefault entry in /sbin/inittab.

S,s enter single-user mode.  When this occurs, the terminal which
    executed this command becomes the system console.  This is the
    only run level that doesn't require the existence of a properly
    formatted /sbin/inittab file.  If this file does not exist, then
    by default the only legal run level that init can enter is the
    single-user mode. When the system comes up to S or s, file systems
    for users' files are not mounted and only essential kernel processes
    are running.  When the system comes down to S or s, all mounted
    file systems remain mounted, and all processes started by init that
    should only be running in multi-user mode are killed.  In addition,
    any process that has a utmp entry will be killed.  This last
    condition insures that all port monitors started by the SAC are
    killed and all services started by these port monitors, including
    ttymon login services, are killed. Other processes not started
    directly by init will remain running.  For example, cron remains running.

If a 0 through 6 is entered, init enters the corresponding run level.
Run levels 0, 5, and 6 are reserved states for shutting the system
down.  Run levels 2, 3, and 4 are available as multi-user operating states.


Dave Connet
dcon@iwtng.att.com