October 31, 2014
 
 
RSSRSS feed

Ubuntu and Fedora Replace init with Upstart

Init: the Old Way

  • May 4, 2009
  • By Juliet Kemp

init is the program which is used on most Linuxes to generate all other processes on bootup. The BSD style (which runs from the /etc/rc script) is slightly different from the SysV style: SySV is probably the one you're familiar with, as it's used by Debian, SuSE, and until recently, Redhat. With this setup, the system checks /etc/inittab to find a default runlevel. This file also defines what to do for various runlevels. A runlevel is a way of specifying a particular set of processes to run.

The important point is that init is level-driven. This means that you allocate each service to a runlevel, and services are started up in blocks based on which runlevel you boot into (or move into once booted). You can of course manually start and stop services using the same scripts, but the basic idea is one of sets of services which correspond to particular usage situations.

Within the runlevels, the names of the start and stop links govern the timing of the script. Each /etc/rcx.d directory has a collection of softlinks to the start/stop service scripts in /etc/init.d/. These look like this:

K20service -> /etc/init.d/service
S35service -> /etc/init.d/service

If the link starts with a K, the service is stopped. If it starts with an S, it is started. This is done with the logic in /etc/init.d/rc. The numbers control the order, to avoid dependency problems: lower numbers are run first.

 

With modern setups, increasingly this static system has disadvantages:

  • Plug-and-play hardware problems: init cannot handle hardware that's plugged in after bootup. Instead, modern Linux distros which use init have to handle this via the kernel.
  • Simlarly, it may have problems with networked filesystems which may not be available on boot, or may only be available at certain stages.
  • We may have daemons which we'd like only to run when the hardware is available.

So, given these issues: how does upstart work, how does it improve matters, and how can you start using it?

 

Sitemap | Contact Us