- RUNLEVELS
- Linux relies on runlevels to determine what features are available which are numbered from 0 to 6.
- Each runlevel is assigned a set of services that should be active
- You can set the runlevel that will be active upon boot
- The following are runlevels and purposes for them:
- [ 0 ] — Used to shift the computer from one state to another.
- [ 1 ] — Single-user mode. Used for low-level system maintenance that may be impaired by normal system operations (ex. resizing partitions)
- [ 2 ] — Undefined by some distributions. Debian uses this runlevel for multi-user mode with Graphical User Interface (GUI) running, known as X.
- [ 3 ] — Fedora, Mandriva, Red Hat, and some others use this runlevel as a multi-user mode with console (non GUI).
- [ 4 ] — Undefined and used for customization
- [ 5 ] — Fedora, Mandriva, Red Hat, and some others use this runlevel the same as runlevel 3 with GUI
- [ 6 ] — Used for reboot.
- NOTE: Do not set your default runlevel to 0 or 6 as it will create an infinite boot cycle.
- IDENTIFYING SERVICES WITHIN RUNLEVELS
- The /etc/inittab file will define which programs run in each runlevel
- Once all of the entries in the /etc/inittab files have been executed, you can log in.
- A typical line in the /etc/inittab file consists of the identification code, applicable runlevels, action to be taken, and the process to run (id:runlevels:action:process).
- /etc/inittab will show your default runlevel as initdefault (id:3:initdefault: )
- [ chkconfig –list ] — this command can be used to list the services and applicable runlevels
- [ chkconfig –level 3 ] — this command is used to modify a runlevel of a program
- [ runlevel ] — this command will show your current runlevel
- [ init + runlevel ] — this command can be used to change your current runlevel
- Other commands to change runlevel are shutdown, halt, reboot, and poweroff.