After finishing with rc.sysinit script during the bootloading process, the init command uses the Linux system initialization table found in /etc/inittab to boot Fedora to a specific system state. The state of the system is commonly referred to as its runlevel.

Several different ways of starting and stopping system services exist, and Fedora uses a method derived from System V Unix. The System V (pronounced 'System Five') method uses runlevels and different combinations of services to define different states of operation. Runlevels determine which of the many available system services are started, as well as in which order they start. A special runlevel is used to stop the system, and a special runlevel is used for system maintenance. As you will see, there are other runlevels for special purposes.

NOTE

The System V method makes extensive use of symbolic links, which are ways to reference a file in another location and make it appear as if it were in two or more places at once. The benefit is that you need to edit only one file to change them all. In addition, any reorganization to be done means that only links need to be changed, not the files themselves.

You use runlevels to manage the system services running on your computer. All these special files and scripts are set up during your installation of Fedora Linux, and they receive their initial values based on your choices during the installation — as described in Chapter 1, 'Installing Fedora,' You can change and control them manually, as you learn later in this chapter, using tools of varying sophistication.

Runlevel Definitions

The Fedora runlevels are defined for the Fedora system in /etc/inittab.

NOTE

Not all Linux distributions use the same runlevel configurations or runlevel definitions! For example, although Fedora uses runlevel 3 for a full, console-based multiuser mode, pre-7.1 versions of SUSE Linux defined this system state as runlevel 2. Red Hat, Fedora, and SUSE now use the same runlevels to conform to the Linux Standards Base, or LSB. As a system administrator, you should be aware of this issue, especially if you have devised any administrative scripts or tools that deal with system states.

Each runlevel tells the init command what services to start or stop. Although runlevels might all have custom definitions, Fedora has adopted some standards for runlevels:

Runlevel 0 — Known as 'halt,' this runlevel is used to shut down the system.

Runlevel 1 — This is a special runlevel, defined as 'single,' which boots Fedora to a root access shell prompt where only the root user may log in. Networking, X, and multiuser access are turned off. This is the maintenance or rescue mode. It allows the system administrator to perform work on the system, make backups, or repair configuration or other files.

Runlevel 2 — This runlevel dictates that Fedora be booted to a console, or text-based mode, with multiuser access.

Runlevel 3 — This runlevel is identical to runlevel 2, except that it also starts any networking services.

Runlevel 4 — This runlevel is undefined, and it can readily be configured to boot Fedora to a custom system state.

Runlevel 5 — This runlevel boots Fedora to a networking, multiuser state with an active X session. This is the most common runlevel for home users who want a graphical interface.

Runlevel 6 — This runlevel is used to reboot the system.

Runlevel 1 (also known as single-user mode or maintenance mode) is most commonly used to repair file systems and change the root password on a system when the password has been forgotten. Trespassers with physical access to the machine can also use runlevel 1 to access your system.

CAUTION

Never forget that uncontrolled physical access is virtually a guarantee of access to your data by an intruder.

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

Добавить отзыв
ВСЕ ОТЗЫВЫ О КНИГЕ В ИЗБРАННОЕ

0

Вы можете отметить интересные вам фрагменты текста, которые будут доступны по уникальной ссылке в адресной строке браузера.

Отметить Добавить цитату