LinuxBasics.org

The community that helps people to run Linux

rss
Table of Contents

The linux boot process

When you switch on your computer, the BIOS first checks the hardware, looks for bootable drives and loads the OS-Loader that it finds on the ‘preferred boot drive’.

When using Linux, this is usually LILO or GRUB. They display the boot menu and load the chosen kernel with the appropriate options.

The kernel does some initialization. The output it generates can be reviewed anytime using the “dmesg” command.

When the kernel is done, it starts the “init”-process.

For a more detailed explaination about what happens when you push the power-button on your PC, see the From-PowerUp-To-Bash-Prompt-HOWTO

Init - The Mother of all Processes

In Unix-like systems, processes (think: programs) are organized in a tree-like fashion. Like directories on a disk, most directories have a parent, and some have children. I said most, because like the root-directory does not have a parent-directory, also the INIT-process does not have a parent-process.

Init now has to start all other processes that are needed to run a linux-system. These include things like scripts to set up networking, the mouse-driver gpm, server-processes like samba or apache, the login prompt on the virtual terminals and X11 and its display manager.

The init-sytem used by most linux-distributions resemble the system that was first used in Unix System V (read: five NOT vee). So, we speak about SysV-Init.

SysV-Init has configurations for different runlevels. Think of runlevels as configurations for different tasks. There usually are these runlevels:

Configuring runlevels

In /etc/rc.d/ there are the run-control scripts that bring the system up and down. For example I have “hwscan”, “sshd”, and “vmware” in there (among others). (Suse 9.3)

Then there are multiple directories in there “rc0.d”, “rc1.d”,“rc2.d”, and so forth. These correspont to the runlevels 0, 1, 2, … In rc5.d (Runlevel 5, the default for GUI) we find these scripts again, this time with “S” (for start) or “K” (for kill) and a 2-digit number prepended tp the name. These are not the scripts, but links to them:

sixty-four:/etc/rc.d/rc5.d # ls -l *hwscan *sshd *vmware
lrwxrwxrwx  1 root root 9 2005-07-08 23:19 K09hwscan -> ../hwscan
lrwxrwxrwx  1 root root 7 2005-07-08 23:20 K10sshd -> ../sshd
lrwxrwxrwx  1 root root 9 2005-07-11 22:54 K14vmware -> ../vmware
lrwxrwxrwx  1 root root 9 2005-07-11 22:54 S08vmware -> ../vmware
lrwxrwxrwx  1 root root 7 2005-07-08 23:20 S12sshd -> ../sshd
lrwxrwxrwx  1 root root 9 2005-07-08 23:19 S13hwscan -> ../hwscan

When the system enters a runlevel, some services (programs) are started, and if the runlevel is left some are stopped (=killed). These links define excactly that process of entering and leaving the runlevels.

In the case above, when entering runlevel 5, vmware is being set up, then sshd and then hwscan. When runlevel 5 is left, hwscan is stopped, then sshd and vmware last, according to the numbers.

So, if I want to turn off the hardware-check I need to remove the link to “../hwscan” from all rc?.d - directories.


Slackware does this a tiny bit differently. /etc/rc.d is the location for the run-control scripts, but there are no sub-directories corresponding to runlevels 0-6. In /etc/inittab the default is set for runlevel 4 currently on my machine. In /etc/rc.d/ I have rc.0, rc.4, rc.6, rc.S, rc.M, and rc.K. rc.4 is a script to start the display manager. Then there are the other scripts which are prepended with ‘rc’ like rc.modules, rc.sshd, rc.mysqld and so forth. There are no links as above. The script runs if it is set as executable. This can be done manually or with a program. See below. — Anita Lewis 2005/09/24 12:47

Can you do that in GUI?

Yes. All distributions bring tools that let you define the scripts that are started for each runlevel:

Suse

The runlevel-editor can be found in yast2’s system-tab. If you read this page to this point, you should be safe to check the expert-mode.

Mandriva

The “Mandrakelinux Control Center”, which has a KDE-Quickstart icon, features an icon “Enable or DIsable the system services” in the system-tab.

Knoppix

The “SysV-Init Editor” is found in the system-branch of the K-Menu. From the commandline, it is “ksysv”.

Debian Sarge

Debian stores its init-scripts in /etc/init.d

To teach Debian to use the more commonly used rc?.d structure, install the “sysv-rc” package. “sysv-rc-conf” is a package that will give you a text-gui like “ksysv” mentioned above (which also works in Debian under X11).

Slackware

On commandline use pkgtool. Select setup, then services. Or go to /etc/rc.d and make the service you want executable using

chmod +x rc.servicename

Other distributions

With the information given above, it should be no problem to find the runlevel configuration in your distribution. Feel free to add the details here.


Copyright (c) by the authors.
Prior to editing, authors agreed to license their contributions by the terms of the GPL.
See our licensing page for details.


Linux® is a registered trademark of Linus Torvalds.


 
  tutorials/using/runlevels.txt · Last modified: 2008/07/20 21:08

LinuxBasics.org

Start Linux-Course Tutorials Linux Links Security Blog Forum E-mail List Search Online Chat

Site-Info

Help Get in Touch Making of LBo

Wiki-Control

Powered by

Linux Apache DokuWiki Mailman RUTE ht://Dig