Systemd is not portable and what this means for our ports
people.debian.org
people.debian.org
The distro maintainers package the software for their system. It's therefore also their responsibility to make sure a service can be started/stopped and have its status checked.
It does not matter what kind of init system a distro has. A single Linux distribution is an Operating System independent of all others. There is no one true portable Linux way, much less for non-Linux-based Operating Systems. You have to treat them all as separate because to do otherwise would not only add complexity to a monolithic "portability" system, it would eventually get so complex you'd have to split it up anyway.
Portable software makes 3rd-party software developers' lives easier. But the init system is not managed by 3rd-party developers. It is managed by the OS maintainers. So it does not matter what method they use.
Furthermore, it's fucking Debian, the second-oldest distribution still in release. The oldest (Slackware) holds onto the old ways for as long as technically possible, and they're still going strong. So why the hell they care about being "modern" and "remaining relevant" is anyone's guess.
(disclaimer: I wrote my own init system for my own Linux distribution, and have modified most others)
Oh, wait. I found it. From http://0pointer.de/blog/projects/why.html :
"Specialized professional consulting and engineering services available: yes"
The purpose of a lot of systemd was to say "there are these old utilities based on shell script hacks that would be better served in a Linux-specific framework" like power management, device plugging handling, etc. So they put them under one project. Same way under the Linux kernel is hundreds of megs of device drivers, and a lot of features end up in kernel space (rendering interfaces, networking stacks, filesystems, virtualization) yet nobody calls the kernel anti-unix (some might call it bloated, though).
I'm not sure why our system management tools/frameworks have historically been interpreted scripts. It could be due to the low barrier to entry. Or the dynamic way it can be modified - even on embedded systems - without any tools other than a text editor. Perhaps relying on the infinite possible combinations of simple tools just gave us more power than we could ever get from trying to make libraries for every possible need. Or maybe it was just way simpler to manage.
I'm not anti-systemd, mainly because I haven't used it. But any time someone says "let's replace the old system wholesale" without really REALLY good reasons, I suspect it's premature. It seems really useful for tightly integrated embedded systems, but hell for general admin use.
1. It is noticeably faster. 2. It is braindead easy and intuitive to write service files, and you can write service files or a surrogate for almost any system function from hot swap behavior to load balancing. 3. The entire systemd execution model is fs based, and you have a large library of services to run at your discretion. 4. powerctl is supremely more robust in its usability than pm-utils and shell scripts around suspend / shutdown states.
Only thing that really bugs me is the binary log. I want to pipe it and manipulate it and read it outside a terminal in say, kate, but I have to install syslog on top to do that.
1. Legacy init systems were never tuned for performance. Just look at 'grep sleep -r /etc/init* /etc/rc*' as an example.
2. Easier is nice, but you could write scripts for all those system things using hotplug, udev, and a variety of other things (remember devfs?) I never bothered to learn because they just worked.
3. I'm not sure what you mean here; what execution model is not fs-based in some way? If you mean scripts would execute other scripts based on a filesystem hirearchy, yes, all the old systems did that too.
4. That's nice, but it's kind of irrelevant to how your system initialization/service management works. Different purposes and all.
And yeah, binary logs are dumb without a tool to manage them, but relying on syslog is smart. It's an industry standard. It's the only industry standard for collecting and managing logs from every kind of device, other than maybe snmp (yuck).
> This blog post is the third of a series of posts
> dealing with the results of the Debian systemd survey
Previous posts in the serieshttp://people.debian.org/~stapelberg//2013/06/09/systemd-blo...
http://people.debian.org/~stapelberg//2013/07/01/systemd-tra...
I feel like Linux distros today come with too many crappy, overthought, over-engineered daemons that don't really offer much over the previously available interfaces. I guess parallelizing init scripts or making dependencies more explicit is a good thing in some sense, but I have to say, it's a breath of fresh air to see something like a *BSD system, which has an /etc/rc shell script that is easy to follow. Unlike Linux which frequently seeks out complex solutions from simple problem spaces.
Try doing something like "stop apache". It turns out that trying to simply kill the Apache processes isn't going to work right, as Apache forks out lots of worker processes that won't be guaranteed to be killed when the Apache process stops. And now since the parent has gone away, they're reparented to PID1, so there's all these worker processes littering your system.
systemd uses cgroups to tag every single forked out process with a service file, so that all of the processes associated with a service can be stopped at once.
A lot of things could theoretically be done by putting that all in a sysvinit script. That means duplicating that in every sysvinit script. Bugs galore :P
Maybe you could redo what systemd does by changing those libraries. I very much doubt it though, I also do not see the point of reimplementing this. Systemd way guarantees consistensy, you're proposing something which may or may not work, depending on the init script. Does not seem like a good practice, nor a good alternative to propose. But all means, go for it.
- You're probably going to be starting a new process for handling each event.
- You'll be using the filesystem to store state between events.
- You'll be using helper programs to access various kernel resources.
- To keep such resources around, you'll have to keep the helpers running during events.
Compared to implementing whatever you're doing in a single process with an event-driven design, or in multiple processes with their responsibilities split well, the shell script approach will be orders of magnitude slower and less reliable (the latter due to lots of race conditions).
Debian/kFreeBSD is an awesome idea, especially since FreeBSD's package system sucks and ZFS is unparalleled.
However, I don't think that's the only reason to avoid Systemd.
When I asked about the Hurd of FreeBSD versions of Debian, it seems that stuff has to compile against it. Every Debian maintainer has to already spend a lot of time on it, while the usage is pretty low.
Furthermore, it seems rarely useful. At most in the 'it compiles, but does not run, ship it anyway!' stage.
If people want Hurd or FreeBSD, then why not have them put in a bit more effort? Not like sysvinit will be completely broken.
Deleted comment
I failed to see a reason behind this movement except of the "you're an old fart and this is how we're doing it today" explanation. And when BSD comes up and say this is not portable, everybody say we're on Linux and we don't care and you should jump the shark as we do. What?!
This statement doesn't seem to match the actual controversy, unless it was sarcasm.
BSD or any other kernels are left with no updated userland because they don't implement the same semantics.
Aside from this, standard has nothing to do with Linux only or not. E.g. Microsoft Office is a de facto standard, it only runs on Windows and a not exactly the same version is available on Mac OS. Not on Linux, not on BSD. The file format is a standard.
My only concern would be if the developers flat out said no about going with a more permissive license, although I don't really see why they would do so as it is a program with limited applications outside of its intended role.
What's with the /usr that should be mounted at start? What was wrong with /? And why should initd depend on the kernel?
See http://freedesktop.org/wiki/Software/systemd/separate-usr-is... for a more complete explanation.
There's no equivalent for /usr/share, which some programs depend on. You could make /share, or you could just use /usr for everything and have it available at early boot. Putting everything "system" in /usr/ also lets you make backups more efficiently instead of having to blacklist /home/, /sys/, /proc/, etc.
The initd needs to depend on the kernel. POSIX semantics aren't enough. Even Upstart and SysV init change their behavior based on the kernel.
Furthermore, it makes sense for the responsibility of services to be delegated to one place, otherwise you end up in this situation where programs are started differently from cron than they are from /usr/bin/service than they are from init. It makes sense to delegate all the complex service management and watchdog stuff to one location, and that requires kernel-level semantics. For instance, systemd's use of cgroups allows CGI that it forks off to be killed when it tries to stop Apache.
A la the famous Landley rant from about 4 years ago, I had a NFS mounted /usr... back in 97 as an experiment which I rapidly terminated. Shared and RO /usr is an interesting hack, but probably not worth holding init development back, especially since so many other boot time things demand /usr anyway now (like the pulseaudio, like the networkmanager thing)
If you were aiming more at why systemd needs different stuff, you can google for Landley's email around 2010 on the topic and on the other side google for read only /usr and NFS /usr. Also google for cgroups, especially systemd and cgroups.
BSD should not have to implement Linux semantics just to start the userland.
Unless you're suggesting that developers forcing users to upgrade is bad; users forcing developers to continue providing support for deprecated software forever is good?
> BSD should not have to implement Linux semantics just to start the userland.
If neither BSD nor Linux supported files, and then Linux added support for files, would you suggest that we refrain from making file-based software, and continue giving all apps raw disk access for sake of compatibility?
Using cgroups for service management is that kind of fundamental good idea - the BSDs don't have to copy the linux API, but they should really provide something similar
http://freedesktop.org/wiki/Software/systemd/separate-usr-is...
sysvinit -> systemd = IE5 -> Chrome.
Sure, you can browse the web with IE5; if all your favourite sites work with it and they aren't changing, then you wouldn't see any reason to change either.
Meanwhile, a fairly significant number of people would like to be able to use the features in CSS3 / HTML5 - and while 75% of those features can be emulated in IE5 (with several megabytes of javascript libraries and terrible performance), life is easier and better all round if the users upgrade their foundations once in a while.
> BSD comes up and say this is not portable
systemd doesn't care about the kernel per se, only which features it provides. If they want to provide a cgroups-like API (which they should, because it's a great idea in and of itself), then I expect systemd will be ported to it fairly quickly.
It's different but I wouldn't call it more or less complicated than sysvinit. There are a lot of example/skeleton files floating around, especially archlinux's collection is useful.
Of course, systemd allows for much more configuration than simple running of scripts on boot, but you can fine tune later.
http://www.freedesktop.org/wiki/Software/systemd/Incompatibi...
Now the non-portability of systemd is seen as a reason for Debian to drop the ports.
The only downer is that now there'd be 2 init setups/configs to maintain. But that would be the case even if systemd were not the default, just available as a choice.
For OpenRC, there is just one person advocating it. There is a summer of code thing, but seems not much work is done. Furthermore, OpenRC seems nice, but parallel starting of services is actually experimental/buggy (just ask one of the OpenRC maintainers!). So although you can have a similar boottime, one init system (systemd) will be running in a supported configuration, the other (OpenRC) in something that is known to have issues.
That all said, I don't think Debian really makes decisions. What is being proposed is maintaining two.
Aside from above, there is also the practical bit in that systemd provides something to replace the unmaintained and deprecated ConsoleKit with. This bit can be used on another init system (Canonical is using or will use it on Upstart), but at one point seems easier to rely on the existing systemd supporters in Debian to get things working correctly.
So I hope I won't be forced, to a more crappy system !
The fact that it will be handling a lot of stuff more, sounds like a major pita ...
| the pulseaudio stuff didn't go smooth
That wasn't the fault of the developer so much as it was the fault of the distributions for jumping on the bandwagon (making it the default audio system) too early.At one point I was also able to stream audio from my HTPC to my laptop, so that I could use my headphones when everyone else was sleeping. Though I'll admit configuration was a pain in the ass, I don't recall being able to do that with ALSA (though I recall someone creating a shell script a while back that read from /dev/dsp and piped to a socket).
Prior to PulseAudio, sound on Linux was always an uphill battle for me (don't get me started on regressions in the PowerBook audio driver that no one cared about since "it works on the newer PowerMacs"). It was a crap-shoot which audio system an application would use. OSS? Alsa? eSound? KDE's sound daemon? Do they all use the same mixer app? What happens when I write to /dev/dsp? Does all other audio block? Which applications support Jackd? etc...
[1] Referring to the mic in the pulseaudio context.
EDIT:
> I literally know no other linux users who
> have ever had anything good to say about
> PulseAudio.
I'll mention that the same could be said of OSS or ALSA too. They may have worked better for you, but I doubt that prior to PulseAudio, you were singing their praises from the rooftops.I guess my core complaint is that ALSA could be a pain to get working properly on a new system, but once it was working it didn't usually spontaneously break on me. PulseAudio was only slightly more likely to work out of the box, but was much more likely to break without my making any changes. I guess it's partially a sysadmin mindset, but I usually come down on the side of preferring up-front pain to long term unreliability. Perhaps I didn't use as wide a set of audio programs as you did, I didn't tend to run as many of them at once, or my hardware just had better drivers. For streaming sound (I didn't care about video) I usually stuck to network servers that could shove audio down a Shoutcast or http stream and listening with something like Amarok or MPD, I'm sure PA was nicer if you were trying to relay what your HTPC was playing back.
[ETA: I use linux consoles very heavily when I'm coding on a linux machine, I know this isn't exactly the most common behavior among more recent unix users.]
Sound servers are a modern, I'd argue, necessary convenience for the average joe. API wise, pulse is much nicer to use than alsa (pcm_sink_thing_getbuffer_readhardware_processpcm() x50. I've debugged the sdl implementations of alsa and pulse, and pulseaudio literally takes a tenth the code to use).
It also occurs to me for the first time that the rise of pulseaudio was not that many years after laptops largely switched to integrated codec chips instead of discrete sound and I had all sorts of problems with those above and beyond the "Damn it, give me hardware volume controls" frustrations. It could have inherited some of the problems around quirky/flaky hardware that I remember ALSA facing in that period. At this point I just want something that can reliably play music or take audio input and for whatever reason pulseaudio isn't it for me. Hopefully that'll change before most distros switch to whatever the new hotness in sound setups is...
The movement out of shell-based initscripts for non-specialized (non-mobile/embedded) distributions is a cancer.) Remaining BSD guys are much more sane and "conservative" in this respect.
There is absolutely no necessity to break what is good-enough and well-balanced - having a standard shell scripts to do the job they were designed to. FreeBSD's rc.d system is a very good example.
That is what I see as the main message from your post. If you wonder why people move to something else and your ideas are ignored: try coming up with real arguments ("X is better" is a bit light on details!) and ignore the need to rant about abusrd, cancer, etc.
Besides that, yes, it does have a few things (hostnamed, timedated), which are mostly about some POSIX infrastructure that wasn't there already: notification when the system hostname or timedate changes (yes, it happens quite often on desktop systems, due to NTP, user setting, and VPN). They're just utilities they needed along the way, and systemd can be built without them.
If the system or service fails to start, instead of hunting around in /var/log/, syslog, dmesg, etc. for anything that looks relevant, you simply use the journal which aggregates most everything. It's already a very good breakthrough.
I've debugged countless bad Debian service scripts (which usually comes down to bash's terrible whitespace and quote management), and inserted echo statements into my Arch Linux to debug why it wouldn't boot when I upgraded, hacking out clear statements here and there designed to make the boot pretty. Shell scripts aren't a good solution for robust system and service management.
That other operating system from which the concept of a "service" came from (along with lots of other crap) have different philosophy and founded on different design decisions, so blindly trying to bring stuff from it here is not always reasonable.
And, of course, shell scripts are OK when well-written - there are other UNIX-like systems beside Linux.)
A systemd "service" is just a declarative description of a daemon that allows systemd to start and stop it.
I'm curious if faking cgroups (or heck, porting it) would be an easy solution.
Not talking about a fake cgroups providing all the real world advantages of systemd; merely a a fake not being too much worse than existing sysvinit.
Maybe rephrased actually porting THE cgroups to HURD might be impossible due to design issues or license issues. OK well how about writing a stub cgroups using the API that always gives a pleasant and completely meaningless response to all calls. What, if anything, would be the overall system wide net negative effect of systemd on HURD with a fake cgroups? I have not had much success googling for that.
This would not fix the "my /usr is not on my / partition" problem which is a serious concern to a extremely small number of people.
systemd uses cgroups to tag processes with metadata about services, and to provide resource limits. If you added a stub cgroups, then resource limits wouldn't apply, and you might run into issues with services not fully shutting down as you do right now with the POSIX service management.
It's entirely possible, but you wouldn't get any of the upsides of systemd.
1) /usr split
2) Can't run on kfreebsd and hurd because they don't speak cgroups so either "we" can't run systemd or need to drop ports or need to support two init forever.
You can eliminate #1 with some sysadmin work. A stub cgroups compatible API emulator type thing for kfreebsd and hurd would eliminate complaint #2 if the overall result were not much worse than existing sysvinit.
One interesting solution is there is no particular reason to flick the power switch on kfreebsd over and over as quickly as possible. So one incredibly non-optimized way to "fake" cgroups process monitoring on kfreebsd would be to replace actual cgroup process monitoring with something ridiculous like "sleep 30". In 30 seconds, anything will have started or stopped, correct?
Obviously a dev roadmap would be to replace/emulate/port real cgroup-like support, once people get tired of all cgroups api calls being replaced with "sleep 30".
I can't be the first one to come up with this "great" idea.
I also want to note that cgroups is not the only Linux-specific interface that's necessary for systemd. There's lots of them, and if you stub all of them out, then you've achieved portability with none of the benefits, and have potentially introduced a lot of bugs. You simply make systemd runnable, but unusable.
I think you have the wrong impression of cgroups entirely, though. It does not do "process monitoring". Think of it more like a hierarchical processes tree. With a traditional hierarchical filesystem, to recursively delete everything in a folder, you use a combination of readdir and unlink. In cgroups, it's similar: you put processes in a "cgroup", and to kill everything inside a "cgroup", you iterate over everything and call kill.
And much like in some filesystems you can say "make sure this subtree doesn't go above 1GB of storage", you can apply similar resource limits to cgroups: "make sure this subtree doesn't go over 2GB of memory and 25% CPU time", etc.
A stub interface that doesn't iterate over any of the processes won't really do you much, and thus when you try to stop a service, it won't get shut down.
This has been clarified a great number of times, also by Lennart. If you're against systemd because of /usr, you're not against systemd :D
Since systemd is written in C, the canonical way to write portable code is by using conditional compilation, for example with ifdef statements. That makes the code harder to understand and reason about, but more importantly it blows up the test matrix."
Take a page from NetBSDs effort... http://www.netbsd.org/about/portability.html
How will this work? In the short-term future, maintainers add systemd support to their packages. This does not imply dropping sysvinit support. As outlined in my post about the transition, systemd service files can coexist with sysvinit scripts. In the mid-term future, both sysvinit and systemd are supported — this is the only way we can do a gradual transition, and Debian clearly does not want a flag day. In the long term, we could switch the default from sysvinit to systemd on Debian GNU/Linux, in case we agree that’s a reasonable decision at that time. Non-Linux ports will still use sysvinit.
We can argue over the exact meaning of "switch to" (seems pretty pointless to me), but it seems fairly clear that in the near future nearly all debian users will be using systemd.
This is a blog post by a Debian developer that would like the project to switch the default init system. It includes some discussion of how Debian could make the transition. It's nothing the project has committed to, so saying "that in the near future nearly all debian users will be using systemd" is unwarranted.