Systemd has 6 service startup notification types, and they're all wrong
ewontfix.com
ewontfix.com
My biggest gripe is with socket activation. Systemd doesn't provide any info apart from the file descriptors to the application so binding to port 80 and 443, you have to know the order to add SSL on the right one.
in this case the public and documented interface is sd_notify and it is only available as part of a huge library that every service has to link to their binary
it would be nice if systemd authors werent completely ignorant about sensible interface design between software components
now that ppl started to depend on random internal behaviour of systemd it is no longer possible to reimplement it in a sensible way: nobody knows which systemd quirk your ruby project depends on
It isn't an internal interface. http://www.freedesktop.org/wiki/Software/systemd/InterfacePo...
There's also problems with nscd as pointed out in the comments, but the FSF is insane enough in general that I don't think that's necessarily a problem with systemd and more of an issue with working around the labyrinth of bullshit that is the FSF and their policies.
That is documentation on sd_notify, which is an implementation that utilizes $NOTIFY_SOCKET. It being documented is not the same thing as $NOTIFY_SOCKET being documented
See the notes in sd_notify(3) or https://lists.debian.org/debian-ctte/2013/12/msg00230.html for a simple alternative implementation. Admittedly could be better documented.
edit: point to notes section
Imho this is the semi-religious 'vim vs emacs' debate all over again, except this time it's not between equally good pieces of software but a 'systemd is garbage' group against the rest...
No, systemd uses cgroups to manage forked processes (with the option of pid files).
I'm not sure why I should seriously consider a critique of systemd by someone who doesn't understand how systemd works.
There are some capitalization styles that always start sentences with caps. It used to annoy me with "Coreboot" (instead of "coreboot"), too - but it really isn't a big deal.
This is the same requirement systemd has for the "forking" type daemon.
Either the socket activation or notify approach don't need linking against a systemd library either they can just be done in < 20 lines of code.
The thread we're on is talking about a public API that's not documented sufficiently for alternative implementations to be created without reading its source code.
Looking through all the current init scripts, almost none of them do that. They launch the service executable, and report success it that succeeded. The service then often fork to place itself in the background, starts initialization, and might fail at that point without the init system noticing it.
The "forking" option of systemd will do the same, which is reasonable since a lot of existing services already works that way.
The apache init script on my system is one of the exceptions though, it doesn't directly launch apache, instead it starts apachectl, a program specifically written to start and interact with apache. That program communicates with apache, and therefore knows when it's started, whether it failed because httpd.conf had an error and so on.
That's not a general approach - unless you want to have each service accompanied by a program capable of doing IPC with the service for use with e.g. startup and shutdown. That'd make services portable among init systems and operating systems, so if you need that, it's a reasonable approach.
For systemd you'd can do the same, run apachectl to start apache.
He describes one that would be portable. Even upstart's SIGSTOP hack is portable across any init system that chooses to implement it; no linking to any init-system-specific library required.
systemd's implementation is exactly as portable as upstart's hack - any OS can implement it. The relevant code is under a liberal license.
Option 2 is just shit.
I'd prefer a cross-init mechanism for this. But there isn't one. What should systemd do? Just not implement anything until SMF and launchd developers agree to add support?
The proposed 'use unix pipes' architecture proposed by the original author ('option 1') doesn't bind a daemon to a particular operating system or init system, because it uses a kernel feature common to all unix variants. And of course it itself is a mechanism for passing metadata, so your argument doesn't make sense.
Using a socket would also be fine, and if systemd chose to expose and document that socket API directly, rather than hiding it behind a C shim, that would be tolerable. But since systemd's modus operandi so far has been to attempt to become tightly coupled to every userland component, I'm not holding my breath.
That said, now I don't understand why one would use these things instead of something less openly hacky, like normal portable sockets, which have all sorts of advantages. And I can't find a reason why these were implemented in such a weird and nonportable way. From all I can piece together from the web, it looks like these were implemented by the freedesktop guys for that hacky desktop bus thing, is that right?
Well that's an aside; in any case, having discovered this unnecessary coupling to a hacky linux-only feature, I would go back to the OP's idea of using standard unix IPC, which for the purpose appears to be more than enough to do the job but doesn't bring baggage. Any idea why that would be a bad thing?
#include <signal.h>
...
int use_sigstop = 0;
...
case 'S' :
use_sigstop = 1;
break;
...
if (use_sigstop) (void)raise(SIGSTOP);
...But for a pipe it does get more complicated. Do you have sscanf? How about strtol? Should you use atoi? Might want to just roll a for loop of your own for three digit integers say. Or what if the other end of the pipe was closed? I have to ignore SIGPIPE. Should I use sigaction? Well signal should always be there. But is my daemon multithreaded? Shoot, looks like I have to fork and immediately exec a helper that does the write.
See where this is going? And the code someone linked to here for sd_notify style socket communication instead of linking with systemd (you are using pkgtools right?) used MSG_NOSIGNAL precisely for these signal issues. Guess what, it was different in Linux before 2.2 or something, can't remember the details. Also it's different in some FreeBSD versions as well. I'm pretty sure it was different on Darwin. I can't remember about Solaris. HPUX? AIX? Your guess is as good as mine. It's a portability PITA.
Anyway, I really really dig the simplicity of raise(SIGSTOP). Also yes there are some detriments to overloading the use of SIGSTOP like this, maybe a small performance one, and maybe there is some concern another root process could use kill to send it SIGSTOP. But I think the simplicity and reliability outweighs all that stuff I mentioned above if you go for a robust portable alternative using a pipe or socket. Plus I can make arguments in a similar vein about the environment variable that systemd uses internally which is not pretended with something like "SYSTEMD_" or "_" even, but I wouldn't cause it's just as silly as complaining about the detriments of using a signal in my mind.
Et voila, you found your answer. Target systemd, problem solved.
Requiring systemd is like saying every daemon program needs a GUI.
Is there a way, or any way to somehow stop systemd which is from Redhat? I'm very worried as I don't want to be _forced_ to use it on my embedded projects. Redhat does not know as much embedded system as their big gun server systems.
Judging by the comments to this post (and the links that the comments refer to), the author hasn't got all their facts straight. Also it seems like the author has some kind of personal hatred towards systemd, which doesn't seem to be based on real technical issues and has been writing similar vitriolic blog posts in the past.
This anti-systemd bashing is a complete waste of time. Don't like systemd? Don't use it. Do you think there is something wrong with it? Go fix it. Do you think it's done all wrong from the bottom up? Write a better replacement. But please, stop writing crap like this.
Edit: Interestingly, it looks like one of the other Wiki pages[1] does specificially call out the underlying $NOTIFY_SOCKET protocol as a stable interface. (Then points to an authoritive chart that doesn't, presumably because the implementation details of the other sd-daemon.h APIs aren't stable despite being documented in the same way?)
[1] http://www.freedesktop.org/wiki/Software/systemd/InterfaceSt...
...
systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License...
What if I can't?The comment should've stated something like "the way to do this is not documented". The way it is currently worded implies something totally different.
Why? Is not linking somehow unreliable? You can't have it both ways. Either it is stable, or it is not.
I'm saying that linking to a function is more reliable than copy/pasting that stuff into your program. If you want to argue that copy/pasting is totally fine, go ahead. I'm sure enough people will respond to that :-P
1) The first round was. This guy wrote pulseaudio!
2) This goes against the Unix philosophy
3) Systemd is taking over everything. Why replace init?
Just like ZFS, Btrfs and SANs and cloud-systems in general. And they are really suffering in popularity for these terrible violations, eh?
After having fooled around with it, my only complaint as far as systemd goes is software needlessly making it a dependency. systemd itself is just fine.
Now there's btrfs with the same type of "layering violations" and systemd ('s ecosystem) using binary formats.
What's good for the goose, ...
No argument there.
2) This goes against the Unix philosophy
Not a valid argument, nor true.
3) Systemd is taking over everything. Why replace init?
We all know what the problems with traditional init systems are, and they have to be replaced. Systemd currently appears to be the favourite option.
This is increasingly becoming a completely unviable option. As more and more distros adopt it as the standard, and more and more software becomes dependent on it and it's various parts, it becomes increasingly difficult to just not use systemd. Particularly those of us in the enterprise world, where we have a limited number of distros that are acceptable for server related work, most of which are now set on systemd being their init system moving forward.
>Do you think there is something wrong with it? Go fix it.
Not everyone that uses Linux is a developer. Not every developer that uses Linux works in the realm of knowledge related to init systems. The group managing systemd is also known to be more than a bit vitriolic and opinionated - what you believe is wrong might be something they thing is right. This isn't necessarily a bad thing - but it does mean that the idea of just fixing it is impractical, even if you have the necessary skills to correct what you think is broken.
>Do you think it's done all wrong from the bottom up? Write a better replacement.
A fair amount of the people that think it's wrong from the bottom up think there are already perfectly acceptable replacements.
>But please, stop writing crap like this.
I haven't gone over the article in depth, but... why? Why are you so upset that people are using the avenue they have available to make their opinion known? The Linux community has far outgrown the days where it was a developer only playground, so your proposed ideas of just write some code to solve everything is ridiculous.
Personally, I'm past caring on the systemd issue - I've long since replaced all of my servers with BSD or Illumos based distros, so I don't have a horse in this race anymore. I just don't understand the visceral reaction of some people in the Linux community to go "STOP SHARING YOUR OPINIONS, IF YOU THINK SOMETHING IS WRONG JUST MAKE IT BETTER"
> Why are you so upset that people are using the avenue they have available
> to make their opinion known? The Linux community has far outgrown the days
> where it was a developer only playground, so your proposed ideas of just
> write some code to solve everything is ridiculous.
The author has the ability to write code. So his suggestion is relevant. But instead of writing code, he's writing highly opinionated "articles" full of claims that distort what is really going on. Opinions stated as facts, suggesting things by the way things are written, etc.That'll just get you nowhere. Constructive but harsh articles are good. This? No
Distros has always had standards and this has never been an issue before.
more and more software becomes dependent on it and it's various parts
This is something completely different and unrelated from what distros decide to do.
For instance, while I really like systemd as a Linux-specific init-system, I cannot for the love of all that is good architecture understand why Gnome, a desktop-environment running on top of X, maybe running on top of Linux, should make it self dependent on a Linux-specific component like systemd.
In cases like that you should not hate systemd, but on the guilty party introducing the bad dependency. This is clearly not systemd's fault.
While distros adopting standards has been polarizing in the past, I think this is the most debated issue in the past decade or two. There's been some quibbles over things, and of course there's the vi vs emacs holy wars, etc, but I can't think of a single time where something so integral to the distribution has been such a matter of controversy across the community.
>In cases like that you should not hate systemd, but on the guilty party introducing the bad dependency. This is clearly not systemd's fault.
Oh, I'm not blaming systemd for this (Though it's not surprising Gnome has done this - the Freedesktop.org group is fairly incestuous when it comes to this sort of thing), I'm just saying it's pretty easy to say "Don't use systemd if you don't like it then!", but increasingly more difficult to actually do it.
It's not like vi vs emacs or nginx vs apache where you can quite easily just use the one you want.
GNOME doesn't depend on systemd. See for instance a blogpost about it: http://blogs.gnome.org/ovitters/2013/09/25/gnome-and-loginds.... GNOME wants either logind (systemd) or ConsoleKit (freedesktop.org, unmaintained).
Calling people "guilty" is also not very constructive behaviour, IMO. Too emotional while you're already showing lack of knowledge about this subject.
You've picked the wrong guy here. Rich Felker has done extremely valuable and useful work[1] for the Linux ecosystem. You know, unlike Lennart Poettering who brought us pain through PulseAudio and systemd.
> the author hasn't got all their facts straight [...]
> Also it seems like the author has some kind of personal hatred towards systemd, which doesn't seem to be based on real technical issues and has been writing similar vitriolic blog posts in the past.
His posts are purely technical and of extremely high quality, and if you can't see that, then this forum has failed.
Don't understand how you can claim this. The posts are highly emotional, very suggestive and a lot of things are plain wrong.
> if you can't see that, then this forum has failed.
Whatever. That's not an argument.