116 points · by KKKKkkkk1 · 10y ago · 137 comments
My task was pretty straightforward: I had a group of processes that need to start in a certain order, restart if they die, run as a non-root user, and write logs somewhere. I needed to support RHEL 5, 6, and 7, which all use different init systems (sysvinit, upstart, and systemd). I worked with all of them and also experimented with alternatives (runit, s6, Supervisor).
For my task systemd was a pleasure to work with compared to the others. There was a bit of a learning curve, but once I mapped out what I needed to do the solution was obvious.
I found upstart to be almost good, but the version that ships with RHEL 6 is lacking compared to the later versions that came with Ubuntu. The Python-based Supervisor was surprisingly good. I sort of saw why some people might like s6, but runit's charm was lost on me.
sysvinit was by far the worst. I wound up using sysvinit to hand off to Supervisor in order to not spend my life worrying about the number of forks and pidfile locations.
I can't speak to systemd's shortcomings and perceived hegemony in other areas, but when it comes to acting like an init system it is miles ahead of everything else.
I find myself doing this frequently
> systemctl status someservice
> systemctl stop someservice
> systemctl edit someservice
> systemctl daemon-reload
> systemctl start someservice
> systemctl status someservice
> systemctl enable someservice
Why make the operation the middle parameter? I understand that "systemctl start foo" more closely resembles the English sentence, "SystemD, please start the foo service", but I couldn't give two shits about that, and it's a dumb design decision. Any time that I am entering a systemctl command, I'm probably entering a series of 3 or more of them, and they're probably all related to the same service.
Instead of being able to press <Up Arrow>, <C-Backspace>, and type my operation, I'm instead having to position my cursor to the second argument. It's a mess!
Example: systemctl stop smbd nmbd ; systemctl start smbd nmbd
It isn't that the operation is the /middle/ parameter, it's that you have invocation action //LIST//
So why should it be a common operation for the enduser to start and stop a list of related services? Instead of having to type and remember them individually, I should add a BindTo line in my service files and let systemd handle it. It's like the frontend for systemd is optimizing for a situation that it is supposed to prevent.
And anyway, there's no unixy reason the variadic argument couldn't be in the middle. cp, for example, has
<command name> <options> <variadic list of files to copy> <single dir to copy to>I felt exactly the opposite way when I used Debian (not for any justifiable reason other than "that's not the way it's supposed to beeeee") because Debian does it in the way you describe.
Theoretically, you could put on your hacker gloves and write a script that shifts the arguments for you. That might be a fun exercise!
!!:s/status/stop/
This will recall the last command and substitute status with stop.
!-2:s/status/edit/
Will recall two commands back from history and substitute status with edit.
See http://reasoniamhere.com/2014/01/11/outrageously-useful-tips...
For added awesomeness have a look into history-substring-search[1], zsh-autosuggestions[2], zsh-syntax-highlighting[3].
[1]: https://github.com/zsh-users/zsh-history-substring-search [2]: https://github.com/zsh-users/zsh-autosuggestions [3]: https://github.com/zsh-users/zsh-syntax-highlighting
for service in <list> do; systemctl <action> <service>; done
E.g., for system in foo bar baz; do systemctl stop $system; systemctl start $system; done
... will stop and start each of your named services.(This clearly extends far beyond systemd.)
systemctl stop foo bar baz; systemctl start foo bar baz
Maybe not as neatly, but you can do this in 5 blind keystrokes (instead of 3):
Up; Alt-<b; b; Backspace>I should try using emacs for a month, if only for the sake of getting to know readline better.
"systemctl stop foo" then "stop^start"
Which will substitute stop with start in the previous command (in bash, not sure about other shells)
Can you name any commands or interfaces that take the variable before the argument?
grep <pattern> <file>
Convenient when you're looking for <pattern> in a bunch of <file> (and for some reason cannot glob or list them). Less so if you're looking for a bunch of <pattern> in some one <file>.I've been known to write one-liner shell functions to put the variable component of a list of commands at the end of the commandline for easy editing.
cp [list of a great many items] [here]
or service service [item] [action]
whereas systemd is systemctl [action] [list of great many items]
There appears to be no hard and fast rule, though - argument ordering is different to flag ordering (-f -z etc). I never see anyone put flags at the end, though plenty of tools work fine that way.My problem with systemctl is that it's so woeful to tab-complete. At 'syst[TAB]c[TAB]', you may as well just type out the whole thing, because tabbing only saves you two characters. Why not just take 'ctl', that doesn't seem to be taken by anyone?
cp -t [here] [list of a great many items]
And there is one area outwith Unix but still at the command line where one does sometimes see people putting flags at the end (even though this is not the documented syntax): dir *.txt /s
Be wary of the service command, incidentally.* http://homepage.ntlworld.com./jonathan.deboynepollard/Softwa...
As for "ctl": Bear in mind that there are a lot of "ctl" commands. initctl (from upstart), netctl (from Arch), rcctl (from OpenBSD), pfctl (from OpenBSD), ip6addrctl (from FreeBSD), ntpctl (from OpenBSD), hastctl (from FreeBSD), swapctl (from 4BSD), rctl (from FreeBSD), pppctl (from FreeBSD), smartctl, journalctl, bootctl, localectl, busctl, coredumpctl, hostnamectl, machinectl, timedatectl, loginctl ...
Pick unadorned "ctl" for the systemd one, and one begs the question of why systemd alone is special enough not to require its name in the command.
https://github.com/zsh-users/zsh-history-substring-search
Found this regarding programming languages (and JS in particular) a bit interesting in the middle of the whole systemd debate, as i wonder if it can be applied to unix as well.
This in that unix have from the early days been made up of loosely coupled parts. This then allowed new parts to be introduced, tested, and either adopted widely or discarded as seen fit. Maybe even adopted in some areas but ignored in others. But you rarely ran into deep dependency chains.
Systemd on the other hand is tightly coupled, continually sprouting new stuff, and foisted on the world via deep dependencies.
Not really. All its various components are loosely coupled over DBus, and most are entirely optional. There's no technical reason why people can't e.g. implement journald's API in syslog. Or replace the various userspace *ctls (timedatectl, hostnamectl, …), or reimplement logind on top of some BSD (already done, actually), …
The latter are expressly non-documented, and non-stable, to allow the systemd devs to change them as they see fit.
As for logind on BSD, got a link? Last i recall they were struggling because it was a sprawling and moving target (Consolekit2 is also having that problem). One example is that recently logind took over much fo the job upower used to do, with upower now being a compatibility wrapper around logind.
Oh btw, dbus is massively more opaque that being able to run a command, look at the output, and then pipe that to another with the proper flags and such.
If you're thinking of SystemBSD, you are incorrect. There has been no publicly visible change on that front in the past year.
* https://news.ycombinator.com/item?id=10176275
* http://homepage.ntlworld.com./jonathan.deboynepollard/FGA/de...
http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/dae...
An improvement would be something with modern syntax, sparse features, and good docs.
This is an easy criticism to make. What's no so easy is to actually implement what's needed for a modern system and still achieve what you seem to be asking for. Modern systems are unbelievably complex beasts.
> An improvement would be something with modern syntax, sparse features, and good docs.
This is getting pretty silly and it just looks like you're reaching for anything to criticize here.
What does "modern syntax" mean and why would it be an improvement on the INI-like syntax of systemd configuration?
What earth does "sparse features" mean? You don't want to support everything that a modern system requires? (Take modern system to mean everything from containerized servers to desktops to laptops to a mobile phone. All places where systemd has its place.)
You don't think systemd has "good docs"? IME Systemd has unbelievably good reference documentation for any type of Free Software (in the Unix style of man pages, no less!).
Perhaps tutorial-like documentation is somewhat lacking, but the "systemd for Administrators"[1] blog series is pretty good IMO. (Though, granted, a bit out of date, perhaps.)
[1] http://0pointer.de/blog/projects/systemd-for-admins-1.html
man -k systemd
There is extensive and well written documentation for all aspects of systemd so I'm going to call BS on your post. Also, the syntax is consistent and documented. It is infinitely simpler than sysvinit. Either you're trolling, or know very little about systemd. Note that I'm a fan, but far from an apologist.
What are the command-line options that are available to that tool? Without looking in the source code.
>Note that I'm a fan, but far from an apologist.
An apologist is merely someone who offers a defense of something. It comes from the greek word ἀπολογία, "speaking in defense". Thus you are an apologist, even though you're not dogmatic.
I just want to point out here that just because an English word comes from some Greek word, that doesn't mean the English word actually means that today. You are correct about "apologist" (according to Wiktionary at any rate), it just means someone who speaks in defense of something, but there are other words where the meaning has changed over time. English is a language that is defined by its popular usage, and this can change over time so a word may not mean the same thing today as it did just 100 years ago.
A good example is the word "pathetic". According to Wiktionary, it comes from Greek:
'παθητικός (pathētikós, “subject to feeling, capable of feeling, impassioned”), from παθητός (pathētós, “one who has suffered, subject to suffering”), from πάσχω (páskhō, “to suffer”).'
Obviously, those don't bear that much resemblance to the current popular meaning, which is:
'1.Arousing pity, sympathy, or compassion.' or '2.Arousing scornful pity or contempt, often due to miserable inadequacy.'
In fact, other European languages like German have this same word (I believe this is called a "cognate"; I am not a linguist), from the same root, but their meaning is entirely different and they get confused when they learn English and encounter this word since we use it in such a different manner.
TL;DR: Greek or Latin roots are interesting from a historical and linguistic perspective, but they're no guarantee of the current definition of an English word.
While not the greatest example of documentation, it's not completely horrible. It accepts a single parameter which is the seed (yes, I looked at the source). I imagine it was an oversight for a very simple program with a singular purpose and which isn't meant to be called manually. It's not great, but it doesn't carry the same weight with me as if there were multiple possible or required arguments, or even a single optional one. Perhaps there are examples like that, I don't know.
It's hard for me to get worked up about the level of documentation of systemd compared to SysVinit, when things like OpenBSD exist that achieve such a high level of quality that they are both utterly shamed, and appear relatively similar in their mediocrity.
Look at the docs for something like systemd-service or -exec or -tmpfiles, etc. You found one that as bad. I'm sure you can find a few more. Now find docs for some random 1000 line shell scripts that aren't the code. At least there is a very obvious and consistent way to set the ulimit for my services, even if they don't support pam_limits via systemd, or an obvious way to extend the start script without hacking up the init file, etc. Please allow me to rephrase and say the documentation overall is so far ahead of th documentation for any implementation of init scripts and sysvinit it isn't funny. And this is coming from someone who spent most of his career as a UNIX / Linux SysAdmin.
* https://bugs.pcbsd.org/issues/13566
* https://bugs.pcbsd.org/issues/13565
* https://bugs.pcbsd.org/issues/13564
* https://bugs.pcbsd.org/issues/13563
On the subject of systemd doco:
* http://homepage.ntlworld.com./jonathan.deboynepollard/FGA/sy...
As long as you are prepared for the rest of the world to call BS on what you say here, as well. (-:
It's only "extensive and well written" if one sets the bar for those two quite low, and has very lax standards for doco. Unfortunately, people often do set the bar low in the Linux world. But to those from other worlds the words that come to mind are "acceptable" and "mediocre". As someone else has already mentioned here, and as people have pointed out passim over the years, the expected as the norm quality of doco for the BSD world is noticeably a higher standard than in the Linux world.
But it's not the BSD world alone where the norm is higher. The norm for the commercial Unices is and was higher, too. A case in point:
I wrote https://news.ycombinator.com/item?id=11629824 a little while ago. Checking my recollection, I referred to several manual pages for the rlogin command. The HP-UX and Solaris manual pages for rlogin actually had whole subsections about escape sequences, beginning with the general notion then proceeding to specifics of the various individual sequences. The HP-UX manual even proceeds to discuss how to send the escape character onwards, and how to send escape sequences across a daisy-chain of rlogin sessions -- something that still applies to SSH today.
The Linux rlogin manual has 1 paragraph, doesn't mention that there's actually a general concept behind the specifics that it lists, doesn't discuss how to escape the escape character, and doesn't discuss daisy-chaining.
If you're just about to point to your Linux ssh manual as a counterexample and observe the treatment that it gives escape characters, as good as that of the HP-UX doco, then scroll to the bottom of the page and enjoy the fact that you're reading BSD doco written by BSD people. (-:
For my money, runit gets the nod for modern syntax, sparse feature ... docs are coming along ;)
For me was great and rewarding, a nice learning experience, about livecd's initialization and linux in general at the time.
I don't feel like I could have accomplished the same experience trying to do the same with systemd (with my age and knowledge and resources at the time).
Still more difficult, being a Debian user, where systemd is not in the same shape than RHEL based distros, and documentation is out of sync, or missed in blogs...
What you propose reminds me to openrc or the gentoo dependency based init system.
I Love too the BSD/Slackware/busybox init style (single script init). But I'm a scripting mad.
One of my reasons to live, of and for, opensource, is the ethics and freedom behind it. Other one was being more K.I.S.S. on my system interactions than with MS based products.
I feel capital interests hurts some things very hard to obtain, in voluntary groups of people, using guerrilla warfare, and without any care.
Eventually I've deployed some Debian stable (Jessie) systems with sysvinit this same year, and I'm grateful that people in Debian did that option possible.
I'm not sure if a third, or a new option with modern syntax and sparse features as you say, could be better than the years we've been moving the world using sysvinit or upstart or others... but we, the tech people, seem to like new things!
Totally agree about the docs care, specially when there are distributors involved.
When there are changes in opensource, there should be a lot of more care IMHO than in closed products, and this is not always the case.
Unfortunately people, by brain nature, is driven a lot by media and marketing, two weapons of venture capital techs. And if service providers insert X and media inserts X, people who did never maintain a critical and complex deployments using X and did integrate a lot of things with them, starts talking about the smell of the clouds.
What implementation do you suggest, to reach what you propose? I think is not easy :)
My main feature request could be: reliable and malleable (not easy too).
> An improvement would be something with modern syntax, sparse features, and good docs.
Loved your tower of babel mess definition, upvoted just by that comparison.
Have a nice day.
* 1. System 5 rc
* 2. upstart
* 3. systemd
* 4. "third, new, option"
The "Uselessd Guy" critiqued the thinking that underlies this strange way of counting to three that is being employed here, in http://uselessd.darknedgy.net/ProSystemdAntiSystemd/ .
See also https://news.ycombinator.com/item?id=11641426 on this very page.
For those with OpenBSD habits, there is a compatibility shim in the nosh toolset that translates to native nosh mechanisms.
* http://homepage.ntlworld.com./jonathan.deboynepollard/Softwa...
Linux Kernel. Git. $torvaldsinitsystem ?
You'll know there are too many dependencies on systemd when people who don't want it (Devuan, Slackware, openBSD) can't boot a decent system without it. I don't think we're in danger of that: people who don't want systemd don't need it.
Git did start as a tool, and has been extended, a lot.
The same than the kernel booting was extended across the years to cover usage cases.
If he writes pid 1 code by itself, to get rid of a issue, as he did with the kernel and with git, we will call it the Linus pid 1. But as others said, maybe he doesn't has personally annoying issues with this.
I'm not sure where this tendency of Red Had for taking over the ecosystem comes from. The only rational basis for it I can think of is they wanting Linux to stay complex, so they can sell support. But it's way more likely it comes simply by them hiring a big number of developers, and not having enough in-house problems to solve - after that they must lead, not follow (for marketing reasons), so they must push their solution onto everybody.
Don't do that. It's a bag of hurt.
(Still sore about the hours that workstations with not-working-fs mounts spent waiting for each other on boot after power failures, ages ago. Nevermore.)
Honestly, whenever the init system is configured correctly, you don't run into these problems all ops know a story about. It helps that systemd makes it easier to configure dependencies so that only the units depending on remote fs stall when it is unavailable.
No, you mount them with autofs, of course.
It was so ridiculously easy to set up. All of the "copy and paste" newbie answers always involve modifying fstab and there are always issues on boot, but autofs just works. It makes me wonder why it's not recommended as often.
I guess that kinda tells us more than anything else he said.
"Although I still have serious misgivings about the systemd upstream’s attitude, I’ve got to say I find the system rather refreshing and useful in practice."
What disturbs me the most is that systemd takes Linux farther away from being a Unix-like system. Linux is now "Linux" and incompatible with anything else.
> cgroups
Works fine on my Gentoo (OpenRC) desktop. This meme that systemd is necessary for cgroups is simply incorrect.
> sockets
We stopped using xinetd a loooooong time ago. If you want to use a central point of failure, that's your business.
> dbus
Isn't necessary in the init process, though you're free to use it if you wish.
> didn't used to exist
Such as?
> replacement for these features
The replacement in some cases should be "nothing". You're trying to frame the conversation in a way that presumes features like cgroups or "socket activation" are desired features.
The entire point of this "debate" is that you shouldn't be tying extra features to the init process. There are a wide variety of systems in the Linux ecosystem, and there is no one-size-fits-all solution.
If you want to run a heavyweight, opinionated, monolithic init like systemd, that's fine. If it makes your life easier, that's great. Just remember that other people have different requirements.
> > replacement for these features
Did GP edit their comment? The quotes and arguments you're arguing with aren't present in it.
> We stopped using xinetd a loooooong time ago. If you want to use a central point of failure, that's your business.
An init system that groks socket activation yields more benefits than just lazy service startup. Services which communicate over a socket can be more loosely coupled, and a service need not be a traditional "forking daemon" for dependent services to start up at the correct time (since , say, the dependency's UNIX domain socket is already created, they can all start in parallel).
edit: I edited the last paragraph in 20 minutes after posting.
That's not what it's about. The point of cgroups integration in systemd is that it allows systemd to precisely track the processes started under it, which means that e.g. applications where things like double-forking or similar happens can still be completely stopped by systemd even if the parent process des.
> You're trying to frame the conversation in a way that presumes features like cgroups or "socket activation" are desired features.
They are to me. They massively improves things vs. sysvinit.
> The entire point of this "debate" is that you shouldn't be tying extra features to the init process.
The entire starting point for systemd is that traditional sysvinit is woefully lacking in the functionality required to build reliable systems. And when you start trying to cobble together something on top of it, it quickly becomes clear that it is not easy.
E.g. try to build a reliable process manager outside of pid 1. You still need process restarting functionality in pid 1 for when your process manager dies. What if it fails to restart? How are you going to log those failures reliably? You end up duplicating a lot of functionality of a process manager in pid 1 if you want a reliable system even if you run a separate process manager outside of pid 1.
There are parts of the systemd design I don't agree with, and I think they'd benefit from splitting out various components from the project, not least for "political" reasons. But the design for the core parts of systemd-the-init-system largely follow on from a very limited set of core requirements of being able to reliably start, stop and keep services running and reliably log data from them.
These are requirements that sysvinit basically throws it hands up at and says "not my table", while by owning pid 1 they make it basically impossible to meet them.
I know why systemd uses cgroups. I was addressing the myth that systemd is required to use cgroups.
> They are to me.
That's nice. You should use systemd if its features satisfy your requirements better than the other options.
Other people have different requirements. Is this concept difficult to understand? We don't want the same features, for a variety of reasons. Disagreement is fine, but systemd advocates often seem to want a monoculture.
> the functionality required to build reliable systems
That's your opinion, which you're entitled to. I disagree, as I've never had problems like you're describing. I value stability a very strongly, so I consider the methods that worked fine over the past 20+ years.
> requirements
That's the framing I was talking about. There is more than one way to design a stable system, and your requirement list is only one of those methods. Some of those requirements I consider misfeatures that cause problems, but it's fine if you disagree.
> impossible to meet them
Then use systemd or some other solution that solves your needs. Is it so hard to understand that we can choose different software?
There are numerous long-term expert users and developers of Linux who've spoken against systemd, its design, its behavior, and its developers. Including Linus Torvalds, Alan Cox, Ted T'so, and Patrick Volkerding
(That's the original developer of Linux, the long-time second in command, the lead filesystem developer, and the Slackware distro's maintainer -- the oldest extant linux distro.)
Mark Shuttleworth, Eric Raymond, and Ian Jackson are notable other critics.
For actual arguments against systemd:
http://without-systemd.org/wiki/index.php/Arguments_against_...
https://igurublog.wordpress.com/2014/04/03/tso-and-linus-and...
The laptop vs server divide:
http://www.infoworld.com/article/2837182/linux/back-into-lin...
Bad design and bad attitude. One or the other might be survivable. Both are likely not.
http://www.infoworld.com/article/2608798/data-center/systemd...
Uselessd's observations on misrepresentations by systemd advocates:
http://uselessd.darknedgy.net/ProSystemdAntiSystemd/
Five troubles:
http://www.draketo.de/light/english/top-5-systemd-troubles
LWN on Debian's debates: https://lwn.net/Articles/452865/
Wikipedia on Systemd's controversy: https://en.m.wikipedia.org/wiki/Systemd#History_and_controve...
or
> I have to say, I don't really get the hatred of systemd. I think it improves a lot on the state of init, and no, I don't see myself getting into that whole area.
> Yeah, it may have a few odd corners here and there, and I'm sure you'll find things to despise. That happens in every project. I'm not a huge fan of the binary logging, for example. But that's just an example. I much prefer systemd's infrastructure for starting services over traditional init, and I think that's a much bigger design decision.
> Yeah, I've had some personality issues with some of the maintainers, but that's about how you handle bug reports and accept blame (or not) for when things go wrong. If people thought that meant that I dislike systemd, I will have to disappoint you guys. [2]
Both a quick Google away. To sum it up: Linus is okay with systemd. He just doesn't like its maintainers because they're straight up primadonnas. [3]
1: http://www.zdnet.com/article/linus-torvalds-and-others-on-li...
2: https://linux.slashdot.org/story/15/06/30/0058243/interviews...
3: http://www.theregister.co.uk/2014/04/05/torvalds_sievers_dus...
In what way is that a "big argument"? BSD has their own rc-thing (not sysv init), OS X has launchd (not sysv init, shares many similarities with systemd actually, such as socket activation), Solaris has SMF (again, not sysv init), etc.
Apart from a bunch of non-mainstream Linux distros sticking with sysv init, who else is actually using it?
* https://news.ycombinator.com/item?id=11415985
But yes.