Init: Difference between revisions
→Runlevels: remove link to telinit |
m links |
||
Line 18: | Line 18: | ||
===Runlevels=== |
===Runlevels=== |
||
[[Runlevel]]s describe certain states of a machine, characterized by the processes run. There are generally 8 runlevels. These are the runlevels 0 to 6 and S or s, which are aliased to the same runlevel. Of these eight, 3 are so-called 'reserved' runlevels: |
|||
0. Halt |
0. Halt |
Revision as of 19:09, 4 June 2005
init is the program on Unix and Unix-like systems which spawns all other processes. It runs as a daemon and typically has PID 1.
The functionality of init diverged considerably between BSD and System V, and users should consult their system manuals to determine which version is present.
The standard init system used on most Linux distributions is compatible with System V init, but some distributions, such as Slackware, use a BSD-style init system and others, such as Gentoo Linux, have customized init systems.
Booting
As well as being the first thing that runs on a booted system, init is the last thing run by the kernel.
BSD init runs the initialization shell script located in '/etc/rc', then launches getty on text-based terminals or a windowing system such as X on graphical terminals. There are no runlevels; the 'rc' file determines how init is to be run.
System V init examines the '/etc/inittab' file for an 'initdefault' entry, which tells init whether there is a default runlevel. If there is no default runlevel, then the user is dumped to a system console, where a runlevel must be entered manually.
Skipping init Altogether
'init' is not the only option when it comes to booting up a Unix box. On most modern bootloaders (such as LILO or GRUB), you can change which process the kernel spawns at the end of its initialization (the default being, of course, /sbin/init). This is generally done by typing "init=/foo/bar" at the bootloader's prompt. This is often useful for dropping a user directly to a shell (like the Bourne Again Shell or Z Shell). Appending "init=/bin/bash", for example, will bring up a single root shell, without a password. If the system administrator feels this is insecure, they can always setup a BIOS password.
Runlevels
Runlevels describe certain states of a machine, characterized by the processes run. There are generally 8 runlevels. These are the runlevels 0 to 6 and S or s, which are aliased to the same runlevel. Of these eight, 3 are so-called 'reserved' runlevels:
0. Halt
1. Single user mode
6. Reboot
Runlevel 5 is the most common runlevel, as it is the default on SUSE and Mandriva, among others. In these distributions, runlevel 5 is a multiuser graphical environment running X, usually with a display manager such as xdm, kdm or gdm running.
The runlevel is generally changed by root running the telinit command.