3.3 Runlevels Flashcards
Which file affects the default runlevels?
The /etc/inittab file affects the default runlevels.
Why would you set the runlevel to 1?
Runlevel 1 is single-user mode, which is typically used for maintenance or troubleshooting tasks as it limits the daemons started and only allows a single user to login.
What is the difference in functionality between a runlevel 1 and runlevel 3?
- Runlevel 1 is single user mode, in which the system runs only enough daemons to allow a single user to log in. It is typically used for maintenance.
- Runlevel 3 is extended multi-user mode, in which the system provides multi-user mode support in addition to all network services, including Network File System. It is typically used for normal operations.
Which runlevel reboots the system, and which runlevel shuts the system down?
- Runlevel 0 shuts the system down.
- Runlevel 6 reboots the system
What commands can be used to change the runlevel?
The init and telinit commands can be used to change the runlevel.
How can you enter kernel options during the system boot up?
Using the ‘a’ key (to insert new kernel options) or the ‘e’ key (to edit existing kernel options) while in the GRUB boot menu.
How can you identify the current and previous runlevels?
The runlevel command identifies the previous and current runlevels, respectively.
What is a runlevel?
A runlevel is collection of services that defines a specific system state.
Describe the runlevel state 0.
This is the halt state. In runlevel 0, the system has no daemons in memory and is ready to be turned off.
Describe the runlevel state 1.
This is single user mode. In single user mode, the system uses only enough daemons to allow a single user to log in, and is often used for maintenance tasks. The user is automatically logged in as the root user.
Describe the runlevel state 2.
This is multi-user mode. In multi-user mode, the system allows multiple users to log in. It also provides networking services with the exception of the Network File System.
Describe the runlevel state 3.
This is extended multi-user mode. In extended multi-user mode, the system provides multi-user mode support in addition to all network services, including Network File System.
Describe the runlevel state 4.
This runlevel is undefined, but can be defined if necessary.
Describe the runlevel state 5.
This is graphical mode. In graphical mode, the system provides the same capabilities as in extended user mode. However, the system also supports graphical log ins.
Describe the runlevel state 6.
This is the reboot runlevel. In this runlevel, the system re-starts itself.
What does the init daemon do and how does it use /etc/inittab?
During the boot process, the init (initialize) daemon loads all the other daemons that control the system. Init uses the /etc/inittab file to determine the default runlevel, and then starts the appropriate daemons for that runlevel.
What are the four fields in /etc/inittab?
The colon-separated fields in /etc/inittab are:
- label
- runlevel(s)
- action
- command
i. e., label:runlevel(s):action:command
What does the label field of /etc/inittab do?
Organizes the file to allow the init daemon to read it alphabetically.
What does the runlevel(s) field of /etc/inittab do?
Specifies the runlevel(s) to which the line corresponds.
What does the action field of /etc/inittab do?
Tells init what action to take (e.g., respawn, wait, boot, bootwait, powerfail, powerwait).
What does the command field of /etc/inittab do?
This field designates a shell command to execute.
What does the /etc/inittab line id:3:initdefault:
do?
Indicates that init should set the system runlevel at 3 by default.
What does the /etc/inittab line si::sysinit:/etc/rc.d/rc.sysinit
do?
Indicates that that init should execute the /etc/rc.d/rc.sysinit command prior to entering a runlevel when the system initializes.
What does the /etc/inittab line cmd:123:wait:/sbin/custom
do?
Runs the special script file /sbin/custom for runlevels 1, 2, and 3.