Skip to content

Commit

Permalink
systemd: Add a temporary console fix until moby fixes it
Browse files Browse the repository at this point in the history
This issue affects console output when running systemd in docker container
because moby doesn't correctly manage POLLHUP hangup. The issue was initially
created in systemd systemd/systemd#4262 and later
redirected to moby moby/moby#27202 .

This affects versions after 232 where fd0 fd1 fd2 are redirected to /dev/null
leaving no file descriptor pointing to /dev/console. When that happens docker,
the pty master, will close the pty and any attempts to open /dev/console will
return EIO.

This patch removes the /dev/null redirection when running in container. We can
get rid of it when moby fixes the issue referenced above.

Change-type: patch
CHangelog-entry: Fix console output when running resinOS with systemd >= 232
Signed-off-by: Andrei Gherzan <[email protected]>
  • Loading branch information
Andrei Gherzan authored and agherzan committed Feb 22, 2018
1 parent 9cc6ef9 commit 7cd1ccd
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
From 79ad9002612611a4aabfffe6d9c8bca5c7253e4a Mon Sep 17 00:00:00 2001
From: Andrei Gherzan <[email protected]>
Date: Mon, 19 Feb 2018 14:06:06 +0000
Subject: [PATCH] core: Don't redirect stdio to null when running in container

Upstream-status: Rejected [https://github.com/systemd/systemd/pull/8220]
Signed-off-by: Andrei Gherzan <[email protected]>
---
src/core/main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/core/main.c b/src/core/main.c
index 9460261..f4d6410 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1531,7 +1531,8 @@ int main(int argc, char *argv[]) {
* need to do that for user instances since they never log
* into the console. */
log_show_color(colors_enabled());
- r = make_null_stdio();
+ if (detect_container() <= 0)
+ r = make_null_stdio();
if (r < 0)
log_warning_errno(r, "Failed to redirect standard streams to /dev/null: %m");
}
--
2.7.4

5 changes: 5 additions & 0 deletions meta-resin-pyro/recipes-core/systemd/systemd_%.bbappend
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FILESEXTRAPATHS_append := ":${THISDIR}/${PN}"

SRC_URI_append = " \
file://0001-core-Don-t-redirect-stdio-to-null-when-running-in-co.patch \
"

0 comments on commit 7cd1ccd

Please sign in to comment.