<<

FAQ

SYSTEMD It’s complicated but it’s probably already your computer.

dynamically connect to your network, a runlevel of 1 for a single-user mode, GRAHAM MORRISON while syslogd pools all the system runlevel 3 for the same command messages together to create a log of prompt we described earlier, and Surely the ‘d’ in Systemd is everything important. Another , runlevel 5 to launch a graphical a typo? though it lacks the ‘d’, is – famous environment. Changing this for your No –it’s a form of notation for being the first process that runs on next boot often involved editing the used to signify a daemon. your system. /etc/inittab file, and you’d soon get used to manually starting and stopping You mean like those little Isn’t init used to switch your own services simply by executing devils inhabiting Dante’s between the command-line the scripts you found. underworld? and the graphical desktop? There is a link in that Unix usage For many of us, yes. This was the You seem to be using the past of the term daemon supposedly main way of going from the tense for all this talk about the comes from Greek mythology, where desktop to a command line and back init daemon… daemons invisibly wove their magic again without trying to figure out which That’s because the and benign influence. The word is today processes to kill or start manually. aforementioned Systemd wants more commonly spelt ‘demon’, which Typing init 3 would typically close any to put init in the past. Systemd is leaves the archaic form to us. And graphical environment you had running, basically a replacement for all those that’s perhaps why it’s been subverted kill the X server and drop you to a scripts launched by the init process, for software that silently weaves its simple login prompt. This is because and a replacement for init itself. But as benign influence over your system. the init command knew where to find a the name suggests, it’s got lofty group of scripts that were created for ambitions for being the ‘system Does this mean that, for switching between different operating daemon’, and has the potential to ordinary users, Unix daemons environments. These were called handle far more than starting and are an archaic idea? ‘runlevels’ and in the old days of stopping your system. And in replacing Not at all. Daemons are essential System-V Unix they could be used to a few scripts, it’s needed to come up for performing many essential tell your system to boot into single-user with a completely different mechanism background tasks. They could be mode, multi-user mode as well as for handling boot processes. likened to your brain doing many things shutdown and reboot. This whole while you’re driving a car, without you system is often abbreviated to ‘SysV What was so bad with ‘init’ that having to consciously think about them init’, and it’s this we mean when we it needed replacing? all. And there are lots of daemons you refer to ‘init’. Init was a product of its time. may already be aware of. Crond, for Many distributions inherited the Everything that needed to be example, is used to run scripts at a same system, even if they didn’t use the managed or launched did so from its specific time or interval. dhcpd is used same runlevels. Debian, for example, own set of scripts, keeping things by most of our computers to used a runlevel of 0 to stop the system, relatively simple in concept. Those

38 www.linuxvoice.com SYSTEMD FAQ

scripts called upon whatever utilities attempts another, and it doesn’t take the music streaming service Spotify were needed and installed within your much to imagine the delays this could offered support for Systemd after system, and it also meant that almost cause in the boot process. Your boot saying “We have some 5,000 physical anyone could tweak the scripts to get procedure could spend ages waiting for servers and well over a thousand virtual their boot process doing exactly what a network connection, even if you didn’t servers using both public and private they wanted. It was an extension of the need one, or waiting for an unrelated clouds running Debian GNU/Linux old Unix philosophy of small, simple hard disk to be scanned. These are serving millions of songs to our users tools being used in preference to both functions better suited to being every day.” Their arguments for Systemd complex, over-engineered solutions. run in parallel, but this introduces encapsulate the reasons many people The command line is a perfect example problems familiar to anyone who’s had think Systemd is the way forward: of this philosophy, because while you to deal with concurrency or forking Its dependency model is easier to can build very complex solutions within processes; you need to know which understand than ’s. its confines, most of the commands processes are dependent on which Features built on top of Systemd are other processes. A Samba process that very useful. needed to access remote files would be Systemd has the stronger community “Systemd launches processes dependent on the networking process, momentum. in parallel and avoids the for example, and calculating the Additionally, Systemd launches relationship between all the things that processes in parallel and avoids the bottlenecks that blight init.” make a running system is difficult. bottlenecks that blight init. It does this But as new computers have become by using sockets for services so that you execute perform only a simple task. faster and multi-cored, more and more daemons can talk to each other and It’s the modularity of these commands, of these resources were being under- manages those sockets on behalf of and the control you have over utilised by init, and many people daemons that haven’t started yet. It’s a managing their input and output, that thought it was time for an alternative. clever idea. creates the flexibility we all love. init does this too. Aha! The appearance of Are there any disadvantages to But init has suffered in several ways. Systemd! distros adopting Systemd? First, because it’s so easy to modify and Exactly. Although Systemd wasn’t The main problem is that has no formal system of the only contender in the fight to Systemd is different, and breaks standardisation, almost every family of replace init. Ubuntu had switched to its the simple tool Unix tradition. It’s a huge tweaked it in some own alternative, called Upstart, and for a and comprehensive project, and this way. Red Hat moved files into /etc/ while it looked like many other has caused friction when people have rc.d/init.d, for example, and that meant distributions would do the same. Red to learn both a new system and throw that while installing the same start Hat, Fedora and OpenSUSE all used away hard-earned skills. process should be straightforward, it Upstart at various times in the past, and It’s also complex and, some argue, wasn’t. You had to take into account all it had the huge advantage of being over engineered for its purpose. these changes. And as booting backward compatible with init while Perhaps more importantly, it’s Linux- requirements became ever more addressing some of its shortcomings. only. But – and this is the important complicated, maintaining all these point – Systemd has been proven to scripts and their positions within the You seem to be using the past work, and it works well enough that boot procedure became very difficult, tense again. many distributions have already moved making things harder for developers, The end of Upstart came with a to Systemd. Significantly, the Gnome users and system administrators when very public and contentious team have announced it will become a they used more than one distribution. debate, as Debian decided how to dependency for installing the latest replace init. Upstart and Systemd were versions of their desktop environment, That sounds more like an the two favourites, and the Debian entrenching the technology deeper into organisational problem than a Technical Committee eventually voted our operating systems. technical one. Surely there’s another for Systemd. In a humble blog post, reason to replace init? Mark Shuttleworth announced that Where can we find more Indeed there is, and it’s our old Ubuntu would be dropping Upstart in details about how to use it? friend performance. The world favour of Systemd after committing Not completely by coincidence, was becoming obsessed with boot itself to whatever its upstream partner our very own Mike Saunders is times – despite most of us only having (Debian)decided. These events have led currently working on a tutorial that to go through the procedure maybe us to the point where Systemd is now should answer all your practical once a day, or that for servers it’s a considered the default booting daemon. questions in our next issue, including non-issue. But for a while boot times how to create and modify boot became the machismo statistic of an So what makes Systemd better processes, in the way you may already ’s vitality. init is than init or Upstart? be used to from init, and how to use fundamentally sequential. That means During the great Debian debate, many of those weird Systemd tools that it waits for one task to finish before it the infrastructure team behind are now part of your distribution.

www.linuxvoice.com 39