4 ms·
I don't think the idea of systemd is wrong. Long time ago out of curiosity I decide to learn how the boot process works and examined the code. It turned out, th
by codedokode 4y ago
I don't think the idea of systemd is wrong. Long time ago out of curiosity I decide to learn how the boot process works and examined the code. It turned out, the init system was written as a bunch of shell scripts.
Its creators probably tried their best to write it, gave functions good names, left comments sometimes, but still it was bad. Running several subprocesses to split a string into parts. Parsing text output of subprocesses. Creating unnecessary temporary files.
This style of programming leads to extremely fragile systems. If the command slightly changes its output, scripts will break. If the command output depends on locale, scripts will break.
Futhermore, there is no sane options for error handling in shell scripts. There is only a relatively sane option - crash on any error and an insane option - ignore any erros and continue. For example, we failed to backup a file, but ignore this error and delete the original. No way one can write something reliable using such tools.
So if you want to write an init system, I think there are better languages that a shell script. It is difficult to build a graph of services and find an optimal sequence to start them using shell scripts. Or implement lazy startup of non-critical services.
Init system is not only a program to boot the system, but it should provide some runtime services, like management of background processes, logins and other things. Again, a properly written daemon with an API is better than a bunch of shell scripts.
Regarding languages, I am not sure if C is good for this purpose, it's pretty awful too. To illustrate this, consider a C function declaration:
int set_working_directory(char *new_directory, char **error);
You cannot figure out how to call this function properly without documentation or examining the code.
Instead of C I would choose something like Swift, D, Go (but it has pointers), maybe Rust (but writing in Rust for me is mostly struggling against borrow checker). I would choose something that's easy to read, test and verify and has a package manager.
So if you don't like systemd, consider writing your init system using one of the languages above. But please don't use shell scripts anymore.
- d0mine 4y agoShell is not the best language for complex programs but it does not justify the kitchen sink approach taken by systemd. It looks like an example of corporate bullying vs. open-source community and the corporate won.
- lmz 4y agoMost of your modern Linux infra is corporate. The large distros, the maintainers, the main contributors. The "community" is still free to do whatever they want and go use something else. (eg. Alpine is not using systemd)
- kaba0 4y agoSystemd’s core is quite lean. People just often lump in together a bunch of related, but not core packages and believe that all they do is boot up. It’s like claiming that kde-plasma is bloated because it has everything even a video editor under the namespace.