162 points · by hu3 · 6y ago · 75 comments
It's also only two months old. So I would say this a toy project. Of course, that it is a toy project right now does not preclude it becoming a real, robust init system in the future (just look at where the Linux kernel started, after all) but I do not think it is currently relevant to the Debian debate.
https://buildd.debian.org/status/package.php?p=rustc
Looks like there is a bootstrap issue, rustc build-depends on cargo, which build-depends on itself.
In my kind, that takes away one important m/killer feature which right now only systemd provides.
[Unit]
Description=This service runs always
[Install]
WantedBy=multi-user.target
[Service]
ExecStart=/usr/bin/python3 /opt/myapp/main.py
Restart=always
WorkingDirectory=/opt/myapp
User=myuser
Group=myuser
You can skip the last 3 if you want.Running a monolithical christmas-tree isn't what we need as PID 1.
https://tvtropes.org/pmwiki/pmwiki.php/Main/WorthlessTreasur...
* Running/waking a program from network activity? inetd (xinetd) has been doing that since the '70s.
* journald? Logging tools - including multiple types of syslog daemons - are numerous; use whatever you want. Choice is good. Even journald could be an option some people might prefer If it wasn't monolithically tied to systemd and could be used as a stand-alone daemon.
* cgroups? Other managers exist.
* timedated? Managing the clock was never difficult. The standard solution is to delegate most/all clock management to ntpd. If you had especially unusual needs, you probably had to set it up manually anyway (probably with a tiny amount of sh script).
* udevd? Other hardware managers exist. Some of us prefer the peace-of-mind of a simple static configuration instead of a manager, but you should be able to use udevd if you prefer it; udevd used to work stand-alone, but Lennart added it to the systemd monolith[1] when they were trying to push kdbus into the kernel. -sigh-
* daemon/process management? daemontools, runnit, s6, etc.
* logind? This attempts to create the concept of a "session" as a privilege boundary that is orthogonal to the actual privilege boundary in UNIX: the UID. The entire concept is a terrible security problem waiting to happen. The entire concept of a session is especially stupid considering most people don't actually use the traditional multiuser features of UNIX or this new "session" concept. In the rare situation where someone actually is running an actual multiseat setup, an extra step to install an optional package with these features wouldn't be a burden. The rest of just need a simple login/password prompt that can launch gnome/kde/.xinitrc/whatever at login time, which already existed as {x,g,sd,lx}dm.
If there are features that were only provided by systemd, is a monolithic[1] daemon really the best solution? Or could those feature simply be encapsulated into a small stand-alone package that could work wherever it is needed?
edit:
[1] Any objections trying to claim systemd isn't a tightly coupled, monolithic design will be ignored. If you think the number of binary program files is in any way useful as an objection, see: https://news.ycombinator.com/item?id=19024256
This means you can't assume almost anything about the distro or setup you're targeting as an application developer. Should I log to /var/log or use journald? Can I bundle a .service file or should I have shell scripts? Can I rely on udev rules or do I need to touch /dev? You can't assume unless you're only targeting Ubuntu.
Systemd is so integrated that programs require minimal porting. The alternative is either supporting everything, which leads to massive bloat, or forcing downstream patches to make the damn thing compile and run. Having a non-modular set of services you can rely on means even small alternative distros like NixOS can support many packages, because those packages require minimal changes.
Consistency across environments is critical. it's why docker is so big - all the wiring lives in one place, and what's inside runs everywhere.
But reducing choices to get consistency and consensus strips away the freedom that Linux offered - you can't uproot and replace components as easily. You can have that freedom or you can have a hassle-free package ecosystem; it's an inherent trade-off.
For resource quotas? Cgroups is a kernel interface. What kind of manager do you have in mind?
> daemon/process management? daemontools, runnit, s6, etc.
None of them can deal with runaway daemons. Some of them can deal with ordering and pre/post conditions and instancing, but not as extensively. Each provides a different subset of systemd's init features.
> Running/waking a program from network activity? inetd (xinetd) has been doing that since the '70s.
Inetd works in entirely different way. Those approaches are not comparable at all. (Systemd can hand off the whole listening socket)
I do have to ask though, does this serve any improvement over or fix any of the shortcomings of systemd aside from being written in Rust?
I much more like the title chosen by the author when he posted it on reddit earlier: “Rustysd: A systemd-compatible service manager written in rust”.[1]
[1]: https://www.reddit.com/r/rust/comments/e9o724/rustysd_a_syst...
Not everybody wants to work on hot new things, some want focus on having their tools to stable and working as designed. We need both kinds of work.
The ROI on improving widely used tools is quite large Yes indeed. You probably wanted to say: The ROI on reinventing widely used tools is quite large" There are some extremely used binaries that have a stagnant development and have not adapted to modern ergonomics. I beautiful example of that subset of widely used tools is cat. Cat is extremely used and yet, the rust rewrite bat is far superior, because among other things, it has color and code higlithing :0
For a rust rewrite to be successful you need the following conditions: You have ideas of improvments not present in the current tool. Your ideas are not on their roadmap. The current tool has not had too much of man/hours, which you can interpret heuristically as: the current tool has less than a few thousands of commits.
Here we're talking about systemd which has 42,600 commits. By the time rustysd will have as much features as
current* systemd, the original developer will be dead.As an end user I have almost zero benefits in this kind of rewrites, as I'm aware it's a far poorer software by design.
If it was 1) a new kind of software or 2) a reimplementation of a tool that they can realistically manage to outcompete or 3) the development that will in the very longterm replace an old complex tool that has stopped development, then I would have been interested.
Anyway if it's for fun/learning purpose, they do what they want, but utilitaristically there would be better choices.
I think you are missing the point completely. We are talking about rust, memory safe performant language, and systemd, core system in many Linux distributions, written in C++. I would love to be able to replace systemd (and kernel and core libraries too) with something that was safer at least in this aspect (memory safety).
Big kudos to Mozilla for identifying the cause of many security bugs and for finding a way to solve it while keeping performance intact.
> For now that is just out of interest how far I could come with this and what would be needed to get a somewhat working system. It is very much a proof of concept.
It sounds to me like this was more of a project that was just for fun and not really meant to be a genuine attempt at producing an alternative to systemd.
But I would like to keep an open mind about works like this one. This is work that could beget all kinds of neat things! Systemd targets Linux, where as this is a bit higher level & might be portable to other environments. It allows other people to not have to create their own process management systems, not have to create their own init system. The recreation brings the availability of the giant's shoulder to many many more places, distributes it's promise to really new & interesting targets.
For comparison: ripgrep (Rust) is >2 MB stripped, GNU grep is <200k stripped.
I have not looked at systemd in a while, but I'd be surprised it systemd in total is not smaller than the Rust runtime, which would leave your minimal subset larger than the original.
So maybe you meant something other than code size here, but using words like "minimal" and "subset" feel a bit (unintentionally, probably) misleading to me.
I'm sure the Rust people will at some point find a way to reduce the footprint of the runtime. Currently they have other, more pressing goals.
Personally, I wrote my own init system. The PID 1 process is a 10k statically linked binary. Resident memory size is 24k on one of my AMD64 Linux production servers. That is what I think could rightfully be called a minimal subset.
> I have not looked at systemd in a while, but I'd be surprised it systemd in total is not smaller than the Rust runtime, which would leave your minimal subset larger than the original.
Isn't this simply a result of the C runtime not being bundled with the executable? How does the comparison look when accounting for that difference?
It also depends on the how the code is structured, musl for example is structured not to pull in unneeded objects while the size of the glibc docker container speaks for itself.
That said you can beat C's code size with hand assembly and p-code interpreters.
I understood it as as a subset of features. It doesn't seem to me that the author is trying to play code golf with their codebase, or optimize for binary size (and why would you in 2019, storage is cheap)