|
|
Subscribe / Log in / New account

LCE: Systemd two years on

By Michael Kerrisk
November 7, 2012

It has now been a little more than two years since the systemd project began, and in that time a lot has happened. So Lennart Poettering, one of the main developers of systemd, took the opportunity to look back at the progress to date, in a talk at LinuxCon Europe 2012 . Kay Sievers, the other principal systemd developer, was also in the audience, and offered some pieces of background information during the talk.

The first announcement of systemd was in April 2010. The first distribution based on systemd, Fedora 15, came out in May 2011. Since then, it has appeared as the default init system in a number of other distributions, including openSUSE, Mageia, Mandriva, Arch Linux, and others. Systemd is also included in Debian and Gentoo, but it is not the default init system. The most notable absence from the list is, of course, Ubuntu. Lennart expressed the hope that Ubuntu might still switch over, but sounds somewhat less confident of that these days than he has in the past.

Lennart reported that the systemd project is in good health, with 15 committers (including committers from a range of distributors) and 374 contributors to date, although the latter number is inflated by the incorporation of udev into systemd; if the udev contributors that have contributed to that project during its seven-year lifespan are excluded, then systemd has had about 150 contributors. There are about 30 contributors in any given month, and around 490 subscribers to the project mailing list.

One of the goals of systemd was to be able to boot a system without requiring shell scripts, and that goal was achieved about a year ago. The problem with shell scripts, of course, is that they make it difficult to implement the necessary parallelization and asynchronous logic that are needed for fast boot times. As a result of eliminating shell scripts from the boot phase, the number of processes created during system start-up has fallen from 1500 to about 150. On a system with an SSD, booting a full user space can be accomplished in under one second on a standard PC-architecture laptop. Users of Fedora are unlikely to achieve boot times that are quite that fast, because of dependencies like LVM, but boot times of 10 seconds should be achievable "out of the box" with Fedora. Thus, whereas once upon a time the kernel was fast and user space was slow to boot, these days the position has reversed. Lennart remarked that the ball is now back in the kernel's court in terms of improving boot speeds.

Lennart noted that systemd started out as an init system, and as such replaces the classical System V init (sysvinit) program. But along the way, the developers figured out that booting a system is not solely the job of PID 1 (the PID created for the first process on the system, which executes the init program). There are other processes as well, such as init scripts. So the developers redefined systemd a little more, to be not just an init system, but also a platform. Thus, systemd includes a couple of mini-services that are useful for booting. These services include, for example, reading ahead files that were used during the last boot so that booting proceeds faster this time around. Systemd also added a number of other components, such as udev and a system logger, and replacements for pieces like ConsoleKit. The goal of including these services and components within systemd is to create a more integrated boot system.

These changes are sometimes perceived as feature creep in what is supposed to be simply an init system, which prompts the question: is it bloated? Lennart's response is an emphatic "no". In the systemd platform, PID 1 is simply a unit control system. Other tasks are performed by other pieces that ship as part of the systemd package. He likened this to being a repackaging of what once were separate tools that interacted during the boot phase. That repackaging allows a more integrated approach to the boot process that also eliminates some code and feature duplication that occurred across the formerly separate components. By eliminating duplication, and providing a more integrated approach to the boot components, the resulting system is easier for system administrators to manage. The increasing scope of systemd has created more dependencies on other packages, but Lennart noted that almost all of these dependencies are optional, and only required if users want the optional features available in systemd.

At this point, an audience member asked about the status of systemd with Busybox for embedded systems. Lennart noted that he works mainly on desktop systems, but the project certainly does care about embedded systems.

Systemd integrates with some other operating system components. For example, Dracut can pass performance information to systemd, as well as other information, such as whether the root file system was consistency checked. Systemd integrates closely with udev—so closely that udev was eventually merged into systemd, a decision that was, as Lennart noted, widely discussed, and somewhat controversial. Systemd integrates with D-Bus activation, so that if a D-Bus name is requested, a service will be started. Systemd integrates with the Plymouth boot screen splash tool, so that the two systems coordinate their handling of the screen and passwords. It integrates with the Gummiboot boot loader for EFI, so that it is possible to get boot statistics such as measures of the amount of time spent in BIOS, bootloader, kernel initialization, in init ramdisk, and in user-space activation.

Like the Linux kernel, systemd targets the full spectrum of platforms, with features for mobile, embedded, desktop, and server systems, and Lennart remarked that it was interesting that these diverse platforms gained common benefits from systemd. For example, the control-group management features for systemd are of interest for resource management in both server and embedded systems.

An audience member noted that the systemd project has not focused on porting systemd to other operating systems, such as FreeBSD, and asked whether there was no FreeBSD developer who said they'd like to port systemd to FreeBSD? That has not happened so far, Lennart said. The problem is that systemd is tightly bound to various Linux-specific features, such as control groups, for which there are no equivalents on other operating systems. Kay noted that attempts to port udev to other systems went nowhere, and that would be a necessary first step to port systemd.

Systemd has made a number of components in the traditional init system obsolete. The most obvious of these are, of course, sysvinit and init scripts, which are replaced by small C programs that can be parallelized during boot. In addition, systemd made a number of other components obsolete, such as ConsoleKit, pm-utils, and acpid (the ACPI daemon). Systemd's socket-activation feature renders inetd obsolete. Lennart emphasized that while systemd renders all of these components obsolete, most of the components (with obvious exceptions such as sysvinit) can still be used in parallel with systemd, if desired.

