Information AboutInit |
| CATEGORIES ABOUT INIT | |
| unix | |
|
init (short for " Initialization ") is the program on Unix and Unix-like systems that spawns all other processes. It runs as a Daemon and typically has PID 1. The functionality diverged, in Unixes such as System III and System V , from the functionality provided by the init in Research Unix and its BSD derivatives. The usage on most Linux Distribution s is compatible with System V, but some distributions, such as Arch Linux and Slackware , use a BSD-style and others, such as Gentoo Linux , have their own customized version. BSD-STYLE BSD init runs the initialization Shell Script located in ''Advantages:'' Simple and easy to edit manually. ''Problems:'' If a 3rd-party package needs to have an initialization script run during the boot procedure, it needs to edit one of the existing boot scripts, but a simple mistake in that process could lead to an unbootable system.
SYSV-STYLE System V init examines the ''Advantages:'' Flexibility and scalability. ''Problems:'' Complexity. Runlevels The Runlevel s in System V 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 Aside from runlevels 0, 1, and 6, every Unix system treats runlevels a little differently. The common denominator is the /etc/inittab file, which defines what each runlevel does (if they do anything at all). Default runlevels On the two Linux distributions defaulting to runlevel 5 in the table above, runlevel 5 is a multiuser graphical environment running the X Window System , usually with a Display Manager . However, in the Solaris operating system, runlevel 5 is typically reserved to shutdown and automatically poweroff the machine. On most systems users can check the current runlevel with either of the following commands: $ runlevel $ who -r The current runlevel is typically changed by Root running the telinit or init commands. The default runlevel is set in the /etc/inittab file with the :initdefault: entry. SKIPPING INIT In Linux systems, with most modern Bootloader s (such as LILO or GRUB ), users can change which process the kernel spawns at the end of its initialization from the normal default of /sbin/init. This is generally done by typing init= /foo/bar at the bootloader's prompt. Appending init=/bin/bash, for example, will bring up a single root shell, without a password. If the system administrator feels that this is insecure, he may setup a BIOS password (and in the case of GRUB , MD5 hashed boot passwords).For BSD variants, on most platforms, the bootstrap program can be interrupted and given the boot -s command to boot into single-user mode. Single-user mode does not technically skip init; it still executes /sbin/init, but it will make init ask for the path to a program to exec() (the default being /bin/sh) instead of doing the regular multi-user boot sequence. If the Tty the kernel was booted from was marked as "insecure" in the /etc/ttys file (on some systems, the current "securelevel" might also matter), init will first ask for the Root password before allowing this (or fallback to multi-user mode if the user hits CTRL+D). If this program is exited, the kernel will restart init in multi-user mode. The same things will happen if the system is switched from multi-user to single-mode while running. If init cannot be started after the kernel booted, it will panic and the system will be unusable. Changing the path to init itself is done differently on different OSes (boot -a on NetBSD, the init_path loader variable on FreeBSD).OTHER STYLES
SEE ALSO
EXTERNAL LINKS |
|
|