Runlevel
From Gentoo Linux Wiki
Contents |
[edit] About
A runlevel (or "run level") is a mode of operation that can specify what resources are available.
According to The Gentoo Handbook Part 2, Chapter 4, Initscripts
"You have seen that init uses a numbering scheme to decide what runlevel it should activate. A runlevel is a state in which your system is running and contains a collection of scripts (runlevel scripts or initscripts) that must be executed when you enter or leave a runlevel.
In Gentoo, there are seven runlevels defined: three internal runlevels, and four user-defined runlevels. The internal runlevels are called sysinit, shutdown and reboot and do exactly what their names imply: initialize the system, powering off the system and rebooting the system.
The user-defined runlevels are those with an accompanying /etc/runlevels subdirectory: boot, default, nonetwork and single. The boot runlevel starts all system-necessary services which all other runlevels use. The remaining three runlevels differ in what services they start: default is used for day-to-day operations, nonetwork is used in case no network connectivity is required, and single is used when you need to fix the system."
[edit] Standard Gentoo Run Levels
- Standard Run Level Definitions
-
l0:0:wait:/sbin/rc shutdown - l1:S1:wait:/sbin/rc single
- l2:2:wait:/sbin/rc nonetwork
- l3:3:wait:/sbin/rc default
- l4:4:wait:/sbin/rc default
- l5:5:wait:/sbin/rc default
- l6:6:wait:/sbin/rc reboot
- Run Level Explanation
- 0 - Halts the computer
- 1 - Log in as single user root (doesn't ask for password, useful for if you've forgotten or accidentally altered the root password and need to change it without a Gentoo install CD)
- 2- Multi-user without network access
- 3,4,5 - Full multi-user with network access (typical operation, all three run levels should work in the same manner since they all reference
default code>) - 6 - Reboot (can execute this by calling
reboot code> on the command line)
[edit] Custom Gentoo Run Levels
Custom run levels beyond what is offered as defaults can be created as noted in HOWTO_create_a_run_level
All custom run levels have an associated directory in gentoo:/etc/runlevels
[edit] GRUB and LILO
GRUB and LILO allows one to boot up a non-default mode of operation by adding the softlevel parameter after specifying the kernel location or by including the number of the run level as a kernel option.
Goto TIP_Booting_into_single_user_mode for examples.
