My thoughts on systemd
October 4, 2014 1 Comment
When I first read about systemd a few years ago, the main ‘marketing point’ seemed to be that Linux boots faster using it rather than SysVinit — see, for example, On to better booting. When I read that article back in September 2012, a paragraph caught my eye:
It looks like the crowd lining up behind systemd is growing fast. With Fedora, OpenSUSE, Mandiva, Arch, Debian, Gentoo, Frugalware — Did I forget anyone? And RedHat will probably be joining with the release of RedHat7. Ubuntu seems to be sticking with Upstart.
As a Gentoo user I was surprised to read that the distribution was ‘lining up behind systemd’ — systemd was not even mentioned in the Gentoo Handbook — so I started a thread in the Gentoo Forums enquiring whether there were plans to change the default init system from OpenRC to systemd: Gentoo ‘lining up behind systemd’?.
Revisiting that ITWorld article two years later, I notice the paragraph was subsequently changed, as it now reads:
It looks like the crowd lining up behind systemd is growing fast. With Fedora, OpenSUSE, Mandiva, Arch, Debian, Frugalware — Did I forget anyone? And RedHat will probably be joining with the release of RedHat7. Gentoo has its own next generation rc system called OpenRC, which competes with both systemd and upstart, but provides its users with the option of installing systemd. Ubuntu seems to be sticking with Upstart.
OpenRC works fine for me; I know how to use it and I do not particularly want to have to learn how to use another system when what I use now works perfectly well for my purposes. By no means do I begrudge others the use of systemd, as long as my freedom of choice is not curtailed. Each to his own, as the saying goes. But events over the past couple of years have left me wondering about my freedom to choose in the future, and indeed about the future form of the operating system itself.
As I mentioned above, the main marketing point when I first read about systemd was its boot time. When I tried systemd in May 2013 on a 2009 Acer Aspire 5536-643G25Mn laptop (dual-core CPU; 3 GB RAM) — no match for today’s state-of-the-art hardware — the times to boot from the GRUB 2 menu to the DM login screen for a fully-updated 64-bit Sabayon Linux Xfce installation were as follows:
|OpenRC with rc_parallel=”NO”||33 seconds|
|OpenRC with rc_parallel=”YES”||31 seconds|
I posted the above timings in the Sabayon Linux Forums and the developer of the distribution responded:
speed improvements heavily depend on the CPU and I/O subsystem. In particular, systemd is able to leverage multi-core CPUs much better (because it spawns services in parallel). Spawning services in parallel also puts more pressure on the I/O subsystem, which means that if you have faster I/O (like with SSDs), the speed boost compared to OpenRC becomes quite relevant.
Indeed a few users of newer machines with 8 GB or more RAM and/or SSD drives wrote in the Sabayon Linux Forums that their boot times had almost been halved (e.g. from circa 40 seconds to circa 21 seconds). However, I expect the boot times for OpenRC and systemd would not be dramatically different from each other on any of my existing machines and, in any case, I’m not bothered about saving a few seconds in boot time on my machines (and I don’t reboot often either).
Nowadays one hears less mention of faster boot times from systemd proponents. For example, the author of the December 2011 article Here We Go Again, Another Linux Init: Intro to systemd mentioned ‘Faster Startups’ early on, whereas in a September 2014 article Understanding and Using Systemd, the same author states:
For whatever reason, it seems that the proponents of SysVInit replacements are obsessed with boot times. My systemd systems, like CentOS 7, don’t boot up all that much faster than the others. It’s not something I particularly care about in any case, since most boot speed measurements only measure reaching the login prompt, and not how long it takes for the system to completely start and be usable.
Erosion of choice?
A couple of Gentoo developers commented in the above-mentioned 2012 Gentoo Forums thread that adoption of systemd as the default init system in Gentoo would be extremely unlikely. Several posters pointed out that alternative init systems exist and Gentoo users could simply install an alternative if desired. However, I started to wonder about the long-term availability of choice when I began to see blog posts such as Red Hat Flag and, indeed, when I myself was affected by systemd’s subsumption of udev (see e.g. udev is doomed) earlier this year and, more recently, when a Gentoo developer had to create the package
upower-pm-utils because systemd subsumed hibernate & suspend support from
upower (UPower 0.99.0 was released to ~arch as of 2014-06-01).
Whatever one’s views on systemd, the impact on non-systemd users when systemd developers change something that previously worked fine is frustrating. Gentoo developers have been doing a good job working around such nugatory subsumptions, but it’s extra work for them and extra effort for the Gentoo user who doesn’t use systemd. I began to wonder how long this state of affairs could continue.
Another layer of abstraction?
Although my main laptop has Gentoo installed with OpenRC, on a couple of other machines I tinker with Sabayon Linux, which uses systemd. Sabayon Linux is pre-compiled Gentoo with an overlay and its own binary package manager, so there is some synergy in using the two distributions. Also, it is clear from several threads requesting help in the Gentoo Forums that a number of Gentoo users are migrating to systemd. In answering or just reading forum posts involving systemd, and in writing blog posts of my own explaining how to use systemd for certain tasks, in some cases it feels to me as if systemd sometimes adds a layer of abstraction that is not necessarily helpful. Two examples that spring to mind are given below.
- The Gentoo Forums thread [SOLVED]I don’t understand transient hostnames in which a Gentoo user using systemd was trying to stop the hostname being changed when he connected to some networks:
I’m running a systemd based system for the first time and I’m having an issue with my hostname. Basically, when I connect to (some) networks the network assigns me a transient hostname. This transient hostname seems to completely break everything with my desktop manager (KDM). I have to log out, and then log in with the new transient hostname (which is presumably assigned shortly after I log in and network manager connects to the network). Is this expected? I have set my hostname as described in the handbook and the systemd wiki page. How do I make my hostname *never* change based on dhcp crap?
After I pointed out that it is possible to force a persistent hostname by specifying the hostname in
NetworkManager.confif NetworkManager is being used with either systemd or OpenRC, he wrote:
My hostname is now written in 3 places (/etc/hosts, /etc/hostname, and /etc/NetworkManager/NetworkManager.conf). Oh, and I have some random executable (hostnamectl) sitting on my system doing a seemingly poor job of ‘controlling’ my hostname.
Out of curiosity I then experimented with hostnamectl and compared the outcome with the outcome of setting the hostname in an installation that does not use systemd, and the results differed, so I’m not sure of the scope of hostnamectl.
- Time (Arch Wiki)
The hardware clock can be queried and set with the timedatectl command. To change the hardware clock time standard to localtime, use:
# timedatectl set-local-rtc 1
If you want to revert to the hardware clock being in UTC, do:
# timedatectl set-local-rtc 0
These will generate /etc/adjtime automatically and update the RTC accordingly; no further configuration is required.
During kernel startup, at the point when the RTC driver is loaded, the system clock may be set from the hardware clock. Whether this occurs depends on the hardware platform, the version of the kernel and kernel build options. If this does occur, at this point in the boot sequence, the hardware clock time is assumed to be UTC and the value of /sys/class/rtc/rtcN/hctosys (N=0,1,2,..) will be set to 1.
Later, the system clock is set again from the hardware clock by systemd, dependent on values in /etc/adjtime. Hence, having the hardware clock using localtime may cause some unexpected behavior during the boot sequence; e.g system time going backwards, which is always a bad idea (there is a lot more to it). To avoid it systemd (>215) will only synchronize back, if the hardware clock is set to UTC and keep the kernel uninformed about the local timezone. As a consequence timestamps on a FAT filesystem touched by the Linux system will be in UTC.
Note: The use of timedatectl requires an active dbus. Therefore, it may not be possible to use this command under a chroot (such as during installation). In these cases, you can revert back to the hwclock command.
Swimming against the tide?
There have been a number of dissenting voices on the Internet. Some argue against systemd on technical grounds, others on philosophical grounds. Here are are few examples:
One of the few distributions bucking the trend is Void Linux, which has replaced systemd with runit as the default init system, with systemd becoming an option.
Slackware and Gentoo are two distributions that do not use systemd by default, although it is actually reasonably straightforward to switch to systemd in Gentoo. It seems one or two people are moving to Gentoo, or contemplating it, because systemd isn’t the default in Gentoo (see, for examples, Re: OT: Open letter to the Linux World and IgnorantGuru’s Hiatus).
Several threads in the Gentoo Forums contain prolonged discussions on systemd, and it is clear that some Gentoo users have strong reservations about systemd. As I write this, a poll in the Gentoo Forums shows only 13 per cent of respondents support the idea of Gentoo adopting systemd as the default init system. I suspect that users of binary-based distributions find this lack of enthusiasm odd, but I believe it is because Gentoo is a source-based distribution and its users are usually more familiar with Linux internals and more comfortable, more adept and more interested in getting ‘under the hood’ than are users of binary-based distributions. Gentoo is not quite Linux From Scratch, but Gentoo users build their installations almost from the ground up (Gentoo does not even have an installer application, for example). I believe that anything interfering with the current way of doing things, or adding a level of abstraction, is not of interest to many Gentoo users. On the other hand, I think users of binary-based distributions who just want to get something done in the quickest way possible are less likely to object.
The beginnings of a new OS?
systemd is not just an init system, it has grown into much more than that and continues to add functionality (referred to by some as ‘feature creep’). Below is the current list of functionality provided in systemd, and the list is growing.
init system, journal logging, login management, device management, temporary and volatile file management, binary format registration, backlight save/restore, rfkill save/restore, bootchart, read-ahead, encrypted storage setup, EFI/GPT partition discovery, virtual machine/container registration, minimal container management, hostname management, locale management, time management, random seed management, sysctl variable management, console management, network management, time synchronisation
I think more of the seasoned GNU/Linux users are waking up to the impact of what Lennart Poettering (the chief architect of systemd) and his fellow systemd ‘cabal’ (his word) members are doing. They are re-designing GNU/Linux from the ground up, and I don’t think it would be an exaggeration to call the end result ‘systemd/Linux’, a de facto new OS. Personally I’m not interested in using that, but I think the vast majority of existing users or newcomers to ‘Linux’ — to use the popular term for the OS — simply don’t care. As long as it works out-of-the-box, that’s all that matters to most people.
And as far as distribution developers are concerned, the status quo says it all: most have already switched their distributions to systemd or have committed to doing so in the future. I suspect it is because they see systemd as being easier to maintain, thus making their lives easier, and they also see systemd as being easier for their desktop users (and with a boot time closer to Windows 8/8.1 Fast Startup). Ultimately the systemd ‘cabal’ will effectively make the different package managers obsolete too, as the latest plan Revisiting How We Put Together Linux Systems shows.
In my opinion, the end result of the radical systemd redesign of the OS could be greater take-up of the OS on the desktop, but the distinction between distributions will lessen and many will cease to exist, as there will be little point choosing one over another. The greater commonality and the larger user base of systemd/Linux will attract more crackers than at present. In some respects the de facto new OS will be much more like Windows or Mac OS than the current GNU/Linux.
Widening the net?
In a Chromium OS discussion group thread earlier this year — The future of initsystem in Chromium OS — a systemd proponent (a Fedora developer?) offered to help the Chrome OS developers switch from Upstart to systemd, but the Chrome OS developers saw no reason to do so without proof of tangible benefits. I believe there is too much revenue at stake to risk switching an important component of the OS of a commercial product (Chromebooks) on a whim. With Chromebooks looking increasingly like the main threat to Microsoft’s hegemony on the desktop, I’m sure Google has no interest in jeopardising that without a very good reason.
The future seemed clear to me once Mark Shuttleworth announced Ubuntu would drop Upstart and adopt systemd (he made the announcement after Debian developers decided to adopt systemd). Given the number of Ubuntu users (I’ve seen figures in the tens of millions bandied about), I believe Ubuntu will be the making or breaking of systemd. In my opinion, as was the case with PulseAudio (another Lennart Poettering project) there will be a couple of choppy years with plenty of posts in the Ubuntu Forums seeking help, more bugs will be shaken out, and I believe the vast majority of Linux users will end up as accepting users of systemd. In some cases systemd does make configuration a little easier for a newcomer (see, for example, my post Configuring the Linux clock). Personally I find systemd no easier to use than what I use now; in some cases I find systemd more complicated than what I use now (e.g. OpenRC’s local.d). My concerns regarding abstraction, subsumption, loss of choice and the morphing of the OS into something closer to the Windows approach remain, although I can see that many people, including newcomers to Linux, would actually welcome those things. Ironically, although I used to get frustrated with the large number of Linux distributions and their differences, the implications of greater commonality now worry me from a security (predominantly cybercrime) point of view. I am satisfied and comfortable with the existing GNU/Linux tools, configuration files, modus operandi and OpenRC (which works with no problems whatsoever in my case), so I have no desire to migrate to systemd on my main machine running Gentoo Linux. I will also continue to tinker with Sabayon Linux, and thus with systemd, but it will be several years hence before this jury returns a verdict on systemd.