Live data from Hacker News

Systemd Sucks, Long Live Systemd

naftuli.wtf

261–270 of 272 posts

Re: Systemd Sucks, Long Live Systemd

#261

Earlier quoted context omitted.

I am running systemd on Gentoo. (like Sabayon) While some of the features are nice, it is a royal pain to upgrade due to intertwined deps and forced restarts. And it doesn't do anything OpenRC couldn't do, in fact its journald is a pain which had to be worked around. OpenRC way of doing socket activations and dbus activations also works slightly better (in case something crashes) It does parallelism just as well, ser…

Yeah, Gentoo is quite nice in that regard, but isn't it still focussed on openrc? I was a ten plus years gentooo user before I switched to Arch (mostly because I got fed up with compiling)

OpenRC is the first option in the install guide, but you can choose systemd. I cant think of a good reason to do so.

Re: Systemd Sucks, Long Live Systemd

#262
post #260
post #245

Earlier quoted context omitted.

The problem is that it doesn't store "unit" meta-data for stderr, so you can not see stderr logs with journalctl -u nameOfUnit or systemctl status nameOfUnit

I do not find this to be the case. Right now I'm looking at the journal and observing the existence of _SYSTEMD_UNIT fields for messages that have been written to a process's standard error stream.

Can you see them when you run journalctl -u nameOfUnit or systemctl status nameOfUnit ? I'm running Ubuntu server.

Re: Systemd Sucks, Long Live Systemd

#263

The problem with systemd is not that it is "bad". There's a lot worse software out there. Systemd is relatively competently programmed. And it's even useful! The problem with systemd has always been that it forces you to do everything the systemd way, and usually to use its tools. It goes against everything that has helped GNU/Linux become a great system: that it wasn't really one system. It was bits and pieces, and…

> Systemd is the opposite. It is inflexible and clunky, monolithic and proprietary The other points can be debated, but please don't call it proprietary. It is free software as in "freedom" (LGPL).

It is indeed proprietary because it does indeed have an owner. But I use the word in the context of its design and implementation, which is basically that of the not so benevolent dictator, or the possessive or territorial.

Re: Systemd Sucks, Long Live Systemd

#264

Earlier quoted context omitted.

> Systemd is the opposite. It is inflexible and clunky, monolithic and proprietary The other points can be debated, but please don't call it proprietary. It is free software as in "freedom" (LGPL).

It is indeed proprietary because it does indeed have an owner. But I use the word in the context of its design and implementation, which is basically that of the not so benevolent dictator, or the possessive or territorial.

> It is indeed proprietary because it does indeed have an owner.

You are using the term proprietary incorrectly, probably out of simple ignorance. The software does not have an "owner" who has power of the users; the LGPL means all users have complete control over the software.

Please read this carefully before spreading more misinformation:

https://www.gnu.org/proprietary/proprietary.en.html

Re: Systemd Sucks, Long Live Systemd

#265
post #262
post #260

Earlier quoted context omitted.

I do not find this to be the case. Right now I'm looking at the journal and observing the existence of _SYSTEMD_UNIT fields for messages that have been written to a process's standard error stream.

Can you see them when you run journalctl -u nameOfUnit or systemctl status nameOfUnit ? I'm running Ubuntu server.

Yup. It is possible that your service is buffering output before actually writing it to the standard error stream. Try attaching to it with strace -e write PID and observe whether it is actually calling write(2, "some message"..., somenumberofbytes).

To approach this from the other direction, try this program:

    import sys, time

    while True:
        print('test out', flush=True)
        print('test error', file=sys.stderr, flush=True)
        time.sleep(5)
With this service:

    [Service]
    Type=simple
    ExecStart=/usr/bin/python3 /tmp/test.py

Re: Systemd Sucks, Long Live Systemd

#266

Earlier quoted context omitted.

It is indeed proprietary because it does indeed have an owner. But I use the word in the context of its design and implementation, which is basically that of the not so benevolent dictator, or the possessive or territorial.

> It is indeed proprietary because it does indeed have an owner. You are using the term proprietary incorrectly, probably out of simple ignorance. The software does not have an "owner" who has power of the users; the LGPL means all users have complete control over the software. Please read this carefully before spreading more misinformation: https://www.gnu.org/proprietary/proprietary.en.html

I'm aware of the definition of proprietary software. I'm not using that form of the word.

Re: Systemd Sucks, Long Live Systemd

#267
post #52
post #40

The sad thing is, you do not really have a second option, yes I know some distros say they have alternatives, but SystemD becomes the "preferred" init system nearly everywhere now. I just hope Debian to get rid of SystemD and return to whatever else. I know I'm biased, just failed to find a reason to love SystemD, tried a few times.

I've found that devuan is a joy to use on my laptop. I'm also rotating BSDs and open source solaris variants on to the home network machines. (Switching to solaris to get rid of systemd would be overkill; I switched to joyent triton for better containers and zfs...)

Devuan has jessie in beta now, at the moment I have not given up on linux yet, am going to try Devuan.

Re: Systemd Sucks, Long Live Systemd

#268

Earlier quoted context omitted.

Programs have features because they are useful. Some features may not fit your view of what the philosophy should dictate, and that's OK. Having a recursive ls doesn't bother me for example. Fork-and-exec isn't complicated by threads. Only fork-and-keep-executing is. UNIX doesn't have a naming convention using file extensions. Some of your points are valid opinions that are shared by others, but I don't know how much…

> Fork-and-exec isn't complicated by threads. Only fork-and-keep-executing is. Another issue is that fork-and-exec doesn't work well with languages with complicated runtimes, e.g. multithreaded garbage collection. It forces you to use a lower level language (such as C) to write all the code between fork and exec. An API based on process handles with a separate "start" call to convert a not-yet-started handle into a r…