At this point, an audience member opined that the classical UNIX init process was designed to be as small and robust as possible, but that this seemed to contrast with where systemd was going. Is systemd at risk of becoming a large single point of failure? Lennart pointed out that while systemd replaces many earlier tools, it performs those tasks in separate processes. However, the notable difference is that the various components operate in a much more integrated fashion.

Lennart then turned to a discussion of the Journal. The Journal is a recently announced systemd component, which is posited as the successor of the traditional syslog logging system. The syslog system is nearly 30 years old, renders log messages in plain text, and does not lend itself to seemingly simple tasks such as showing the last ten log messages produced by a particular service. There are many problems with syslog. For example, it does not index the log and it does not verify the source of log messages.

The systemd developers concluded that logging is an essential part of service management, and none of the current solutions was adequate for systemd's needs, so they came up with the Journal. The Journal has structured metadata about every log event, including eighteen fields with information such as user ID, group ID, and SELinux context. The log is indexed, and secured so that the logged data is trustworthy. The Journal is also rate limited, so that no individual service can clog the log. The Journal has forward secure sealing, so that, periodically (by default, every fifteen minutes) a cryptographic tag is added to the logged data, and the cryptographic key is discarded. The effect is that an attacker who breaks into the system can't alter history in the log (other than possibly the log entries created in the current interval). Work is ongoing to add network logging functionality to the Journal.

Unfortunately, Lennart ran out of time, so that he was unable to go over his thoughts about the future of systemd. However, after two years, it's clear that systemd is an established part of the Linux landscape, and there are increasing signs that it is moving toward becoming an essential part of the operating system.

Index entries for this article
ConferenceLinuxCon Europe/2012


to post comments

LCE: Systemd two years on

