[systemd-devel] [systemd-nspawn] nginx: [emerg] open() "/dev/stderr" failed (6: No such device or address)

Peter Paule systemd-devel at fedux.org
Fri Apr 24 03:06:34 PDT 2015


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 at docker-centos-nginx ~]# ls -al /dev/stderr
   lrwxrwxrwx 1 root root 15 Apr 24 09:51 /dev/stderr -> /proc/self/fd/2
   [root at docker-centos-nginx ~]# ls -al /dev/stdout
   lrwxrwxrwx 1 root root 15 Apr 24 09:51 /dev/stdout -> /proc/self/fd/1
   [root at docker-centos-nginx ~]# echo "asdf" > /dev/stdout
   asdf
   [root at 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 at server.service: main  
process exited, code=exited, status=1/FAILURE
   Apr 24 00:00:05 server systemd[1]: Unit nginx at server.service  
entered failed state.
   Apr 24 00:00:05 server systemd[1]: nginx at 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 at 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 at server.service  
entered failed state.
   Apr 24 04:43:31 server systemd[1]: nginx at 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



More information about the systemd-devel mailing list