by aniou · 2w ago · 0 comments
Meanwhile, on systems where I don’t use systemd, the entire initialization process can be displayed in about 30 lines on the screen - and I don’t have to wade through a chaotic web of dependencies, some of which are even auto-generated. As far as I can tell, I currently have about 350 of them active.
Boot times were supposed to be fast, too - yet, curiously enough, systemd often ends up saying, "waiting 1m30s for..."
wouldn't that be the fault of the service it's waiting for and not systemd itself?
On one side, you have shell scripts that are generally pretty simple (FreeBSD’s init is something like 1000-2000 LOC for the implementation, and a simple service script is tens of lines).
On the other side, you have a monolith that hit 1.3 million lines of code a few years ago, and has gotten more and more complicated since then.
Assuming the waits are not a bug, then they are a misconfiguration. When I gave up on using it, the manual was long, incomprehensible, and the small documented fraction of systemd’s behavior didn’t match the manual.
Just a nit, that 1.3 million lines was reported incorrectly. You can see some talk at https://news.ycombinator.com/item?id=21935186 and I remember a Poettering tweet saying that was including things like documentation. At the time systemd was under 500k lines; still big but not quite so huge.
I'm also not sure if that count was for the full repository (which contains multiple modular projects like systemd-resolved that are not required for systemd) or just the actual systemd bin.
systemd suffers from the lack of systemic design, but it's still way better than the pile of scripts that it replaced.
https://github.com/openbsd/src/blob/master/usr.sbin/rcctl/rc...
Then you got the initialization script
https://github.com/openbsd/src/blob/master/etc/rc
Service file can be very small
https://github.com/openbsd/src/blob/master/etc/rc.d/httpd
Powered by
https://github.com/openbsd/src/blob/master/etc/rc.d/rc.subr
Also daemon(3) for running as a system service
https://man.openbsd.org/daemon.3
And no need to track pid. It uses pgrep with the flags and the program name by default. I believe OpenRC does the same.
https://github.com/openbsd/src/blob/f5d74fd467fccdfc60b450a7...
If by "every program" you mean "your init system", then sure. For example, OpenRC predates systemd by several years, can manage both forking and non-forking services, [0] and supervise non-forking programs with no PID files required.
[0] It even handles both s6 and systemd-style socket-based readiness notification.
I was strongly disappointed and shocked when I realize that Lennart was not able to write something like "my solution is better or comparable to daemontools, because".
Yep. For me, it's most often a 90 second delay that comes from the combination of the automagical conversion of fstab entries into services, an NFS mount in fstab, and an offline NFS server.
Sane init systems notice that this is a networked filesystem (I've even marked it with the _netdev option!) and don't hang the boot for a minute and a half screaming at a dead server. Systemd is anything but sane.
You're probably thinking of OpenRC. It's quite nice and remains the distro's default init system.
To be honest, from very beginning I viewed both (upstart and systemd) as dead-ends. Dependencies? Meh, rcorder in NetBSD has local dependencies years ago and, for larger installations, local-only dependency system has no value - because my app needs mysql... on another server. And modern init and supervision suite (systemd) without concept of inter-network dependecy? Meh. Like... let me think... a project of modern desktop without concept of remote work in eve of remote work explosion and covid times too - or something like that.
Supervising? I already had daemontools, monit, runit and whatever else (not mentioning s6) - even nowadays I really don't see cases, when systemd is used to restart services automatically.
Sure your web server "started" 5 seconds after boot, in that a PID now exists for it, but that doesn't mean it will serve a web request if dhcp hasn't finished yet. `/etc/init.d/nginx status` tells lies on those old systems.
> retry loops when a server starts in case binding the socket fails, or if a configured network interface/directory doesn't exist
FYI, you can change all of that pretty easily.I think the issue is systemd takes the stance of the "safe" route first, which is not really necessary for most personal machines and not the greatest when people are using mostly flash. But a 90s timeout makes sense if you are loading a 20TB hdd (I've even seen longer load times on much smaller drives)
> Boot times were supposed to be fast, too - yet, curiously enough, systemd often ends up saying, "waiting 1m30s for..."
I'd wager that that's your disk drive being slow to boot.Either lazy load that drive or change to faster media like a ssd or nvme.
My guess is because that's the default timeout for disks
Stuff the same amount of functionality into whatever 2000s style boot mechanism you use, and you'll be waiting just as long (you'll just need to make your you add ample `sleep` calls to make sure the network is up before your web server can bind, or accept that your system boots up flaky perhaps).