Runlevels in SUSE LINUX

Posted: 3 May 2005

Linux operating systems utilize runlevels to determine the services that should be running and to allow specific work to be done on the system. For example, runlevel one is designated single-user mode without networking and is used for critical system maintenance and troubleshooting. Runlevel three is multi-user text mode. Runlevel five is multi-user graphical mode.

Switching between runlevels is accomplished using the init command. Entering:

# init 5

will change to runlevel five. Changing to runlevel six will reboot the machine and runlevel zero will shut down the machine.

Entering runlevel at the command prompt will output the previous and current runlevels. For example:

N 5

indicates that the machine is in runlevel five. The 'N' indicates that the machine was booted into level five, or no previous runlevel was entered.

As mentioned previously, the different runlevels are configured to run a specific set of services. Each runlevel is configured to start its specified services when starting and to shut down its services when switching to a different runlevel.

As a general rule, turn off all services that are not needed at a given runlevel. Managing the services started in each runlevel is simple and can be done graphically in YaST or at the command line with the chkconfig command.

Managing Runlevel Services With YaST

YaST offers a robust and easy to use runlevel service configuration tool. Access the tool at YaST > System > Runlevel Editor. Within the tool, turn services on or off by selecting the service and then selecting the Enable/Disable buttons.

Selecting expert mode allows the administrator to configure the state of a service in each runlevel.

For example, use the YaST runlevel editor to configure the OpenSLP daemon, slpd, to start in runlevels three and five only. Do the following:

  1. Select YaST > System > Runlevel Editor.
  2. Select the Expert Mode radio button.
  3. In the services list, select slpd.
  4. Use the check boxes to select runlevels three and five. Deselect all other runlevels.
  5. Save changes and exit.

Managing Runlevel Services With chkconfig

Most Linux distributions include the chkconfig command for managing runlevel services. The syntax for chkconfig is specified in the chkconfig man page.

For example, use chkconfig to configure the OpenSLP daemon, slpd, to start in runlevels three and five only. Do the following:

1.Check if slpd is on in the current runlevel

# chkconfig slpd
slpd on

2.Check slpd's configuration for every runlevel.

# chkconfig -l slpd
slpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off

3.Turn slpd on in runlevels three and five.

#chkconfig slpd 35

Informacja z serwisu