> Another issue is that fork-and-exec doesn't work well with languages with complicated runtimes

How are you doing fork-and-exec in a language with a large runtime? You are either using the language-provided APIs to do it, in which case they should document the restrictions on what you can call (and you should follow those), or you are dipping down into the C or system call layer to do your own fork-and-exec, in which case yeah, you still need to keep to the safe list of routines you can call between fork and exec, and you may have extra limitations since you are mucking around underneath your language's runtime (like you may have to unignore signals on your own, close file descriptors, etc). No surprises there.

> Another issue is that it is very hard to implement robust error handling without race conditions in the fork-exec model.

I don't think it is. You just print an error to stderr (write() is safe to call), and you return a bad error code (fork has built-in IPC for error codes via wait() in the parent).

> Is there a clear definition of what the "UNIX philosophy" is?

I don't know, ask the person who first invoked that phrase in this thread. They claimed it meant "do one thing and do it well" to them, and then they complained about things that didn't seem related to me (like file extensions, what does that have to do with programs "doing one thing"?).

Re: Systemd Sucks, Long Live Systemd

#269

Earlier quoted context omitted.

> Fork-and-exec isn't complicated by threads. Only fork-and-keep-executing is. Another issue is that fork-and-exec doesn't work well with languages with complicated runtimes, e.g. multithreaded garbage collection. It forces you to use a lower level language (such as C) to write all the code between fork and exec. An API based on process handles with a separate "start" call to convert a not-yet-started handle into a r…

> Another issue is that fork-and-exec doesn't work well with languages with complicated runtimes How are you doing fork-and-exec in a language with a large runtime? You are either using the language-provided APIs to do it, in which case they should document the restrictions on what you can call (and you should follow those), or you are dipping down into the C or system call layer to do your own fork-and-exec, in whic…

> > Another issue is that fork-and-exec doesn't work well with languages with complicated runtimes

> How are you doing fork-and-exec in a language with a large runtime? You are either using the language-provided APIs to do it, in which case they should document the restrictions on what you can call (and you should follow those), or you are dipping down into the C or system call layer to do your own fork-and-exec, in which case yeah, you still need to keep to the safe list of routines you can call between fork and exec, and you may have extra limitations since you are mucking around underneath your language's runtime (like you may have to unignore signals on your own, close file descriptors, etc). No surprises there.

Let's say I am using JNA – https://github.com/java-native-access/jna – under Java. It is safe to call posix_spawn from Java code using JNA. It is safe to call the Windows API equivalent (CreateProcess). It would be safe to call the handle/descriptor-based API I proposed. It is not safe to call fork. This is an undeniable deficiency of the fork-exec approach which competing approaches don't have. Furthermore, whatever compensating advantages fork-exec may have, the handle/descriptor-based API I proposed has the same advantages without this disadvantage.

> > Another issue is that it is very hard to implement robust error handling without race conditions in the fork-exec model.

> I don't think it is. You just print an error to stderr (write() is safe to call), and you return a bad error code (fork has built-in IPC for error codes via wait() in the parent).

But that isn't robust. How can the parent process reliably distinguish output sent by the child process prior to the exec from output sent by the child process post the exec? Likewise, how can the parent process reliably distinguish an error return value from the child process prior to the exec from an error return value from the exec'd program? It can't.

For truly robust error handling, you'd actually need to do something like this: (1) have a pipe between parent and child process with FD_CLOEXEC set on the child side; (2) the child sends the parent a message "I'm about to exec" before calling exec; (3) the child sends the parent a message saying "exec failed with errno=.." if the exec call fails; (4) if the exec call succeeds, the child process will close its end of the pipe without sending any message post "I'm about to exec". This is my point, actually robustly handling errors in the fork-exec model is quite complex. In a handle/descriptor based API it would be much simpler.

(And the above approach using a pipe isn't perfectly robust – what if the child process crashes for some reason between sending the "I'm about to exec" message and actually calling exec()? It is very difficult for the parent process to reliably distinguish that scenario from some failure in the program being exec()'d.)

Re: Systemd Sucks, Long Live Systemd

#270

Earlier quoted context omitted.

> Another issue is that fork-and-exec doesn't work well with languages with complicated runtimes How are you doing fork-and-exec in a language with a large runtime? You are either using the language-provided APIs to do it, in which case they should document the restrictions on what you can call (and you should follow those), or you are dipping down into the C or system call layer to do your own fork-and-exec, in whic…

> > Another issue is that fork-and-exec doesn't work well with languages with complicated runtimes > How are you doing fork-and-exec in a language with a large runtime? You are either using the language-provided APIs to do it, in which case they should document the restrictions on what you can call (and you should follow those), or you are dipping down into the C or system call layer to do your own fork-and-exec, in…

> Let's say I am using JNA. [...] It is not safe to call fork.

Are you calling fork() from Java, from C, or using the system call number?

Because I'd agree calling it from Java might be unsafe (depends on how Java and JNA interact), but I believe calling it from C or the system call is perfectly fine. And this is in line with what I've written previously.

> But that isn't robust.

It's not supposed to be robust in the way you are describing.

The fork-exec model is low level. It is supposed to be low level. Doing high level things with it is supposed to take some work by the application. That's not a deficiency.

If you build too many things into the low level code, you run into trouble because now you've got 10x as many ways to fail (building your pipes, writing your error messages, marshalling error state, cleaning up, you name it).

Also, some programs will want to do some of those higher level things differently, so instead of baking them into the API and having tons of parameters and paying for some of that overhead (like creating a pipe and writing error messages to the parent for every single fork and exec) you only do that when you want it.

Post reply on HN