126 points · by marcodiego · 5y ago · 234 comments
I'm not a sysadmin, so I never really felt the hate against systemd. For my use cases it was always not exactly transparent; it was essentially invisible.
systemd-as-init was fine. systemd replacing udevd, syslog†, mount, ntpd, DNS, dhcpd, and probably a bunch more stuff I've forgotten or don't know about, is something else. If I wanted a tightly-coupled opaque binary blob of a system I'd run Windows.
† Of course its log file is not ACID, so when it poops its pants and corrupts the file there's no way to recover it besides moving it out of the way. Though the log entries on why this happened are also corrupted so there's no root cause analysis.‡ They could have just used SQLite as the logging format and it would have probably been awesome with regards to tooling and doing queries (instead of grep-foo). But no.
‡ And journald also cannot send logs off-host in any useful format, so I end up having to run rsyslogd anyway to get things into my SIEM through something useful like RFC 3164 or 5424.
But yeah: unit files are (non-sarcastically) pretty good.
I also have a problem with socket activation. There is a reason why (x)inetd fell out of favor - its whole purpose was to provide socket activation. It's a hack that can produce new error states and it can actually slow down startup compared to starting services proactively.
That said, the OOM killer daemon seems to be a good thing.
These are separate services, with separate binaries, with separate packages for most distributions and their use is optional; they have their uses. For example, most distributions won't use systemd-networkd, because it is (intentionally) quite limited and they use NetworkManager anyway. RHEL8 for example doesn't even ship a package systemd-networkd.
I'm not an expert. I'm just a software dev and free software nut who wants a free software OS.
But (serious question), why does it matter that systemd has an ntp daemon or that it subsumed udev?
You say, disparagingly, that it is tightly-coupled and opaque (binary).
Why is loosely coupled better in these cases specifically?
Weren't `mount`, `ntpd`, `udev`, etc all compiled C code already? How does systmed make those service more opaque?
Everyone seems to hate journald. I'll go ahead and join in the chorus and say that it sounds really bad. But do we have to throw the baby out with the bath water? What else about systemd is actually worse than what we had before?
When current journals are detected as dirty by journald @ startup, they are renamed and no longer written to. This is a very robust and conservative approach. It burns some space in the interest of simplicity and preserving the log data without risk of messing things up.
These renamed journals are still accessed when reading, so it's not like those dirty files no longer participate in journalctl operations; their contents are not lost.
Any logs lost in a crash are just what was in-flight IPC, or sitting dirty in the kernel's buffer cache and hadn't been sync'd to backing store yet. Journald also performs an explicit sync whenever an urgent message arrives, to try ensure it's made durable ASAP. Of course there's still a filesystem and potentially myriad layers below that which could lose data in a crash.
ACID would be overkill for this fairly simple single-writer multiple-reader mostly-appended situation.
Edit:
Your statement "when it poops its pants and corrupts the file" implies journald has a tendency to actively corrupt its own files.
The principal mechanism journald uses to detect potentially corrupt files is simply identifying a file as being ONLINE when opening for writing, typically at startup. This is almost always caused by an unclean shutdown of the host, though it could be due to a crash of journald itself.
The file isn't even necessarily corrupt. It's simply assumed inconsistent and treated as such WRT writability. I'm not aware of any journald bugs in recent history where journald actively corrupted the contents of journal files. Even crashy bugs where journald was littering dirty journals to be treated as corrupt I'm not aware of being actually corrupted internally by journald bugs.
Source: I've worked quite a bit on journald over the years
I personally like service managers more that have clean shell scripts such as runit or OpenRC where shell scripts more so look like this:
#!/usr/bin/openrc-run
depends="some list of services to depend on"
after="some list of services which need to start earlier"
cmd="/path/to/executable"
args="command line arguments"
The nice thing is that it's a shell script, so each of these lines can be defined conditionally.I actually like journald quite a bit. Before, you'd have log files scattered all over the place with various cronjobs to try to keep them from filling up the disk (usually with the help of logrotate). Each application was free to put its logs wherever it decided.
Journald keeps them structured with first-class support for metadata like timestamp and unit so it's easy to get a service's logs in a 2 hour window on a given day and equally as easy to look at them in a stream with other service's logs (it aggregates them for you). From an application perspective, you just dump to stdout/err.
>And journald also cannot send logs off-host in any useful format
This seems directly at odds with your "tightly-coupled" beginning statement (you want it to do more or you think it does too much?). It's trivial to do this with fluentd or other log aggregation software
Tell me, a naive one, why a throwaway for this?
(1) It's a "god object" at the system level, rolling massive amounts of functionality into a single monolithic "system manager." There are advantages to that, but it also makes it impossible to strip away complexity and leads to the core system becoming really bloated with functionality. That's the road Windows took that made Windows such a mess of cruft.
(2) Poor UX... it's obtuse and counter-intuitive. This is my biggest gripe. It replaced a hard to use ball of shell scripts with... something even more confusing! Every command seems designed to be hard to remember and clunky to type. Common tasks are "undiscoverable" in that you have to search docs to figure out how to do the simplest things. Git has this same problem by the way, but to a somewhat lesser degree.
Those shell scripts never had to be cumbersome. The BSDs, for example, do away with a lot of that complexity and boilerplate quite nicely via e.g. rc.subr and rc.conf.
Basically change aversion, and a misguided idea about the "unix way".
Solving problems in multiple different ways is the only reason we have multiple distros serving different needs. Unification is not always a positive thing.
Also, just look at the before-systemd landscape, there was much more difference in the repositories, and nowadays even more niche distros can trivially package almost everything since .service files are unified. Also, they are quite flexible, so I don’t feel that anything would be lost.
True, but desktop usage is only one of many things linux is used for. All the "unification" efforts ala systemd try to handle all of those use cases. I don't see why the init system on my server has to be the same as the one on my ultrabook, because only a fraction of what they should do is shared. Having one tool that covers all the use cases just sounds like a very good way to increase the attack surface.
> I believe there are only a handful of people who knows enough to create a proper init system (similarly, sound and graphics) and do it for the community.
I don't think Linux graphics or sound situations have much in common with the init system situation, except perhaps the fact that Poettering tried to fix sound as well.
I switched from Windows to Linux 20 years ago to have more choice.
Just like you can mostly expect filesystem behavior to be consistent no matter which distro, so should be the OOM behavior if a "good" solution is found.
The same thing goes for out of memory handling: no size fits all. The kind of handling strategy you need depends on the kind of system you build.
Exactly this kind of flexibility and lack of unification is what made Linux so ubiquitous.
Except with the monoculture of systemd how can experiments be done with other approaches? Nowadays it seems like "use systemd or GTFO".
> Just like you can mostly expect filesystem behavior to be consistent […]
And how many file systems does the Linux support? One can try an approach and see how it works and others can perhaps copy it.
How does another approach towards OOM (or anything else in the kitchen sink that systemd handles) get traction when the 800lb/400kg of RH/IBM is bankrolling The One True Way™.
On a system where the primary API is the shell, initialising everything with a sequence of imperative shell commands makes a lot of sense.
It would’ve been cool to have functions that supported dependency in the scripts themselves. A web server would have a call to...
init_wait_for networking
...which blocks until some higher level networking script calls: init_ready networking
...but the standardised LSB header magic-comment stuff was also fine when it came to handling dependencies.Doing all this with INI files is very clever but it’s always felt very NIH. Good solutions solve existing problems without rewriting and embracing everything from the ground up.
Getting it right in serial fashion is fairly easy, but since systemd insists on doing as much as possible in parallel you really need to have every dependency correctly configured (which is not always that easy to get right if things take a couple of seconds to get going..).
That being said, I really wish there was more interest from the systemd folks in interoperating with containers and registries and all things OCI in general. Like the portable services they introduced in 239, the storage for the system extensions introduced in 248 is backed by either a directory or a disk image; meanwhile, there's an entire ecosystem of tools in the container world dedicated to the storage and distribution of root filesystems that they seem to be completely ignoring. I know there's nothing stopping me from using `umoci` or some such to pull and unpack a container and use the resulting directory as either a system extension or a source of portable services, but it'd be a lot cooler if that kind of functionality was baked in.
No argument there (even though declarative programming languages aren't universally favored over imperative ones), but why does this come up so often? On a typical Linux desktop or server there are hundreds, if not thousands of packages installed, yet only a few dozen init scripts. Almost no tool or application is typically run as service requiring such.
Just the dependency resolution features alone make it fantastic. It's only a few lines to specify a network dependency, a filesystem dependency, another service dependency, timeout and retry behaviors, monitoring and alerting on failures, etc.
Plus it goes beyond just init. The scheduling features mean I'm turning to it instead of something like cron for doing repeated tasks on a server. Again, there's just a bunch of quality-of-life improvements there, like dependencies, better and more granular logging, error reporting, retries with limits, etc.
I build embedded systems and appliances; it sounds like you might have to deal with this a lot less frequently than I do. I don't have to deal with it as frequently in the age of systemd though, because more projects are providing unit files now that it's everywhere, and it's a lot easier to glance at a systemd unit someone else wrote and decide if it's correct than it is to audit a random shell script and figure out what needs to be added or changed to get it to work correctly in your distro of choice.
That'll be the case. When I did work on an embedded system (enterprise storage system) different groups worked on different services (and some used hair-rising shell scripts to start their service), but our team's service was started via xinetd and we didn't spend all that much time on that aspect.
Yes you can argue it's the distros decision, but that ship has sailed and fairly soon there won't even be an effective choice.
A bit of a niche use perhaps, but seems to be very useful to me. And it's good that it's in systemd because otherwise you'd have to hack the boot process of every distro you might want this in.
And I wouldn't say it wasn't broken, it's just a need you personally didn't have. I do actually have this need in a virtualization context, and may well making use of it.
Also, FreeBSD wouldn't work. We use many Linux specific features, and I have no interest whatsoever in porting all that stuff to BSD for no gain in functionality.
Also, I see no issue to somebody else solving my problems and not needing to write more stuff that's unrelated to the actual purpose of what I'm doing.
How is it anything like Windows? You're honestly, without bad faith, comparing it to a closed source operating systems that has telemetry enabled by default and forces you to run system updates?
I have no idea what systemd-oomd is, but from a cursory reading of the article I can tell that it's a .service, and from the description that it's a "userspace out-of-memory (OOM) killer". So either this service will (worst-case) be enabled by default, in which case I presume that you can disable it or mask it completely like any service, or (best-case) it will be disabled by default, in which case I really don't understand why it matters.
In addition to systemd fully allowing you to disable and re-configure much of its functionality, it's also fully open source. You can re-build it however you want, if you want to use it in another manner. This is what passes for being reminiscent of Windows?
And as the scope continues to increase, you're still either all in or all out.
As the distros fall into line, you're either all in or all out.
Try and not use systemd, and then tell me it's not a problem. I think it's honestly easier to not use windows at this stage. The BSDs (love them as I do) just don't have the clout or the support for many day to day developer needs.
This is not the case with systemd. Although these projects live in the same repository, distributions can pick and choose them depending on your priorities.
Granted, this is obviously not something most end users come in contact with and even know since very few people actually build distributions. As an end user, ripping out a core part of a distro to replace it is always a painful experience. Regardless of whether that component lives in the systemd repo or somewhere else. Systemd actually makes ripping out core parts easier, which is why arch adopted it so quickly, but that's another story.
You're just throwing vague and incorrect statements out there, sprinkle "Windows" on top in the hopes of eliciting an emotional response.
Is this not a fact, versus a mere argument?
Do you think the decision is not based on merit? b/c there's all the effective distros switching, versus you saying nothing is broken - one of you must be wrong?
Maybe the Linux ecosystem is broken, you just can't say it because you've already adjusted you expectations, or solidified your use case(s)?
Honestly the whole thing made me more or less give up on open-source as a development model. Good programmers are expensive, especially if you want them to do the boring maintenance work, and that funding has to come from somewhere. The "give the program away for free and sell consulting" business model works up to a point, but it distorts maintainers' interests away from what would actually benefit the majority of users. While I do blame RedHat, the real problem is that no-one except RedHat is paying people to work full-time on GNOME or any of dozens of similarly important projects (KDE seems to be mostly funded by the EU, which is a much healthier model, but I don't know if you could make a whole distribution from projects like that).
Having been born during 70's I also saw all those ideals turn into business people the following decade.
It is easy to be idealistic when others put in the money.
* systemd-cryptsetup gained support for unlocking LUKS2 volumes using
TPM2 hardware, as well as FIDO2 security tokens (in addition to the
pre-existing support for PKCS#11 security tokens).
that's really interesting. i'd have to look at the details, but it could mean we could have encrypted disks and have a machine boot unassisted.I'm gonna try it out once my Solo V2 arrives.
Granted, in case of theft, the computer will boot up if nothing is done to it. But in the case of a "user" computer where no services are listening, the risk is relatively low. In order to get access to the decrypted disk contents you'd have to exploit some vulnerability in Linux and / or the login manager.
People need to be aware this can happen when using it and should remember to add a password key to their luks container.
That has been possible (without TPM) since about 2009: Shameless plug: https://www.recompile.se/mandos
Somebody has got to stop systemd from unilaterally fucking up every Linux distribution's design with their wacky features. Only /opt and /usr? Because no other directories might need/want an overlay? And why the fuck can't we just use a regular overlay fs? To say nothing of it actually breaking the expectations of users and operators ("In addition to your existing huge troubleshooting checklist, see if systemd is silently injecting fake files into your process's path")
When the hostname is set explicitly to "localhost", systemd-hostnamed
will respect this. Previously such a setting would be mostly silently
ignored.
:-|This whole thing is designed like Kubernetes. Come up with a bad design, then hack in random functionality to make it as complicated as possible to use.
systemd-networkd, systemd-resolved, systemd-timesyncd, systemd-udevd, systemd-journald, systemd-logind, systemd-nspawn, systemd-cron, systemd-notify, systemd-container, systemd-boot, systemd-oomd, systemd-mount, dbus, ...
and oh good --json logging support is available everywhere. nice SYSTEMD_COLORS supports new 16 and 256 options for all these tools. my entire system will work much better. with high consistency.
this whole monorepo (not monolith) thing is working out.
There's a bunch of discussion of systemd-oomd and a bit of discussion of systemd extension images. Much of it is even calm and technical.
Edit: I guess if you have multiple services from multiple vendors that nevertheless agree to some common base image, it makes sense for those services to use `ExtensionImages`. Eg multiple services that all require a libglib base image. A Portable Service can expose multiple services from a single disk image, but that's the point - the vendors have to build a single disk image with their services.
[1]: https://github.com/systemd/systemd/blob/main/docs/PORTABLE_S...
I sometimes wonder why we even install stuff - mount it it in from remote with some kind of caching system, and you'd always have the latest, like on the web. Slap a delta algorithm on top, and it could even be more efficient.
This is not to say that there's no value in freezing stuff and staying in control - there is - but ideally we would be able to choose.
[1]: http://0pointer.net/blog/projects/stateless.html
[2]: http://0pointer.net/blog/revisiting-how-we-put-together-linu...
[3]: https://www.freedesktop.org/software/systemd/man/sysusers.d....
And I agree: one could use systemd-sysext with something like rpm-ostree to create very robust systems with selective immutability.
Think of them as the "app" part similar to mobile OSes; fedora silverblue/rpm-ostree/systemd-extensions as the "system" part.
https://www.freedesktop.org/software/systemd/man/systemd-sys...
Is there a document somewhere that shows what the systemd team thinks is a functional boundary? What things they don't plan on replacing?
People all the time complain about systemd bloat, but it's very likely that in those languages it would be far worse.
1. makes very common usecases needlessly hard for beginners (e.g. run something on boot)
2. is sometimes the opposite of self explainatory
I use systemd and am OK with it and I aggree with the problems it is trying to solve. It is just a bit convoluted and intransparent even after years of using it.
The biggest problem I remember now is that when testing your init script it picks up environment variables from your root shell. So, because of that it works when it shouldn't, and realizing what's missing is a big debugging nightmare. The systemd init starts every unit in the same environment.
Another one that resulted in hours of fun fixing it is init scripts happily starting services even when various filesystems failed to mount. Like /var. Getting those particular database files back in sync after the / filesystem filled up was a nightmare.
Systemd has pretty good documentation and I think it is a feature that its users are pushed to read it, rather than hacking out a shell script that doesn't use half the already existing functions because the author never bothered to read RedHat or Debian docs.
And if you just want to start a gui, Gnome Tweaks has a page which is super simple.
Ah yes, systemd unit files are well regarded as far more complex than shell scripts that are 99% boilerplate. /s
Actually, unit files are possibly the only part of SystemD that I've knowingly interacted with - I know it does about a thousand things, but whatever those other things are, they are transparent to me as a user.
...the 90s. So it's too late to change them. We should definitely be considering safer languages in 2021.