Pick a Free OS

A look at System V initialization

In the traditional BSD style of startup, there are only a few initialization scripts, which are something like the autoexec.bat and config.sys pair of DOS. Commands are executed and services are loaded up sequentially as given in the scripts.

But the system administrator may want a more flexible and convenient way of managing the system. There will be times when certain services are not required. The BSD style of startup as adopted by distributions like Slackware offered only a few system states at the disposal of the administrator. A single user state was provided for maintenance and there was a normal multi-user state.

System V Unix extended this by using more runlevels and also by separating each service into its own unique startup and shutdown script. Each script could be linked to one or more than one runlevel. It was now quite easy for the administrator to create a custom configuration. This system of runlevels and unique service scripts has been adopted by most Linux distributions and can be seen in Red Hat, SuSE, Mandrake and Debian among others. There's quite a bit of flexibility here. One runlevel can boot you into the console while another will boot into the GUI. You can also choose to start without the network having been initialized. The separation of each service also meant that it was now very easy to start, shutdown or restart any given service. To restart the web server, all you would need to do now is say "/etc/rc.d/init.d/httpd restart". The httpd script will shutdown the service and bring it back up.

There are 7 runlevels that have been defined. Of these 7 runlevels 0,1, 6 and S are reserved runlevels.

0 - Halt

1 - Single user mode for maintenance

6 - Reboot

S - Single user mode but only the root partition is mounted. Use this one for filesystem check and repair.

The single user mode is handled differently by the various distributions. Under Red Hat, runlevel "S" and "1" are the same. Runlevel S under System V was for filesystem checks and repairs where only the root filesystem was mounted. No services are running. Runlevel 1 is single user but is used for system administration tasks like adding/removing packages or configuration changes. Some basic services are running but networking is disabled. SuSE works this way and makes the distinction between the two runlevels.

(Thanks to Karl Schmitz for some good information regarding the above)