<p dir="ltr">On Apr 27, 2015 16:39, "Lennart Poettering" <<a href="mailto:lennart@poettering.net">lennart@poettering.net</a>> wrote:<br>
><br>
> On Sun, 26.04.15 14:32, Peter Paule (<a href="mailto:systemd-devel@fedux.org">systemd-devel@fedux.org</a>) wrote:<br>
><br>
> > BTW: I did the `echo "asdf" > /dev/stderr`-thing just to test if<br>
> > `/dev/stderr` worked as expected.<br>
><br>
> /dev/stderr does not work for socket fds, and that's a kernel<br>
> limitation, systemd can't do much bout it.<br>
><br>
> > What I do not understand is: What changed in systemd that the<br>
> > service-unit-thing worked in some earlier versions?<br>
><br>
> We changed nspawn so that it may be included in shell<br>
> pipelines. Effectively this meant passing through the original<br>
> stdin/stdout that nspawn got all the way down to PID 1 inside the<br>
> container. We do so now if we are invoked non-interactively, i.e. with<br>
> stdin/stdout not being a tty.<br>
><br>
> Previously, we would never pass through fds, but always create a pty<br>
> inside the container and automatically forward all bytes of<br>
> stdin/stdout from outside the container to it and back. However, that<br>
> broke shell pipelines, since it ate up the independent EOF on stdin<br>
> and stdout: ptys cannot signal those individually (there's only a<br>
> hangup that terminates both directions at once), but that's a property<br>
> you inherently need for any kind of pipelines.<br>
><br>
> I am pretty sure that the new behaviour is a ton more correct though:<br>
> with this you get the same behaviour if you start a process<br>
> non-intractively as a service or inside an nspawn container, the same<br>
> fds, and hence the same (broken) /dev/stderr semantics.<br>
><br>
> > And what can I do to make it work again? There seems to be no other<br>
> > logging target _today_ both for nginx and apache which makes them<br>
> > compatible with journald.<br>
><br>
> Do not use /dev/stderr. If you are in a shell script replace this:<br>
><br>
>    echo foobar > /dev/stderr<br>
><br>
> with this<br>
><br>
>    echo foobar 1>&2<br>
><br>
> The latter will just duplicate stdin to stderr, the former will reopen<br>
> stdin as stderr. Which is a difference, though an non-obvious one,<br>
> that is further complicated that GNU bash (though not necessarily<br>
> other shells) actually automatically do the second command if you pass<br>
> it the first command. The first command does not work (in non-bash<br>
> shells..) if stdout is a socket, the second command does.</p>
<p dir="ltr">I'm guessing from the error message that it's not a shell script but nginx itself configured to use "/dev/stderr" as its log file, so there's no >& that could be used...</p>
<p dir="ltr">><br>
> Lennart<br>
><br>
> --<br>
> Lennart Poettering, Red Hat<br>
</p>