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.
What does the /etc/inittab line l5:5:wait:/etc/init.d/rc 5
do?
Determines which script runs when invoking an init command. The wait
parameter in the action field means that init should wait until the command is done running before moving on.
What does the /etc/inittab line ca::ctrlaltdel:/sbin/shutdown -r -t 4 now
do?
Specifies what happens when a user presses Ctrl+Alt+Del.
What does the runlevel command do?
Displays the previous runlevel and the current runlevel, respectively.
- The previous runlevel is the first number.
- The current runlevel is the second number.
- An N as the first number specifies that the current runlevel is the runlevel into which the computer booted.
- An S specifies that the runlevel is single user mode (i.e., runlevel 1).
What does N mean when displayed as the first output value of the runlevel command?
An N as the first number specifies that the current runlevel is the runlevel into which the computer booted.
What does S mean when displayed as an output value of the runlevel command?
An S specifies that the runlevel is single user mode (runlevel 1).
What does the init command do?
Changes the runlevel of the computer. Same as telinit.
What does the telinit command do?
Changes the runlevel of the computer. Same as init.
What does the command init s (or telinit s) do?
Changes the runlevel to 1, which is single-user mode
What does the command init q (or init Q, or telinit q, or telinit Q) do?
Causes init to re-examine the inittab file.
What do kernel options do?
Kernel options allow customization of Linux boot parameters to permit administrators to fix several problems related to booting.
What does specifying a runlevel value (digit) as a kernel option do?
Boots into the specified runlevel.
What does the vga
kernel option do?
Changes monitor display settings. E.g., vga=0x307
sets the monitor resolution to 1280x1024 with 256 colors.
What does the init
kernel option do?
Change the program that the kernel starts at boot time. E.g., init=/bin/bash
starts the bash shell at boot time.
What does the acpi
kernel option do?
Enable or disable the advanced configuration and power interface (ACPI). E.g., acpi=off
disables ACPI.
What does the apm
kernel option do?
Enable or disable advanced power management (APM). E.g., apm=off
disables ACPI.
How do you insert new kernel options directly into the existing boot options?
In the GRUB boot menu:
- Select the operating system.
- Press the ‘a’ key.
- Add the kernel boot options to the existing boot options.
How do you oappend kernel options onto existing options listed in the /boot/grub/grub.conf file?
In the GRUB boot menu:
- Select the operating system.
- Press the e key.
- Select the kernel line.
- Press the e key.
- Add the kernel boot options to the existing boot options.
How do you interrupt normal system initialization for maintenance or troubleshooting, then continue the initialization process when finished?
- Specify
init=/bin/bash
as a kernel option during system boot, - Perform necessary maintenance or troubleshooting activities,
- Execute the comand exec /sbin/init when finished to start system initialization.