Êíèãà: Fedora™ Unleashed, 2008 edition

Booting into the Default Runlevel

Booting into the Default Runlevel

Entries in /etc/inittab use a field-based notation that determines the runlevel — when to execute the process, whether or not the process is executed when booting, whether or not to wait for the process to complete, and when to execute the process during booting. The default choices are adequate and need be changed only in unique circumstances that the average user is not likely to encounter.

The value of the default entry, or the initdefault line in /etc/inittab, determines the particular system state in which Fedora is when the login prompt is finally presented. For example,

id:5:initdefault:

In this example, Fedora boots to runlevel 5, a network-enabled, multiuser mode with an active X session and a graphical login. The value 5 is forwarded to the script named rc under the /etc/rc.d directory. This script is used when booting or changing runlevels; it also acts as an interpreter when you boot Fedora in "Interactive" mode when you press i during the boot.

After /etc/rc.d/rc.sysinit has finished, init uses the corresponding /etc/inittab entry that matches the designated default runlevel. Using the previous example, the line in /etc/inittab would then be:

l5:5:wait:/etc/rc.d/rc 5

Under the /etc/rc.d directory is a series of directories that correspond to each runlevel:

# ls /etc/rc.d
init.d rc0.d rc2.d rc4.d rc6.d    rc.sysinit
rc     rc1.d rc3.d rc5.d rc.local

Assuming that the value is 5, the rc script executes all the scripts under the /etc/rc.d/rc.5 directory and then launches the graphical login.

If Fedora is booted to runlevel 5, it executes scripts from the /etc/rc.d/rc5.d directory. Scripts beginning with the letter K are executed first, followed by scripts beginning with the letter S:

# ls /etc/rc.d/rc5.d/
K01yum           K20bootparamd K28amd      K45named        K61ldap
K74ypxfrd        S05kudzu      S24pcmcia   S85gpm          K05innd
K20iscsi         K30sendmail   K46radvd    K65identd       K84bgpd
S08ip6tables     S25netfs      S90crond    K05saslauthd    K20netdump-server
K34dhcrelay      K50netdump    K65kadmin   K84ospf6d       S08ipchains
S26apmd          S90FreeWnn    K10psacct   K20nfs          K34yppasswdd
K50snmpd         K65kprop      K84ospfd    S08iptables     S28autofs
S90xfs           K10radiusd    K20rstatd   K35atalk        K50snmptrapd
K65krb524        K84ripd       S10network  S40smartd       S92lisa
K12canna         K20rusersd    K35dhcpd    K50tux          K65krb5kdc
K84ripngd        S12syslog     S44acpid    S95anacron      K12mailman
K20rwalld        K35smb        K50vsftpd   K70aep1000      K85zebra
S13irqbalance    S55cups       S95atd      K12mysqld       K20rwhod
K35vncserver     K54dovecot    K70bcm5820  K90isicom       S13portmap
S55sshd          S97messagebus K15httpd    K20spamassassin K35winbind
K54pxe           K74ntpd       K91isdn     S14nfslock      S56rawdevices
S97rhnsd         K15postgresql K24irda     K40mars-nwe     K55routed
K74ups           K95firstboot  S17keytable S56xinetd       S99local
K16rarpd         K25squid      K45arpwatch K61hpoj         K74ypserv
S00microcode_ctl S20random     S84privoxy  S99mdmonitor

These scripts are actually symbolic links to system service scripts under the /etc/rc.d/init.d directory (yours might look different, depending on whether you are working with a workstation or server installation and the services or software packages installed on your system):

# ls /etc/rc.d/init.d/
acpid        bgpd       firstboot ip6tables      keytable   mars-nwe      nfs
postgresql   ripd       smartd    vncserver      zebra      aep1000       bluetooth
FreeWnn      ipchains   killall   mdmonitor      nfslock    privoxy
ripngd       smb        vsftpd    amd            bootparamd functions     iptables
kprop        messagebus nscd      psacct         routed     snmpd         winbind
anacron      canna      gkrellmd  irda           krb524     microcode_ctl ntpd
pxe          rstatd     snmptrapd xfs            apmd       cpqarrayd     gpm
irqbalance   krb5kdc    mysqld    ospf6d         radiusd    rusersd
spamassassin xinetd     arpwatch  crond          halt       iscsi         kudzu
named        ospfd      radvd     rwalld         squid      ypbind
atalk        cups       hpoj      isdn           ldap       netdump       pand
random       rwhod      sshd      yppasswdd      atd        dhcpd
httpd        isicom     lisa      netdump-server pcmcia     rarpd
saslauthd    syslog     ypserv    autofs         dhcrelay   identd        kadmin
lm_sensors   netfs      portmap   rawdevices     sendmail   tux
ypxfrd       bcm5820    dovecot   innd           kdcrotate  mailman
network      postfix    rhnsd     single         ups        yum

The rc5.d links are prefaced with a letter and number, such as K15 or S10. The (K) or (S) in these prefixes indicates whether a particular service should be killed (K) or started (S), and passes a value of stop or start to the appropriate /etc/rc.d/init.d script. The number in the prefix executes the specific /etc/rc.d/init.d script in a particular order. The symlinks have numbers to delineate the order in which they are started. Nothing is sacred about a specific number, but some services need to be running before others are started. You would not want your Fedora system to attempt, for example, to mount a remote Network File System (NFS) volume without first starting networking and NFS services.

After all the system services are started for your runlevel, init starts the graphical login (because you are in runlevel 5). The graphical login's definition appears toward the end of /etc/inittab and looks like this:

# Run xdm in runlevel 5 x:5:respawn:/etc/X11/prefdm -nodaemon

This example shows that the shell script named prefdm executes the proper X11 display manager when Fedora is booted to runlevel 5.

Îãëàâëåíèå êíèãè


Ãåíåðàöèÿ: 1.195. Çàïðîñîâ Ê ÁÄ/Cache: 3 / 0
ïîäåëèòüñÿ
Ââåðõ Âíèç