System V Init runlevels

ed
Ed Phillis

Runlevels are essentially a collection of scripts, associated with a particular runlevel, that spawn a number of processes required to honour that runlevel.

Whilst the concept of runlevels is moving towards being obselete, Ubuntu's Upstart still uses System V-style init scripts.

Some runlevels are standard between Linux distributions and some vary. The standard runlevels are:

0 - Halt.

1 - Single-User Mode - boots in superuser mode without networking or other daemons. Used for troubleshooting issues.

6 - Reboot

Runlevel 4 is typically unused but can be used for a custom runlevel.

Runlevels 2, 3 and 5 are typically multi-user runlevels.

 

 

To see which runlevel the system is currently configured with:

        
                          
      root@blahblah ~ $ runlevel
      
  
    

To change the runlevel use telinit followed by the required runlevel. You'll need to be the root user or use sudo if you are a member of the sudo group.

        
                          
      root@blahblah ~ $ telinit 5
      
  
    

There are several ways to shutdown or reboot a system depending on which system manager:

reboot, shutdown -r now, shutdown -h, poweroff or change the runlevel using telinit 0 or 6.

 

wall is a useful command for sending a message to all system users that are currently logged in. This is useful if you want to perform a schueduled or unscheduled shutdown or reboot.