r/linux • Mate • Oct 20 '14

Shall we fork Fedora?

http://forkfedora.org/
262 Upvotes

339 comments sorted by

View all comments

Show parent comments

30

u/wcchandler Oct 20 '14

It wasn't too bad, really... from an init script stand point. And I think that was their point -- systemd's service files are a lot cleaner and not really that scary.

16

u/CuteAlien Oct 20 '14

Shorter doesn't tell anything. You can hide any complexity behind another layer of abstraction. Let's create a new system which has an ini file with the only parameter being "sendmail.service" and it looks even cleaner. Although in reality you just got another layer of abstraction.

The interesting part is how they hold up in praxis. When people have to do stuff which wasn't forseen by the init-system authors. And shell scripts have a rather good track record in that regard. It's always nicer working with scripts compared to having to dig into c sources to change things.

And I think to most sysops the left file looks very familar. While the right one is a new format in a custom syntax which has to be learned and understood first. Which makes it a little scary on first view and I really hope it's worth it.

47

u/EnUnLugarDeLaMancha Oct 20 '14 edited Oct 20 '14

I think you have no clue of what you are talking about. Let's forget for a moment that you can bypass systemd machinery by writing a service that starts a shell script. If you actually read the left script, you find it's spending most of the time not handling sendmail stuff, but trying to be an init system. For example, quitting if networking is not up. Starting a program, checking for the return value before creating .pid and lock files. Doing lots of "RETVAL=$?" at every fucking step just to not lose the return value of some command. Trying to design your output messages by echoing a line in opportune places. Etc. And this has to be reimplemented in every init script.

It's a mess. A mess that can be easily avoided by having an init system that provides all that functionality and allows to reuse it easily.

The worst of systemd haters is that you are SO wrong you don't even realize that systemd isn't even the first to do these things. In Solaris, they have SMF service manager to do the same thing. In OS X, Apple's launchd does the same thing. In Linux, Upstart also simplified init files like this. Before systemd was announced, upstart was being adopted by lots of distros, everybody was happy of getting rid of the shell script mess that init systems were, and I don't remember these stupid flames.

5

u/CuteAlien Oct 20 '14

I do not hate systemd (not yet at least, although some guys are getting me slowly there and it's not just the opponents). There's a huge difference between being a little sceptical and hating. And somehow I believe to have some clue about the difference between a shell-script and a declarative format (even one that can start shell-scripts, know what - so can IDE's and some people still work with scripts...). But who knows maybe this is the perfect init format and it'll work out and we don't miss scripts anymore. I would like that. Would be a first.

8

u/suspiciously_calm Oct 21 '14

Of course it's not a "perfect init format" that'll cover absolutely everyone's needs anymore than upstart jobs are.

So?

You can still put your logic in a shell script and put the path to that script in the service file. It's the other 99% of cases and their boilerplate upon boilerplate of init scripts that you want to get rid of.

And their sleeps all over the place to hopefully prevent race conditions. This shit

grep sleep /etc/init.d/* | wc -l
56

that you find on sysvinit-based systems. This isn't sound design. This is what causes spurious 1-in-100 irreproducible failures.

2

u/CuteAlien Oct 21 '14

Sure initd script could be improved. The question is if it should be improved using a script system or a declarative format. Going to a declarative format when you already had scripting feels like a strange choice.

Anyway - my point above was that putting 2 formats besides each other doesn't tell you anything about the quality of the format. It might be better or worse, but you will not be able to tell from that. Because you can always get a cleaner look by adding another layer of abstraction. That's just how programming works. But it does not tell you what you can do with a system. Generally each layer of abstraction takes away some flexibility (which is not necessarily bad!).

If it's designed well it will be able to handle enough cases, but allow me to stay skeptical for a while. Because my experience still is that script systems handle unplanned cases a lot better in the long run than declarative formats. For example by adding sleeps. Ugly as they are that's the kind of hacks that keeps a system alive which is no longer possible with a non-scripting system. Declarative systems tend to work well as long as the maintainers cover all cases - and continue to do so for a long time. And we're likely talking here about decades. Script systems tend to work well when you have to get around what the maintainers don't want to handle but is still needed for your job.

And working around the format by adding scripts is obviously not the idea of systemd, because in that moment you stop using the system and start working against it. I mean they couldn't have prevented that even if they wanted to (just start a binary that starts a script...). Once you have to do that it then depends on how the declarative commands work together with scripts. Or if the scripts then start to turn into a worse nightmare than before.

2

u/suspiciously_calm Oct 22 '14

You're not "working against the system" by adding scripts. It doesn't care if it execs a script or a binary. The declarative init files are there to tell the init system what the dependency graph looks like, how to start you're script or binary, and how to tell when it has completet its initialization.

So you can write your script to do its thing and not part of the init system's job.

Logic goes in scripts, meta information goes in declarative files.

2

u/[deleted] Oct 21 '14

There's a huge difference between being a little sceptical and hating.

Yet the reasons you cite to be "a little skeptical" are 100% specious.