Posted Nov 8, 2012 3:11 UTC (Thu) by kenmoffat (subscriber, #4807) [Link] (7 responses)

This is the first time I've been disappointed by an lwn article! It reads like pure propaganda, as if systemd is th only convceivable future. Personally, I'm happy to run /bin/bash init scripts on LFS - no. my boot is nothing tlike as quick as was suggested (15 seconds from pushing the on/off switch until getting to grub, on this amd64 machine, and then about another 15 seconds to boot), but I still haven't seen any reason to abjure shell scripts for init.

LCE: Systemd two years on

Posted Nov 8, 2012 3:33 UTC (Thu) by mattdm (subscriber, #18) [Link]

The tone does come off as a little partisan. LWN editorials often do show strong opinions, but almost always in a self-aware way. Comments like "The problem with shell scripts, of course...", on the other hand, seem a little off.

LCE: Systemd two years on

Posted Nov 8, 2012 3:47 UTC (Thu) by bjencks (subscriber, #80303) [Link]

I think it's pretty typical for a conference report -- he's reporting on what was said, and since Lennart was the one speaking it would obviously be partisan.

LCE: Systemd two years on

Posted Nov 8, 2012 6:51 UTC (Thu) by eyal (subscriber, #949) [Link]

This article is not an overview of init systems, but a coverage of a talk about systemd given by systemd's creator and lead developer.

As such, it is a(nother) fine article from LWN.

Eyal.

LCE: Systemd two years on

Posted Nov 8, 2012 10:00 UTC (Thu) by BradReed (subscriber, #5917) [Link] (2 responses)

I am also unsure with what the major problem is with system logs being in plain text. A failure in being able to read the last 10 messages of a particular service? I guess grep and tail are too old fashioned for modern linux users.

LCE: Systemd two years on

Posted Nov 8, 2012 11:15 UTC (Thu) by dan_a (guest, #5325) [Link] (1 responses)

Grep and tail are fine for users (or for advanced users.) They are less fine for automated log parsing.

I'm a bit worried, though, about how divergent the platforms for server and desktop Linux might end up becoming by going down the path of Journal vs. Syslog - server admins don't always have the same needs as desktop users, but it can't be helpful if the tools they use diverge too much.

LCE: Systemd two years on

Posted Nov 8, 2012 14:38 UTC (Thu) by cmorgan (guest, #71980) [Link]

Nothing prevents journald from maintaining backwards compatibility:

From http://www.freedesktop.org/software/systemd/man/systemd-j...

"
Kernel Command Line

A few configuration parameters from journald.conf may be overridden on the kernel command line:

systemd.journald.forward_to_syslog=, systemd.journald.forward_to_kmsg=, systemd.journald.forward_to_console=
Enables/disables forwarding of collected log messages to syslog, the kernel log buffer or the system console.
"

LCE: Systemd two years on

Posted Nov 15, 2012 13:45 UTC (Thu) by bluss (guest, #47454) [Link]

Isn't it sad that this topic has to devolve into tribal groupings? For or against? Partisan? We need to make this a bit less like Lord of the Flies.

In debian circles, you can read stuff like "I'll GR against systemd if I have to", which reminds me only of the Republicans of 2011; "if I'm not getting what I want, then we all go down together".

Maybe if everyone made an effort to see what the other side sees as positive in their preferred solution, we could solve this more smoothly.

LCE: Systemd two years on

Posted Nov 8, 2012 8:00 UTC (Thu) by Rudd-O (guest, #61155) [Link]

Fantastic article. Keep them coming!

LCE: Systemd two years on

Posted Nov 8, 2012 9:58 UTC (Thu) by mjthayer (guest, #39183) [Link] (2 responses)

From the article:
"At this point, an audience member opined that the classical UNIX init process was designed to be as small and robust as possible, but that this seemed to contrast with where systemd was going. Is systemd at risk of becoming a large single point of failure? Lennart pointed out that while systemd replaces many earlier tools, it performs those tasks in separate processes. However, the notable difference is that the various components operate in a much more integrated fashion."

Which presumably only goes half-way to answering said audience member's question. Doing everything in separate processes should certainly make it easier to keep the init process small and robust, on condition that the overall process is well tested for how well it copes with failures of individual components. Does anyone know if that is being done?

LCE: Systemd two years on

Posted Nov 8, 2012 11:54 UTC (Thu) by zuki (subscriber, #41808) [Link] (1 responses)

Those "individual components" are subject to the same rules as normal systemd units (e.g. daemons), in that their exit status is recorded and each component, after it finishes, has a status of Success or Failure. Other components have dependency rules, so if they are marked to require the first component, they will not be started if it fails.

If a basic boot-up "component" fails, e.g. fsck of the root filesystem, then the system bootup will be stopped and a login prompt will be opened for the admin to fix things. So in this regard this is similar to sysvinit, except that what is required and what is not for the basic boot is configurable.

LCE: Systemd two years on

Posted Nov 8, 2012 14:50 UTC (Thu) by mjthayer (guest, #39183) [Link]

Thanks for the answer. That indeed sounds solid.

LCE: Systemd two years on

Posted Nov 8, 2012 12:00 UTC (Thu) by gb (subscriber, #58328) [Link] (51 responses)

Implementing all init in C. This renders all userspace tools useless. Now what, i should implement dd in C? Or do the systemd provide a 'libcoreutils'? Is this really good solution? Now, if i want to change or write new boot script i should go and write C program, how much the maintainability of such system changed? What prevented the author to replace old init scripts with C programs if he worry about bash? Why do i need to boot my server in one second and is this my only desire on my server?

LCE: Systemd two years on

Posted Nov 8, 2012 12:36 UTC (Thu) by mpr22 (subscriber, #60784) [Link] (7 responses)

Using systemd makes the use of shell scripts to launch services optional. Many of systemd's assorted detractors seem to have acquired the belief that it makes the use of shell scripts to launch services impossible.

LCE: Systemd two years on

Posted Nov 9, 2012 1:22 UTC (Fri) by marcH (subscriber, #57642) [Link] (6 responses)

I don't think it's possible to modify C code using a shell script language.

LCE: Systemd two years on

Posted Nov 9, 2012 7:50 UTC (Fri) by smitty_one_each (subscriber, #28989) [Link]

Bash isn't written in C, and you couldn't (for example, I haven't checked this) pull Bash's parser into another program, so that a legacy script could remain usable?

LCE: Systemd two years on

Posted Nov 9, 2012 19:00 UTC (Fri) by speedster1 (guest, #8143) [Link]

Having used systemd on an embedded project by now, I can say from experience that legacy init scripts can just as easily be called via a systemd config file aka "unit file" as they could via the base rc script. I don't remember having to modify the base rc script which iterates through all the scripts in the appropriate runlevel, and analogously I do not expect to have to modify the systemd parser which iterates through unit files to decide what services need to be kicked off.

sysvinit -> inittab -> rc script -> init.d scripts

systemd -> unit files -> init.d scripts

There is an option to stick the start/stop command lines directly in the unit files if they are single-liners, but if that is the case the main thing an admin might want to do is stick in a 'strace' or 'ltrace' of the daemon, and that can just as easily be done by editing the unit file as an init.d script.

The increasing list of dependencies for normal systemd operation on the other hand... can indeed be a pain for embedded projects. Even the requirement for cgroup support required a patch against the vendor-supplied kernel (yes many embedded Linux projects are *still* that out of date)

LCE: Systemd two years on

Posted Nov 15, 2012 9:09 UTC (Thu) by HelloWorld (guest, #56129) [Link] (1 responses)

What kind of argument is that supposed to be? You don't need to modify systemd's C code to launch a shell script from a systemd unit. Just stick the script's name in the unit file's ExecStart line.

LCE: Systemd two years on

Posted Nov 15, 2012 15:21 UTC (Thu) by marcH (subscriber, #57642) [Link]

> What kind of argument is that supposed to be?

The poster right above yours seems to have understood it.

LCE: Systemd two years on

Posted Nov 15, 2012 12:31 UTC (Thu) by Wol (subscriber, #4433) [Link] (1 responses)

aiui, any *properly* *written* init script is 99% boilerplate, and 1% specific. Assuming just ten lines of specific code, that's a thousand lines of boilerplate :-)

systemd simply implements that 99% in small C procedures. The result is far less duplicate code, and far less opportunity for mistakes. Plus far greater testing, and hence solidity.

That one percent is still a text-editable script, just a systemd config file rather than bash code.

Cheers,
Wol

LCE: Systemd two years on

Posted Nov 15, 2012 14:30 UTC (Thu) by Eckhart (guest, #74500) [Link]

> aiui, any *properly* *written* init script is 99% boilerplate, and 1% specific.

Properly written init scripts are a rare thing to begin with. Just as an example, the behaviour of Debian init scripts wrt to "force-reload" is completely random: about half of the init scripts start non-running services on force-reload, the other half of them don't.

LCE: Systemd two years on

Posted Nov 8, 2012 13:49 UTC (Thu) by nix (subscriber, #2304) [Link] (42 responses)

All this 'fast boot' stuff seems terribly... academic to me: the slowness of booting my systems is not caused by sysvinit, nor by the kernel, but by the BIOS, which systemd cannot touch. No PC I have ever owned has got out of POST in less than twenty seconds: my current server-class hardware takes well over a minute. Ditching shell scripts for init to shave a second or two off that seems a massive change for a very small gain. (But it is true that ditching shell scripts for the common case has a lot of other advantages too. sysvinit shell scripts *are* disgusting.)

Maybe all this applies to laptops resuming from suspend too (but they don't follow the normal boot path!). The one laptop I own takes 'only' ten seconds to POST, so perhaps they are generally faster to boot as well...

LCE: Systemd two years on

Posted Nov 8, 2012 14:56 UTC (Thu) by cortana (subscriber, #24596) [Link]

IME, computers sold to end users (desktop and laptops alike) have much faster POSTs than motherboards that are sold to enthusiasts. Servers are of course in a class of their own. So the impact of speeding the boot time will be felt more on consumer-oriented systems.

LCE: Systemd two years on

Posted Nov 8, 2012 15:38 UTC (Thu) by gb (subscriber, #58328) [Link] (16 responses)

From my point of view, problem of this approach that 'fast boot time' is the only criteria, not maintainability, not reliability, not fault-tolerance, not easiness to learn, not reconfigurability. The only criteria praised is very end-user oriented 'boot time', which actually... doesn't matter! On user machines i guess it's much faster to do suspend to disk. On servers startup time doesn't matter, you need reliability there and maintainability. So where do you need fast boot time??? I know only one application - embedded devices, but still, they may use suspend to disk, it would be also real hell i guess to debug such binary boot on embedded device.

LCE: Systemd two years on

Posted Nov 8, 2012 17:57 UTC (Thu) by admax88 (guest, #75035) [Link]

As an end-user, I appreciate when projects take end-user oriented criteria into account.

LCE: Systemd two years on

Posted Nov 8, 2012 22:54 UTC (Thu) by jtc (guest, #6246) [Link] (8 responses)

"From my point of view, problem of this approach that 'fast boot time' is the only criteria, not maintainability, not reliability, not fault-tolerance, not easiness to learn, not reconfigurability."

Are you saying that the only criterion of systemd is fast boot time? (Or are you talking about something else?) If so, this appears to completely contradict what the systemd author's claim are the goals of systemd. For example, the article says:

"That repackaging allows a more integrated approach to the boot process that also eliminates some code and feature duplication that occurred across the formerly separate components. By eliminating duplication, and providing a more integrated approach to the boot components, the resulting system is easier for system administrators to manage."

Are you implying that this claim is a lie? And how do you come to the conclusion that maintainability, reliability, etc. are not part of the goals of systemd?

LCE: Systemd two years on

Posted Nov 9, 2012 1:56 UTC (Fri) by marcH (subscriber, #57642) [Link] (2 responses)

> "That repackaging allows a more integrated approach to the boot process that also eliminates some code and feature duplication that occurred across the formerly separate components. By eliminating duplication, and providing a more integrated approach to the boot components, the resulting system is easier for system administrators to manage."

> Are you implying that this claim is a lie?

A lie, probably not.

A attempt to disguise an enjoyable and beautiful engineering exercise as something performed to solve important problems users loudly complained about; maybe yes.

Don't get me wrong: many good engineers tend to be guilty of this. As recently posted here: http://www.jwz.org/doc/cadt.html
And it's not just open source but also one of standard ways to BS your boss.

LCE: Systemd two years on

Posted Nov 9, 2012 9:15 UTC (Fri) by BradReed (subscriber, #5917) [Link] (1 responses)

A jwz comment from 2003 is recent?

LCE: Systemd two years on

Posted Nov 9, 2012 23:26 UTC (Fri) by artem (subscriber, #51262) [Link]

'Here' in this context means another lwn thread where that 2003 comment was mentioned recently.

LCE: Systemd two years on

Posted Nov 9, 2012 12:23 UTC (Fri) by gb (subscriber, #58328) [Link] (4 responses)

> Are you saying that the only criterion of systemd is fast boot time?

Read this:

http://0pointer.de/blog/projects/systemd.html

What i see in that design? "Do fast, do parallel, start less, integrate everything".

What i expect?:
be predictable
be easy to learn
be easy to maintain
be reliable
reuse as much existing tools as possible

There is even no such words in grounding ideas of systemd!

LCE: Systemd two years on

Posted Nov 9, 2012 17:46 UTC (Fri) by develop7 (guest, #75021) [Link] (3 responses)

> be predictable
well, it is. as soon as you'll read man.
> be easy to learn
done.
> be easy to maintain
it is.
> be reliable
check
> reuse as much existing tools as possible
Yeah. We definitely should use /usr/bin/ionice instead of appropriate unit config parameter (IONice=). Who cares 90% of ionices' code is about CLI switches and environment variables handling. It's 21st century after all, our CPUs are fast enough anyway.

LCE: Systemd two years on

Posted Nov 9, 2012 21:11 UTC (Fri) by gb (subscriber, #58328) [Link] (2 responses)

You see ionice? I see years of different high skilled people work and thousands lines of high-quality code.

LCE: Systemd two years on

Posted Nov 9, 2012 23:47 UTC (Fri) by Cyberax (✭ supporter ✭, #52523) [Link]

A nice argument.

"You see 1000 lines of tangled COBOL code? I see years of different high skilled people work and thousands lines of high-quality code."

LCE: Systemd two years on

Posted Nov 9, 2012 23:51 UTC (Fri) by nix (subscriber, #2304) [Link]

You picked a really bad example. ionice.c is a mere 200 lines long, and utterly horrible (e.g. using numeric arguments where the actual interface uses a named #define, but apparently exporting that name to the user would have been too hard, just use the numbers dammit).

LCE: Systemd two years on

Posted Nov 9, 2012 0:03 UTC (Fri) by Cyberax (✭ supporter ✭, #52523) [Link]

I've converted my embedded devices to systemd and socket-based activation. I can say that it was much easier than writing sysvinit-based infrastructure in the first place.

On servers systemd also allows to cleanly separate various services into hierarchies. It has already saved me from a memory leak in one app taking down other innocent apps.

LCE: Systemd two years on

Posted Nov 9, 2012 19:09 UTC (Fri) by speedster1 (guest, #8143) [Link] (3 responses)

A friend of mine has been showing off Linux booting from scratch (not waking from suspend) on an i5 tablet within a couple seconds. People using tablets have been trained to expect this sort of fast response, so this is the a much more relevant use-case for fast boot than those servers with poky bioses.

I really wish server bioses weren't so darned slow as to make fast boot almost completely moot though, since one of my contracts involves developing Linux installs for both servers and workstations... trust me, servers used for testing custom kickstarts get booted a LOT more frequently than typical operational servers.

LCE: Systemd two years on

Posted Nov 10, 2012 21:56 UTC (Sat) by zlynx (guest, #2285) [Link] (2 responses)

A big chunk of that server BIOS time is ECC init. It might be nice if there was some sort of BIOS flag that could tell the OS, "Hey, I have done ECC init on the first megabyte. Have fun: do the rest yourself."

Then Linux could boot and hot plug each new piece of memory as ECC init completed.

Your system would be a little odd: during the first minute it'd have less than a gigabyte, growing toward the full 64 GB as time went on.

LCE: Systemd two years on

Posted Nov 10, 2012 23:09 UTC (Sat) by nix (subscriber, #2304) [Link] (1 responses)

OK, hardware idiot here. Why's ECC init any slower than normal RAM? Even filling all of RAM with a known value doesn't take anywhere near as long as some server boards take to start.

LCE: Systemd two years on

Posted Nov 10, 2012 23:32 UTC (Sat) by dlang (guest, #313) [Link]

In a lot of cases the BIOS is actually testing the memory, not just seeing if it exists.

This is a huge waste of time, except when it finds a problem.

In addition, Server boards tend to have other things on them that are careful in their initialization, and have timeouts to detect if things have been connected to them or not.

There is a lot of logic in these peripheral processors, and the BIOS is conservative and serializes all the initialization.

Servers don't tend to reboot that frequently, so the boot time is not a big deal (or if you think it is, you need to be running your app on a cluster anyway, at which point the boot time of any individual server is again not a big deal)

I have some systems at work with large RAID arrays and lots of RAM that take long enough to go through their boot that I can take a CD, boot a fast system that doesn't have all these extras, run my (custom) OS installer, pull the CD out and put it in the slow machine before it gets around to looking for the disk.

LCE: Systemd two years on

Posted Nov 15, 2012 9:25 UTC (Thu) by HelloWorld (guest, #56129) [Link]

From my point of view, problem of this approach that 'fast boot time' is the only criteria, not maintainability, not reliability, not fault-tolerance, not easiness to learn, not reconfigurability.
systemd-managed systems are easier to maintain because unit files are easier to write than init scripts, and because most dependencies don't have to be configured explicitly because of socket/d-bus/etc. activation. They're more reliable and fault-tolerant because systemd isolates services with cgroups, file system namespaces, resource limits, syscall filters etc.. It's easier to learn because of the trivial unit file format and the superb documentation, not to mention the GUI that comes with it. And it's at least as configurable as sysvinit, since you can easily launch a shell script when starting a service.

LCE: Systemd two years on

Posted Nov 8, 2012 15:59 UTC (Thu) by bluss (guest, #47454) [Link]

The systemd project is doing us a huge favor by integrating together kernel, udev, and services properly. Race conditions are revealed and fixed properly (sockets, dbus IPC). Processes are properly tracked (cgroups) and reliably logged (journald).

Systemd is going by correct first and then fast. Faster boot is not very important to me, my personal vision is *instant* boot, now that would be a game changer! Faster boot is an acceptable stepping stone.

Fast boot

Posted Nov 8, 2012 16:30 UTC (Thu) by man_ls (guest, #15091) [Link] (20 responses)

For me on my new amd64 machine, fast boot is a very important feature: I switch it off every night and turn it on in the morning. However, with Debian testing I am getting a solid ten seconds from pressing enter in GRUB to operative state, of which I estimate that five are spent by the kernel and another five by various tasks and X. (Before there are about 5 seconds wasted by the BIOS and GRUB, and after there are still some apps starting like Firefox or Terminal. Yes, the BIOS in my delicious and cheap Asus mini-ITX P8H61-I is quite fast.) So I am booting my services in five seconds without systemd.

You are right that init shell scripts are ugly, but I can edit them in a minute if there is anything wrong with them. Hackability is a more important feature to me than the couple of seconds that I can shave off the total boot time. Luckily Debian provides for all choices here.

Fast boot

Posted Nov 8, 2012 20:24 UTC (Thu) by Eckhart (guest, #74500) [Link] (18 responses)

> You are right that init shell scripts are ugly, but I can edit them in a minute if there is anything wrong with them.

You are implying that the classic base system is so badly written that it needs frequent edits – and your conclusion is to *not* rewrite it in a maintainable programming language? Seriously?

Fast boot

Posted Nov 8, 2012 21:32 UTC (Thu) by man_ls (guest, #15091) [Link]

That is a good point indeed. But please note that no system is perfect and that edits and adaptations will be inevitable during its usable life. Especially considering that the init system is not alone and it has to interact with a large amount of base software, and that not everyone updates their full OS every time a new version comes out.

For example, I've had to hack on the Linux driver for the fan on my Asus motherboard (it87); nothing serious, just make the C code think that my chip is an it8721 which was the only one that worked. Well, I can tell you that it was much more painful than hacking on an init script to add a new command or adapt it to a different situation. In fact you can add whatever commands you may need, and it is trivial to test your changes.

Fast boot

Posted Nov 9, 2012 1:35 UTC (Fri) by marcH (subscriber, #57642) [Link] (6 responses)

> You are implying that the classic base system is so badly written that it needs frequent edits

He is not. On the other hand, you seem to be implying software can be perfect and never require minor bug fixes, workarounds or adaptations.

> ... in a maintainable programming language?

While Bourne shell scripting shows its age and has a number of significant problems, as a higher level language it also has a number of desirable properties that C has not. Not requiring compilation is only one of them.

Fast boot

Posted Nov 9, 2012 2:50 UTC (Fri) by Cyberax (✭ supporter ✭, #52523) [Link] (5 responses)

Requiring C compilation for each change is a strawman.

You need to change SystemD code only for very major new features. Small changes can be done just fine by using wrappers over executable files and/or script hooks (basic systemd functionality).

Fast boot

Posted Nov 9, 2012 11:57 UTC (Fri) by gb (subscriber, #58328) [Link] (4 responses)

Wrappers and hooks. Hope that Debian will never integrate this.

Fast boot

Posted Nov 9, 2012 12:11 UTC (Fri) by mpr22 (subscriber, #60784) [Link] (1 responses)

systemd is available in wheezy, as are upstart, sysvinit, and runit.

Fast boot

Posted Nov 9, 2012 12:12 UTC (Fri) by gb (subscriber, #58328) [Link]

I meant never switch completely to it without possibility to choose something else.

Fast boot

Posted Nov 9, 2012 13:30 UTC (Fri) by anselm (subscriber, #2796) [Link]

Too late. Systemd is already available in Debian for those who want to install it.

The jury is still out on whether it will eventually become the default init system for Debian (at least on Linux). There are reasonable arguments both in favour and against.

Fast boot

Posted Nov 9, 2012 18:10 UTC (Fri) by Cyberax (✭ supporter ✭, #52523) [Link]

What's wrong with them?

Oh, and start-stop-daemon (present in almost every Debian initscript) is very much a wrapper already. And an ugly one at that.

Fast boot

Posted Nov 9, 2012 11:55 UTC (Fri) by gb (subscriber, #58328) [Link] (9 responses)

> You are implying that the classic base system is so badly written that it needs frequent edits – and your conclusion is to *not* rewrite it in a maintainable programming language? Seriously?

There is big difference between flexibility and problem solving. There are many reasons to change the scripts: learning, configuring, debugging unrelated issues, making a copy. The ability to use system in ways not expected ways is highly valuable thing.

So, ability to easily read and change the scripts has not relation to be "badly written".

And scripts written in bash are significantly more "maintainable" than written in C.

Fast boot

Posted Nov 9, 2012 13:42 UTC (Fri) by intgr (subscriber, #39733) [Link] (7 responses)

> And scripts written in bash are significantly more "maintainable" than written in C.

Init "scripts" in systemd aren't written in C either. They're written in a custom declarative language, which is straightforward and well documented. It's very easy to customize these configuration files -- infinitely easier than 100+ line bash scripts dealing with PID files, exit statuses, "sleep" hacks to work around race conditions and distro-specific process management commands that were designed to help write init scripts, but are each inadequate their own way.

But as for maintainability of bash, I still disagree. I'm no fan of C, but when you read a C program, it's usually clear what's happening and how it happens. bash scripts, in comparison, typically consist of some commands duct-taped together with grep, awk, cut, tr etc. There's no way to know what they're doing other than running the command and then reverse engineer which bits of the output it is trying to extract.

Fast boot

Posted Nov 9, 2012 16:43 UTC (Fri) by marcH (subscriber, #57642) [Link] (6 responses)

Scripts are not easier to understand than C code because the language is clearer - you are right the Bourne shell is too old and sucks.

Scripts are easier to understand than C code because they're using a higher level language which means comparable things are done in code several times smaller. They are also "faster" to understand because you don't need to find and download the right source code version. They are also faster to understand because, when you are not sure, you can add traces and more generally hack and experiment with them in the blink of an eye with a simple editor (everyone around my cube is able to do that while few people can do similar things in C).

Yes system V init scripts suck in so many ways, yes Bourne shell is the oldest and ugliest of scripting languages, but as a high-level and interpreted language it has a number of desirable features that C - a fantastic but extremely low level language - will never have.

I can't believe I have to explain the most basic characteristics of scripting languages in a forum like this...

Fast boot

Posted Nov 9, 2012 17:21 UTC (Fri) by intgr (subscriber, #39733) [Link]

Let me say it again: systemd services are NOT written in C. systemd replaces bash with a new declarative language, which does not have the downsides of bash. If you want to change the way that a service is launched, you change this config file -- you don't have to download or write or compile any C code, making your rant irrelevant to the systemd debate.

> Scripts are easier to understand than C code because they're using a higher level language

You're stating this as if it were a fact, but it's not -- it depends on the task. I won't take this further because it's a red herring to direct attention away from the real argument.

> I can't believe I have to explain the most basic characteristics of scripting languages in a forum like this...

Wow, that's a nice way to say "I'm right and you're stupid because you disagree with me"

Fast boot

Posted Nov 9, 2012 21:33 UTC (Fri) by boklm (guest, #34568) [Link] (3 responses)

> Scripts are easier to understand than C code because they're using a higher level language which means comparable things are done in code several times smaller.

And domain specific language (such as what systemd uses for its unit files) are also several times smaller and easier to understand than the same things done in a general purpose language like bash.

Fast boot

Posted Nov 9, 2012 22:50 UTC (Fri) by dlang (guest, #313) [Link] (2 responses)

If it eliminated the need to learn Bash you might have a point. However it doesn't eliminate the need to learn Bash, so it's 'yet another language to learn'

At that point, you have to question if the new language is valuable enough to have to exist instead of re-using one that's already required.

Fast boot

Posted Nov 9, 2012 23:09 UTC (Fri) by boklm (guest, #34568) [Link]

Actually this is not really a new language, just simple configuration files, so there is no new language to learn.

You need to understand what the options mean, but it is usually obvious with the name, and fully documented in man pages.

When looking at a bash init script, you also need to understand what the variables mean. You do this by looking at the code to find what it is doing. In systemd you look at the man page instead. But only the first time, because the same options are used in all unit files so it's easy to remember, while sysv init script always re-implement the same things in a different way so you need to read everything.

Fast boot

Posted Nov 15, 2012 9:47 UTC (Thu) by HelloWorld (guest, #56129) [Link]

There's no new language to learn, systemd's configuration file use the same ini-style format as freedesktop's .desktop files.

Fast boot

Posted Nov 15, 2012 9:46 UTC (Thu) by HelloWorld (guest, #56129) [Link]

Scripts are easier to understand than C code because they're using a higher level language which means comparable things are done in code several times smaller.

Brevity alone doesn't help. intgr's point is that every time you read a command such as foo | awk '{ print $4 }', you need to know what foo prints in its fourth column, so it forces you to keep lots of things in mind, which certainly isn't maintainable.

And by the way, that's not just a limitation of the bash language but of UNIX shells in general, as their primary means of communication is an unstructured byte stream.

Fast boot

Posted Nov 10, 2012 7:50 UTC (Sat) by Eckhart (guest, #74500) [Link]

> There is big difference between flexibility and problem solving. There are many reasons to change the scripts: learning […]

Nothing prevents you from doing that with C files: http://www.freedesktop.org/software/systemd/

> […] configuring […]

You see, this is the main problem with "hackers" (compared to actual programmers): they fail to understand that code and configuration are two different things. "gcc config.c && ./a.out" is *not* a great audio player with a rather complex configuration file.

> […] debugging unrelated issues […]

If you need to change the internals of one component to debug unrelated issues, then your encapsulation is probably wrong.

> […] making a copy

There is no DRM, feel free to copy.

Fast boot

Posted Nov 15, 2012 9:31 UTC (Thu) by HelloWorld (guest, #56129) [Link]

So you're saying that you can edit shell scripts in a minute if anything is wrong with them, but editing a systemd unit file is beyond your abilities?

LCE: Systemd two years on

Posted Nov 8, 2012 16:35 UTC (Thu) by mirabilos (subscriber, #84359) [Link] (1 responses)

Besides, how often do you boot your Unix systems?

LCE: Systemd two years on

Posted Nov 8, 2012 20:17 UTC (Thu) by nix (subscriber, #2304) [Link]

Well, I suspend/resume to disk every night (or I do when it works, which it hasn't for the last few kernel releases: I suspect a radeon problem but haven't done anything to verify this). And every resume requires... a POST. :(

syslog vs other solutions

Posted Nov 8, 2012 15:30 UTC (Thu) by dps (guest, #5725) [Link] (15 responses)

The old style syslog does have lots of problems but most of the replacements are worse. You can read syslog output without special tools and it is reasonably easier for programs to parse (modulo the parsability of the logged messages).

I would also note than a lot of things found to large network, for example lights out management and SAN boxes support syslog but none of the other solutions. This makes syslog support an important feature.

It also reasonably easy to set up a drop safe non-networked logging host for cracker proof logs. If the journal, or anything else, loses this or the ability to process the logs without special tools then it is a step backwards.

Knowing that your logs have been edited is not enough: as a system admin I want to know what was edited out and a drop safe logging host provides me with that. Anything that does not support such a box is inferior.

syslog vs other solutions

Posted Nov 8, 2012 15:32 UTC (Thu) by ovitters (guest, #27950) [Link] (13 responses)

You can still run syslog.

syslog vs other solutions

Posted Nov 8, 2012 16:37 UTC (Thu) by mirabilos (subscriber, #84359) [Link] (2 responses)

For how long?

The Arch Linux people said you can still use init scripts… now Arch Linux is dead.

And I will GR against a switch to systemd in Debian, should that become necessary.

syslog vs other solutions

Posted Nov 8, 2012 19:24 UTC (Thu) by smoogen (subscriber, #97) [Link]

As long as people are willing to take the time and energy to update various parts. When they no longer want to do that and no one steps up to replace them.. the feature is dead.

syslog vs other solutions

Posted Nov 9, 2012 0:08 UTC (Fri) by Cyberax (✭ supporter ✭, #52523) [Link]

Syslog compat code in Journal is trivial - it just forwards messages to a specific socket:
http://cgit.freedesktop.org/systemd/systemd/tree/src/jour...

There's nothing complicated there, so it can be easily maintained indefinitely.

>now Arch Linux is dead.
That'd be a news for a lot of Arch users.

syslog vs other solutions

Posted Nov 8, 2012 19:25 UTC (Thu) by dlang (guest, #313) [Link] (9 responses)

just like you can still use udev without systemd?

syslog vs other solutions

Posted Nov 15, 2012 13:09 UTC (Thu) by Wol (subscriber, #4433) [Link] (8 responses)

Has that changed?

aiui you could compile udev separate from systemd. And I'm on gentoo. Not that I notice these things but my init system is OpenRC (I think - it's the default, whatever) and I'm running udev - udev 171-r8 to be precise.

iirc they may be the same code base, but they are two separate builds - the code bases merged because so much was duplicated.

Cheers,
Wol

syslog vs other solutions

Posted Nov 15, 2012 17:16 UTC (Thu) by nix (subscriber, #2304) [Link]

udev 171 predates the udev/systemd merge.

syslog vs other solutions

Posted Nov 15, 2012 19:32 UTC (Thu) by dlang (guest, #313) [Link] (6 responses)

The systemd/udev maintainers have recently announced that compiling udev without systemd is no longer supported

syslog vs other solutions

Posted Nov 15, 2012 23:52 UTC (Thu) by BlueLightning (subscriber, #38978) [Link] (1 responses)

Really? Can you point to this announcement? It was only in April that Lennart had this to say on the matter:

http://lwn.net/Articles/494255/

syslog vs other solutions

Posted Nov 17, 2012 17:14 UTC (Sat) by bluss (guest, #47454) [Link]

I think you need to build both udev and systemd, but you can install just the udev products.

syslog vs other solutions

Posted Nov 17, 2012 18:47 UTC (Sat) by jrn (subscriber, #64214) [Link] (3 responses)

> The systemd/udev maintainers have recently announced that compiling udev without systemd is no longer supported

That is frightening. Regardless of what you think of systemd, the udev maintainers have just said loudly and clearly "We don't care about you" to a substantial existing population of users.

syslog vs other solutions

Posted Nov 17, 2012 19:38 UTC (Sat) by Cyberax (✭ supporter ✭, #52523) [Link] (2 responses)

I've checked the recent posts in udev's mail list and I can't find what dlang is talking about.

syslog vs other solutions

Posted Nov 17, 2012 23:18 UTC (Sat) by jimparis (guest, #38647) [Link]

From http://permalink.gmane.org/gmane.linux.hotplug.devel/17444 (May 2012)

"We support stand-alone *operation* of the udev tools, but the build
system does not support a stand-alone *build*. The systemd tree needs
to be built and udev picked out of it."

syslog vs other solutions

Posted Nov 18, 2012 0:13 UTC (Sun) by dlang (guest, #313) [Link]

it's not recent news.

The recent news is that some Gentoo developers have (sortof) announced that they are planning to fork udev as a result of how it's being managed since being merged into systemd

syslog vs other solutions

Posted Nov 9, 2012 12:27 UTC (Fri) by zuki (subscriber, #41808) [Link]

> The old style syslog does have lots of problems but most of the
> replacements are worse. You can read syslog output without special tools
> and it is reasonably easier for programs to parse (modulo the
> parsability of the logged messages).
It is true, that a special tool is needed to parse journal files, but
(a) it's always possible to pipe the output and then perform further analysis. Actually, this isn't that much different from current .gz/.xz
compressed text files.
(a) there's a nice C interface which is easy to use, so tools for parsing
log messages can certainly be taught to read journal files themselves
without too much work.
(b) the format is documented [1], so it's possible to create other
parsers

[1] http://www.freedesktop.org/wiki/Software/systemd/journal-...

> I would also note than a lot of things found to large network, for
> example lights out management and SAN boxes support syslog but none of
> the other solutions. This makes syslog support an important feature.
As other posters have said, it's always possible to keep a syslog daemon around. OTOH, generating syslog messages from journal messages is trivial, and a tool which forwards journal to a remote syslog daemon will certainly be available soon.

> It also reasonably easy to set up a drop safe non-networked logging host > for cracker proof logs. If the journal, or anything else, loses this or > the ability to process the logs without special tools then it is a step > backwards.
Do you mean that it's necessary to install a binary to read journal
files on the host? Doesn't seem to be a problem to me. Or do you mean,
that the messages cannot be forwared to the host (as native journal messages)? This part is in the works, like the article mentions.
Journal actually has the advantage here, that messages from different sources are automatically interleaved in the output, based on their
timestamps, so making sense of messages from multiple hosts is much easier.

> Knowing that your logs have been edited is not enough: as a system admin
> I want to know what was edited out and a drop safe logging host provides
> me with that. Anything that does not support such a box is inferior.
All the parts necessary for that are either already there, or almost. And certainly the quality of log messages matters too, but journal messages
are actually more trustworthy, since the originator is properly identified.


Copyright © 2012, Eklektix, Inc.
This article may be redistributed under the terms of the Creative Commons CC BY-SA 4.0 license
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds