
SYSADMIN Upstart James Thew James Quick booting with Upstart, a replacement for the legacy Sys V Init JUMP START The slow Linux boot has troubled users for years. Now the Upstart userspace processes and initializing the machine. The process and its helper project offers a fresh approach to the problem of booting Linux. scripts load kernel modules, check and mount the filesystem, set up the net- BY NICO DIETRICH, DIRK VON SUCHODOLETZ work, launch servers, and call the graph- ical login manager. Init has to launch the he history of Linux includes verages many developments in modern services in a meaningful order. For ex- many attempts to address the Linux systems. Upstart, which has Unix ample, it doesn’t make sense to set the Tlong Linux boot process. This roots, cleverly steers clear of unneces- system time by polling a time server on comes as no surprise, as a long boot sary waits, runs start scripts simultane- the network until the machine becomes marathon will annoy all but the most pa- ously, and reduces the boot time to a available on the network. To do this, init tient of users. The legacy Unix System V minimum. The long-term plan is to re- has to first initialize the network hard- boot design was once revolutionary, but place generic background system ser- ware, and set up at least one network in- has turned out to be a millstone around vices such as the at daemon, cron, and terface for external access. the necks of many distributions. others with Upstart. Ubuntu 6.10 (Edgy The number of services and back- Although several tricks for speeding Eft) demonstrates the first effects of this ground agents has grown over the years, up the process have appeared through promising software. and this has made the init process the years, most boot reforms have clumsy. In contrast, desktop usage, turned out to be unworkable in practice, It All Starts with Init which is typical for Ubuntu, demands a and many of the turbo loaders employed Most Unix-style systems share the init dynamic system configuration. Mobile by gurus are inaccessible to regular concept. The process calls the kernel devices also make life really difficult for users. A new tool, Upstart, takes a fresh and assigns the kernel process ID 1. This Sys V Init. Roving devices require an ad- approach to speeding up Linux boot. sequence is hard-coded into the kernel – hoc approach to setting up network con- The high-flying Upstart project [1] in- in /usr/src/linux/init/main.c on Linux. nections, as well as a means for dynami- troduces a generic init daemon that le- Init has the task of launching all other cally configuring hardware. 62 ISSUE 76 MARCH 2007 WWW.LINUX - MAGAZINE.COM Upstart SYSADMIN To cope with this, Linux programmers When they started to think about the pleted,” “Apache running,” or (in the fu- have developed a number of tools: acpid new design, they had to choose between ture) “USB stick plugged.” and apmd for power management, the a target or result-oriented option for the HAL Device Manager for dynamic system launch. Target-oriented would Event Horizon mounting of drives, and the Resource mean defining the services that should Events are basically just simple strings. Manager for dynamic device privilege be running at the end of the start se- The Upstart developers divide events assignments to the user working with quence (KDM, SSH daemon, etc.). into three classes: the GUI desktop. Each of these sytems In this case, it would be necessary to • Simple edge events, such as “the sys- implements its own configuration logic, investigate each service and determine tem is booting,” or “the user has just and admins have to be familiar with this which other services it relied on. Based pressed a button.” logic to be able to run a required task at on these dependencies, the init system • Level events have an additional pa- the right point in time. would need to derive a meaningful rameter, such as the network interface Not all processes and services are tied startup sequence. This is exactly the ap- status. Services and tasks run either to starting or stopping a machine. For ex- proach that Gentoo adopted with its de- for any Level Event, or only when a ample, there are some special services, pend system (see the “Gentoo” box); parameter has reached a specific like cron and the at daemon, that launch Suse also follows this approach with a value. other processes at a certain time. They modified version of the Sys V Init (see • Temporal events occur after a specific are not linked to the runlevel system in the “Suse Linux” box). interval, or at a specific point in time. any way, although they have a similar In the other corner of the ring, there The developers kept to the open source underlying logic. This is another thing were events. Instead of formulating de- codex of release early, release often. that Upstart looks to change [3]. pendencies, which a script would proba- Thus, the code was released at a very bly need to handle at system start time, early stage, and the self-confident devel- Design Issues an event-based system would not run a opers presented a running system, in the Before the Ubuntu programmers decided script until a specific set of preconditions guise of Edgy Eft, to demonstrate how to develop a new system, they first in- was fulfilled. For example, it would not far they have gotten. Their aim is to col- vestigated contemporary alternatives to make sense to call an NFS client until lect as much feedback as possible from the familiar Sys V system [2]. None of the authoritative NFS became available. developers working on other Linux dis- the designs they looked at fulfilled their The system that Ubuntu opted for also tributions. expectations or was available under an understands more complex conditions, However, this also means that the acceptable license. such as “network configuration com- specifications might change in the Sys V Init The early Unix versions used a simple This lets administrators update the start any system. Three runlevels have clearly shell script to configure the machine and scripts without endangering the local defined tasks: Halt (0), Single User Mode, launch services. The design behind the configuration. and Reboot (6). BSD family’s /etc/rc, for example, was Sys V Init uses a far more flexible, but The /etc/inittab file specifies which run- convincingly simple, but it did have one also more complex, approach than BSD, levels exist and defines the runlevel the major drawback. Integrating third-party introducing runlevels that define specific system enters on booting (Figure 1). software, or custom-built extensions, machine states, based on the processes The Sys V design assumes that the sys- meant modifying the shell script. Unfor- that run in them. A total of eight runlev- tem will use a small number of defined tunately, modifying this code is quite els is possible, but not mandatory, for states, such as without network, with dangerous – a single mis- network, with X11, and so take could lead to an un- on. Administrators can bootable system. change the runlevel by In many cases, it takes giving the init Runlevel more than just a simple command. command to launch a Another advantage of this service, with the details approach is the separate varying depending on the scripts for each service or current environment. For configuration task. For ex- example, the ISC DHCP ample, calling /etc/init.d/ server can be set up to lis- dhcpd restart lets you re- ten on specific Ethernet launch the DHCP server interfaces, rather than on without affecting any all ports. To remove the other services. The idea of need for administrators using a collection of sym- to modify the start script links to determine the to do this, daemons often scope and order of the come with configuration scripts used in each run- files that parse the script. Figure 1: This typical inittab defines runlevels 0 through 6. level is also a good one. WWW.LINUX - MAGAZINE.COM ISSUE 76 MARCH 2007 63 SYSADMIN Upstart course of the next few months. The ex- splash (by deleting the splash token down, or runlevel-3 through runlevel-5 amples described here refer to version from the kernel command line in grub), occur (lines 7 through 10). In the future, 0.3 from early December. you won’t see too many messages. If you more complex semantics will support This version replaces the existing init want more, just remove the quiet entry. conditions with logical operators and process, however, don't assume that all On first inspection, the changes under pass in parameters to event scripts, if the start scripts have been modified to the hood are also hidden. If you give the needed. These files play the same role use the event mechanism. Upstart does man init or man telinit command, you as the entries in the legacy /etc/inittab. not support temporal events right now, are informed that the runlevel system This is why Edgy Eft has both rc2 and and there are plans to use other pro- has a new engine. No /etc/inittab file is the files shown at the top of Figure 2. grams, such as Udev and the ACPI or another telltale clue. /etc/init.d and the APM daemons, as event sources. accompanying start scripts still exist at Upstart-Compliant Jobs present as Ubuntu currently runs Upstart There are two ways of defining your own State of the Art in compatibility mode.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages7 Page
-
File Size-