]> git.feebdaed.xyz Git - 0xmirror/runc.git/commit
runc create/run/exec: show fatal errors from init
authorKir Kolyshkin <kolyshkin@gmail.com>
Mon, 6 Oct 2025 20:48:27 +0000 (13:48 -0700)
committerKir Kolyshkin <kolyshkin@gmail.com>
Sat, 22 Nov 2025 05:11:20 +0000 (12:11 +0700)
commitf944ccecb2918731cf8260c46e71c4c400bbc05b
treef92c05ab9612334a9929fd1acc8e3bc1776494ff
parent21ad0e439911b87273faef1adb5adf0ffc8461b7
runc create/run/exec: show fatal errors from init

In case early stage of runc init (nsenter) fails for some reason, it
logs error(s) with FATAL log level, via bail().

The runc init log is read by a parent (runc create/run/exec) and is
logged via normal logrus mechanism, which is all fine and dandy, except
when `runc init` fails, we return the error from the parent (which is
usually not too helpful, for example):

runc run failed: unable to start container process: can't get final child's PID from pipe: EOF

Now, the actual underlying error is from runc init and it was logged
earlier; here's how full runc output looks like:

FATA[0000] nsexec-1[3247792]: failed to unshare remaining namespaces: No space left on device
FATA[0000] nsexec-0[3247790]: failed to sync with stage-1: next state
ERRO[0000] runc run failed: unable to start container process: can't get final child's PID from pipe: EOF

The problem is, upper level runtimes tend to ignore everything except
the last line from runc, and thus error reported by e.g. docker is not
very helpful.

This patch tries to improve the situation by collecting FATAL errors
from runc init and appending those to the error returned (instead of
logging). With it, the above error will look like this:

ERRO[0000] runc run failed: unable to start container process: can't get final child's PID from pipe: EOF; runc init error(s): nsexec-1[141549]: failed to unshare remaining namespaces: No space left on device; nsexec-0[141547]: failed to sync with stage-1: next state

Yes, it is long and ugly, but at least the upper level runtime will
report it.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
libcontainer/container_linux.go
libcontainer/logs/logs.go