Re: [systemd-devel] [systemd-nspawn] nginx: [emerg] open() /dev/stderr failed (6: No such device or address)
What precisely is the setting you picked? I used this setting: error_log /dev/stderr warn But I must admit, I thought that this is the default of the Arch Linux package. But they use this setting in their nginx-package: error_log stderr Here's their service-unit [Unit] Description=A high performance web server and a reverse proxy server After=network.target [Service] Type=forking PIDFile=/run/nginx.pid PrivateDevices=yes SyslogLevel=err ExecStart=/usr/bin/nginx -g 'pid /run/nginx.pid; error_log stderr;' ExecReload=/usr/bin/kill -HUP $MAINPID KillSignal=SIGQUIT KillMode=mixed [Install] WantedBy=multi-user.target I tried that setting in my virtual machine and it worked like a charm: error_log stderr warn; Sorry for the noise. Should have used this setting from the beginning. Thanks a lot for the help. /pp ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [systemd-nspawn] nginx: [emerg] open() /dev/stderr failed (6: No such device or address)
On Tue, 28.04.15 07:05, Peter Paule (systemd-de...@fedux.org) wrote: Hmm, but that already lists a native config keyword for stderr? Yes, I saw that too late. I copied the default configuration of the Arch Linux nginx package and used that. So, does it work if you use the config keyword stderr there? Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [systemd-nspawn] nginx: [emerg] open() /dev/stderr failed (6: No such device or address)
On Mon, 27.04.15 20:11, Peter Paule (systemd-de...@fedux.org) wrote: 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... Correct - see http://nginx.org/en/docs/ngx_core_module.html Syntax: error_log file | stderr | syslog:server=address[,parameter=value] | memory:size [debug | info | notice | warn | error | crit | alert | emerg]; Default:error_log logs/error.log error; Context:main, http, stream, server, location What precisely is the setting you picked? Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [systemd-nspawn] nginx: [emerg] open() /dev/stderr failed (6: No such device or address)
On Sun, 26.04.15 15:34, Peter Paule (systemd-de...@fedux.org) wrote: Maybe syslog will do the trick? Well, the journal will do the trick, if you run systemd inside your container. If you don't, then bind mounting the syslog socket might suffice. BTW: Do I need a syslog daemon to receive messages on UDP 514, or is/will be systemd-journal-remote able to handle this? Didn't found a clue about that in the man-page. No, journald does not cover that. Use rsyslog or syslog-ng if you care about classic BSD syslog-over-UDP. Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [systemd-nspawn] nginx: [emerg] open() /dev/stderr failed (6: No such device or address)
On Sun, 26.04.15 14:32, Peter Paule (systemd-de...@fedux.org) wrote: BTW: I did the `echo asdf /dev/stderr`-thing just to test if `/dev/stderr` worked as expected. /dev/stderr does not work for socket fds, and that's a kernel limitation, systemd can't do much bout it. What I do not understand is: What changed in systemd that the service-unit-thing worked in some earlier versions? We changed nspawn so that it may be included in shell pipelines. Effectively this meant passing through the original stdin/stdout that nspawn got all the way down to PID 1 inside the container. We do so now if we are invoked non-interactively, i.e. with stdin/stdout not being a tty. Previously, we would never pass through fds, but always create a pty inside the container and automatically forward all bytes of stdin/stdout from outside the container to it and back. However, that broke shell pipelines, since it ate up the independent EOF on stdin and stdout: ptys cannot signal those individually (there's only a hangup that terminates both directions at once), but that's a property you inherently need for any kind of pipelines. I am pretty sure that the new behaviour is a ton more correct though: with this you get the same behaviour if you start a process non-intractively as a service or inside an nspawn container, the same fds, and hence the same (broken) /dev/stderr semantics. And what can I do to make it work again? There seems to be no other logging target _today_ both for nginx and apache which makes them compatible with journald. Do not use /dev/stderr. If you are in a shell script replace this: echo foobar /dev/stderr with this echo foobar 12 The latter will just duplicate stdin to stderr, the former will reopen stdin as stderr. Which is a difference, though an non-obvious one, that is further complicated that GNU bash (though not necessarily other shells) actually automatically do the second command if you pass it the first command. The first command does not work (in non-bash shells..) if stdout is a socket, the second command does. Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [systemd-nspawn] nginx: [emerg] open() /dev/stderr failed (6: No such device or address)
On Mon, 27.04.15 16:59, Mantas Mikulėnas (graw...@gmail.com) wrote: 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... If this indeed is the case, try using /dev/console instead, this is also forwarded to stderr by nspawn... Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [systemd-nspawn] nginx: [emerg] open() /dev/stderr failed (6: No such device or address)
On Apr 27, 2015 16:39, Lennart Poettering lenn...@poettering.net wrote: On Sun, 26.04.15 14:32, Peter Paule (systemd-de...@fedux.org) wrote: BTW: I did the `echo asdf /dev/stderr`-thing just to test if `/dev/stderr` worked as expected. /dev/stderr does not work for socket fds, and that's a kernel limitation, systemd can't do much bout it. What I do not understand is: What changed in systemd that the service-unit-thing worked in some earlier versions? We changed nspawn so that it may be included in shell pipelines. Effectively this meant passing through the original stdin/stdout that nspawn got all the way down to PID 1 inside the container. We do so now if we are invoked non-interactively, i.e. with stdin/stdout not being a tty. Previously, we would never pass through fds, but always create a pty inside the container and automatically forward all bytes of stdin/stdout from outside the container to it and back. However, that broke shell pipelines, since it ate up the independent EOF on stdin and stdout: ptys cannot signal those individually (there's only a hangup that terminates both directions at once), but that's a property you inherently need for any kind of pipelines. I am pretty sure that the new behaviour is a ton more correct though: with this you get the same behaviour if you start a process non-intractively as a service or inside an nspawn container, the same fds, and hence the same (broken) /dev/stderr semantics. And what can I do to make it work again? There seems to be no other logging target _today_ both for nginx and apache which makes them compatible with journald. Do not use /dev/stderr. If you are in a shell script replace this: echo foobar /dev/stderr with this echo foobar 12 The latter will just duplicate stdin to stderr, the former will reopen stdin as stderr. Which is a difference, though an non-obvious one, that is further complicated that GNU bash (though not necessarily other shells) actually automatically do the second command if you pass it the first command. The first command does not work (in non-bash shells..) if stdout is a socket, the second command does. 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... Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [systemd-nspawn] nginx: [emerg] open() /dev/stderr failed (6: No such device or address)
Hmm, but that already lists a native config keyword for stderr? Yes, I saw that too late. I copied the default configuration of the Arch Linux nginx package and used that. ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [systemd-nspawn] nginx: [emerg] open() /dev/stderr failed (6: No such device or address)
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... Correct - see http://nginx.org/en/docs/ngx_core_module.html Syntax: error_log file | stderr | syslog:server=address[,parameter=value] | memory:size [debug | info | notice | warn | error | crit | alert | emerg]; Default: error_log logs/error.log error; Context: main, http, stream, server, location ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [systemd-nspawn] nginx: [emerg] open() /dev/stderr failed (6: No such device or address)
On Mon, Apr 27, 2015 at 9:11 PM, Peter Paule systemd-de...@fedux.org wrote: 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... Correct - see http://nginx.org/en/docs/ngx_core_module.html Syntax: error_log file | stderr | syslog:server=address[,parameter=value] | memory:size [debug | info | notice | warn | error | crit | alert | emerg]; Default: error_log logs/error.log error; Context: main, http, stream, server, location Hmm, but that already lists a native config keyword for stderr? -- Mantas Mikulėnas graw...@gmail.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [systemd-nspawn] nginx: [emerg] open() /dev/stderr failed (6: No such device or address)
Maybe syslog will do the trick? BTW: Do I need a syslog daemon to receive messages on UDP 514, or is/will be systemd-journal-remote able to handle this? Didn't found a clue about that in the man-page. ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [systemd-nspawn] nginx: [emerg] open() /dev/stderr failed (6: No such device or address)
Excerpts from Lennart Poettering's message of 2015-04-24 16:40:07 +0200: Hmm, I'm pretty sure the default StandardOutput=journal means stdout will be a socket connection to journald, doesn't it? Ah, true! (And since it's a process-specific thing, echo asdf /dev/stdout from an interactive shell will merely test the shell's stdout (which is a tty), not nginx's stdout...) Indeed. I figure /dev/stderr is simply not compatible with sockets, regardless if nspawn is in the mix or not... WHich actually came up before, and I think is someething to accept... Yes, I can confirm this. Using no service unit + running it with nspawn is successful: root@localhost ~ # /usr/bin/systemd-nspawn --register=no --ephemeral -M centos-nginx-systemd-latest dd if=/dev/zero of=/dev/stderr bs=1M count=5Spawning container centos-nginx-systemd-latest on /var/lib/machines/.#centos-nginx-systemd-latest0d04351874786361. Press ^] three times within 1s to kill container. 5+0 records in 5+0 records out 5242880 bytes (5.2 MB) copied, 0.236759 s, 22.1 MB/s Container centos-nginx-systemd-latest exited successfully. But it fails when it is started via service-unit: root@localhost ~ # systemctl start nginx@example_com root@localhost ~ # systemctl status nginx@example_com ● nginx@example_com.service - Webservice for example_com Loaded: loaded (/etc/systemd/system/nginx@.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Sun 2015-04-26 14:24:54 CEST; 2s ago Process: 5209 ExecStart=/usr/bin/dd if=/dev/zero of=/dev/stderr bs=1M count=5 (code=exited, status=1/FAILURE) Main PID: 5209 (code=exited, status=1/FAILURE) Apr 26 14:24:54 localhost systemd[1]: Started Webservice for example_com. Apr 26 14:24:54 localhost systemd[1]: Starting Webservice for example_com... Apr 26 14:24:54 localhost systemd[1]: nginx@example_com.service: main process exited, code=exited, status=1/FAILURE Apr 26 14:24:54 localhost systemd[1]: Unit nginx@example_com.service entered failed state. Apr 26 14:24:54 localhost systemd[1]: nginx@example_com.service failed. Apr 26 14:24:54 localhost dd[5209]: /usr/bin/dd: failed to open ‘/dev/stderr’: No such device or address 3 root@localhost ~ # People should really use the shell construct 2 instead of /dev/stderr if they want the redirect to work always. BTW: I did the `echo asdf /dev/stderr`-thing just to test if `/dev/stderr` worked as expected. What I do not understand is: What changed in systemd that the service-unit-thing worked in some earlier versions? And what can I do to make it work again? There seems to be no other logging target _today_ both for nginx and apache which makes them compatible with journald. /pp ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [systemd-nspawn] nginx: [emerg] open() /dev/stderr failed (6: No such device or address)
What happens if you use dd to write to /dev/stdout? Does that work, too? (i think that bash handles /dev/stderr specially when you use it with redirection, that's why I am asking). I modified the unit file to use dd instead of nginx. I can reproduce the issue. By mistake I forgot to add the systemd-nspawn call. [Unit] Description=Webservice for %I [Service] ExecStart=/usr/bin/dd if=/dev/zero of=/dev/stderr bs=1M count=5 KillMode=process KillSignal=SIGINT SendSIGKILL=no After that I started the service and checked its status: % root@localhost ~/tmp/centos-nginx/files/machines (git)-[master] # systemctl status nginx@example_com ● nginx@example_com.service - Webservice for example_com Loaded: loaded (/etc/systemd/system/nginx@.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Sun 2015-04-26 14:09:10 CEST; 1s ago Process: 5124 ExecStart=/usr/bin/dd if=/dev/zero of=/dev/stderr bs=1M count=5 (code=exited, status=1/FAILURE) Main PID: 5124 (code=exited, status=1/FAILURE) Apr 26 14:09:10 localhost systemd[1]: Started Webservice for example_com. Apr 26 14:09:10 localhost systemd[1]: Starting Webservice for example_com... Apr 26 14:09:10 localhost dd[5124]: /usr/bin/dd: failed to open ‘/dev/stderr’: No such device or address Apr 26 14:09:10 localhost systemd[1]: nginx@example_com.service: main process exited, code=exited, status=1/FAILURE Apr 26 14:09:10 localhost systemd[1]: Unit nginx@example_com.service entered failed state. Apr 26 14:09:10 localhost systemd[1]: nginx@example_com.service failed. Thus the error seems to be not a problem of systemd-nspawn. ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [systemd-nspawn] nginx: [emerg] open() /dev/stderr failed (6: No such device or address)
Hi, I run nginx in a CentOS 7.0 container via systemd-nspawn. nginx logs to stderr/stdout via configuration to capture logs via journald. nginx.conf error_log /dev/stderr warn; If I use systemd 219-1 (-1 is the package number of Arch Linux) which seems to be a non-patched systemd 219, everything is fine. If I upgrade to systemd 219-6, nginx cannot be started via systemd-nspawn. systemd 219-6 includes this patch https://projects.archlinux.org/svntogit/packages.git/tree/repos/core-x86_64/0001-nspawn-when-connected-to-pipes-for-stdin-stdout-pass.patch?h=packages/systemd;. BTW: I see the same error if I use systemd-git-HEAD. I see the following errors in journal - I tried bot stderr and stdout. Apr 24 04:48:12 server systemd-nspawn[421]: nginx: [emerg] open() /dev/stdout failed (6: No such device or address) Apr 24 04:48:45 server systemd-nspawn[496]: nginx: [emerg] open() /dev/stderr failed (6: No such device or address) If I run the container with sudo /usr/bin/systemd-nspawn --register=no -M docker-centos-nginx And check if the device exists, everything looks fine: [root@docker-centos-nginx ~]# ls -al /dev/stderr lrwxrwxrwx 1 root root 15 Apr 24 09:51 /dev/stderr - /proc/self/fd/2 [root@docker-centos-nginx ~]# ls -al /dev/stdout lrwxrwxrwx 1 root root 15 Apr 24 09:51 /dev/stdout - /proc/self/fd/1 [root@docker-centos-nginx ~]# echo asdf /dev/stdout asdf [root@docker-centos-nginx ~]# echo asdf /dev/stderr asdf Journal: Apr 24 00:00:05 server systemd[1]: Stopping Webservice for server... Apr 24 00:00:05 server systemd-nspawn[23539]: Container docker-centos-nginx terminated by signal KILL. Apr 24 00:00:05 server systemd[1]: nginx@server.service: main process exited, code=exited, status=1/FAILURE Apr 24 00:00:05 server systemd[1]: Unit nginx@server.service entered failed state. Apr 24 00:00:05 server systemd[1]: nginx@server.service failed. Apr 24 00:00:06 server systemd[1]: Started Webservice for server. Apr 24 00:00:06 server systemd[1]: Starting Webservice for server... Apr 24 00:00:06 server systemd[1]: Stopping Webservice for server... Apr 24 00:00:06 server systemd[1]: Started Webservice for server. Apr 24 00:00:06 server systemd[1]: Starting Webservice for server... Apr 24 00:00:07 server systemd-nspawn[11016]: Spawning container docker-centos-nginx on /var/lib/machines/.#docker-centos-nginxb8dda432a4303288. Apr 24 00:00:07 server systemd-nspawn[11016]: Press ^] three times within 1s to kill container. Apr 24 04:43:31 server systemd[1]: Stopping Webservice for server... Apr 24 04:43:31 server systemd-nspawn[11016]: Container docker-centos-nginx terminated by signal KILL. Apr 24 04:43:31 server systemd[1]: nginx@server.service: main process exited, code=exited, status=1/FAILURE Apr 24 04:43:31 server systemd[1]: Stopped Webservice for server. Apr 24 04:43:31 server systemd[1]: Unit nginx@server.service entered failed state. Apr 24 04:43:31 server systemd[1]: nginx@server.service failed. -- Reboot -- Apr 24 04:47:07 server systemd-nspawn[238]: nginx: [emerg] open() /dev/stdout failed (6: No such device or address) Apr 24 04:48:08 server systemd-nspawn[392]: nginx: [emerg] open() /dev/stdout failed (6: No such device or address) Apr 24 04:48:12 server systemd-nspawn[421]: nginx: [emerg] open() /dev/stdout failed (6: No such device or address) Apr 24 04:48:45 server systemd-nspawn[496]: nginx: [emerg] open() /dev/stderr failed (6: No such device or address) Any idea how to solve this issue? /pp ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [systemd-nspawn] nginx: [emerg] open() /dev/stderr failed (6: No such device or address)
On Fri, 24.04.15 16:51, Mantas Mikulėnas (graw...@gmail.com) wrote: On Fri, Apr 24, 2015 at 4:24 PM, Lennart Poettering lenn...@poettering.net wrote: On Fri, 24.04.15 12:06, Peter Paule (systemd-de...@fedux.org) wrote: Hi, I run nginx in a CentOS 7.0 container via systemd-nspawn. nginx logs to stderr/stdout via configuration to capture logs via journald. nginx.conf error_log /dev/stderr warn; If I use systemd 219-1 (-1 is the package number of Arch Linux) which seems to be a non-patched systemd 219, everything is fine. If I upgrade to systemd 219-6, nginx cannot be started via systemd-nspawn. systemd 219-6 includes this patch https://projects.archlinux.org/svntogit/packages.git/tree/repos/core-x86_64/0001-nspawn-when-connected-to-pipes-for-stdin-stdout-pass.patch?h=packages/systemd;. BTW: I see the same error if I use systemd-git-HEAD. I see the following errors in journal - I tried bot stderr and stdout. Apr 24 04:48:12 server systemd-nspawn[421]: nginx: [emerg] open() /dev/stdout failed (6: No such device or address) Apr 24 04:48:45 server systemd-nspawn[496]: nginx: [emerg] open() /dev/stderr failed (6: No such device or address) Any idea what the precise syscall is that triggers that? i.e. what strace says? It kind of makes sense when stdout is a socket, since open(/dev/stdout) or open(/proc/self/fd/*) doesn't just dup that fd, it tries to open the file anew (including permission checks and everything). A bit annoying. Well, but it's not a socket here, is it? Peter? Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [systemd-nspawn] nginx: [emerg] open() /dev/stderr failed (6: No such device or address)
On Fri, 24.04.15 12:06, Peter Paule (systemd-de...@fedux.org) wrote: Hi, I run nginx in a CentOS 7.0 container via systemd-nspawn. nginx logs to stderr/stdout via configuration to capture logs via journald. nginx.conf error_log /dev/stderr warn; If I use systemd 219-1 (-1 is the package number of Arch Linux) which seems to be a non-patched systemd 219, everything is fine. If I upgrade to systemd 219-6, nginx cannot be started via systemd-nspawn. systemd 219-6 includes this patch https://projects.archlinux.org/svntogit/packages.git/tree/repos/core-x86_64/0001-nspawn-when-connected-to-pipes-for-stdin-stdout-pass.patch?h=packages/systemd;. BTW: I see the same error if I use systemd-git-HEAD. I see the following errors in journal - I tried bot stderr and stdout. Apr 24 04:48:12 server systemd-nspawn[421]: nginx: [emerg] open() /dev/stdout failed (6: No such device or address) Apr 24 04:48:45 server systemd-nspawn[496]: nginx: [emerg] open() /dev/stderr failed (6: No such device or address) Any idea what the precise syscall is that triggers that? i.e. what strace says? If I run the container with sudo /usr/bin/systemd-nspawn --register=no -M docker-centos-nginx What happens if you use nsenter instead to join all namespaces of the running nginx container and invoke a shell there, and then try to acess /dev/stderr? Does this also work? What happens if you use dd to write to /dev/stdout? Does that work, too? (i think that bash handles /dev/stderr specially when you use it with redirection, that's why I am asking). Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [systemd-nspawn] nginx: [emerg] open() /dev/stderr failed (6: No such device or address)
On Fri, Apr 24, 2015 at 4:24 PM, Lennart Poettering lenn...@poettering.net wrote: On Fri, 24.04.15 12:06, Peter Paule (systemd-de...@fedux.org) wrote: Hi, I run nginx in a CentOS 7.0 container via systemd-nspawn. nginx logs to stderr/stdout via configuration to capture logs via journald. nginx.conf error_log /dev/stderr warn; If I use systemd 219-1 (-1 is the package number of Arch Linux) which seems to be a non-patched systemd 219, everything is fine. If I upgrade to systemd 219-6, nginx cannot be started via systemd-nspawn. systemd 219-6 includes this patch https://projects.archlinux.org/svntogit/packages.git/tree/repos/core-x86_64/0001-nspawn-when-connected-to-pipes-for-stdin-stdout-pass.patch?h=packages/systemd;. BTW: I see the same error if I use systemd-git-HEAD. I see the following errors in journal - I tried bot stderr and stdout. Apr 24 04:48:12 server systemd-nspawn[421]: nginx: [emerg] open() /dev/stdout failed (6: No such device or address) Apr 24 04:48:45 server systemd-nspawn[496]: nginx: [emerg] open() /dev/stderr failed (6: No such device or address) Any idea what the precise syscall is that triggers that? i.e. what strace says? It kind of makes sense when stdout is a socket, since open(/dev/stdout) or open(/proc/self/fd/*) doesn't just dup that fd, it tries to open the file anew (including permission checks and everything). A bit annoying. -- Mantas Mikulėnas graw...@gmail.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [systemd-nspawn] nginx: [emerg] open() /dev/stderr failed (6: No such device or address)
On Fri, Apr 24, 2015 at 4:53 PM, Lennart Poettering lenn...@poettering.net wrote: On Fri, 24.04.15 16:51, Mantas Mikulėnas (graw...@gmail.com) wrote: On Fri, Apr 24, 2015 at 4:24 PM, Lennart Poettering lenn...@poettering.net wrote: On Fri, 24.04.15 12:06, Peter Paule (systemd-de...@fedux.org) wrote: Hi, I run nginx in a CentOS 7.0 container via systemd-nspawn. nginx logs to stderr/stdout via configuration to capture logs via journald. nginx.conf error_log /dev/stderr warn; If I use systemd 219-1 (-1 is the package number of Arch Linux) which seems to be a non-patched systemd 219, everything is fine. If I upgrade to systemd 219-6, nginx cannot be started via systemd-nspawn. systemd 219-6 includes this patch https://projects.archlinux.org/svntogit/packages.git/tree/repos/core-x86_64/0001-nspawn-when-connected-to-pipes-for-stdin-stdout-pass.patch?h=packages/systemd;. BTW: I see the same error if I use systemd-git-HEAD. I see the following errors in journal - I tried bot stderr and stdout. Apr 24 04:48:12 server systemd-nspawn[421]: nginx: [emerg] open() /dev/stdout failed (6: No such device or address) Apr 24 04:48:45 server systemd-nspawn[496]: nginx: [emerg] open() /dev/stderr failed (6: No such device or address) Any idea what the precise syscall is that triggers that? i.e. what strace says? It kind of makes sense when stdout is a socket, since open(/dev/stdout) or open(/proc/self/fd/*) doesn't just dup that fd, it tries to open the file anew (including permission checks and everything). A bit annoying. Well, but it's not a socket here, is it? Peter? Hmm, I'm pretty sure the default StandardOutput=journal means stdout will be a socket connection to journald, doesn't it? (And since it's a process-specific thing, echo asdf /dev/stdout from an interactive shell will merely test the shell's stdout (which is a tty), not nginx's stdout...) -- Mantas Mikulėnas graw...@gmail.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [systemd-nspawn] nginx: [emerg] open() /dev/stderr failed (6: No such device or address)
On Fri, 24.04.15 17:33, Mantas Mikulėnas (graw...@gmail.com) wrote: Any idea what the precise syscall is that triggers that? i.e. what strace says? It kind of makes sense when stdout is a socket, since open(/dev/stdout) or open(/proc/self/fd/*) doesn't just dup that fd, it tries to open the file anew (including permission checks and everything). A bit annoying. Well, but it's not a socket here, is it? Peter? Hmm, I'm pretty sure the default StandardOutput=journal means stdout will be a socket connection to journald, doesn't it? Ah, true! (And since it's a process-specific thing, echo asdf /dev/stdout from an interactive shell will merely test the shell's stdout (which is a tty), not nginx's stdout...) Indeed. I figure /dev/stderr is simply not compatible with sockets, regardless if nspawn is in the mix or not... WHich actually came up before, and I think is someething to accept... People should really use the shell construct 2 instead of /dev/stderr if they want the redirect to work always. Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel