Blame SOURCES/0226-core-try-to-reopen-dev-kmsg-again-right-after-mounti.patch

ddca0b
From 985837dab9c892858a92ae50043843307f5e0714 Mon Sep 17 00:00:00 2001
ddca0b
From: Lennart Poettering <lennart@poettering.net>
ddca0b
Date: Fri, 19 Jul 2019 18:29:11 +0200
ddca0b
Subject: [PATCH] core: try to reopen /dev/kmsg again right after mounting /dev
ddca0b
ddca0b
I was debugging stuff during early boot, and was confused that I never
ddca0b
found the logs for it in kmsg. The reason for that was that /proc is
ddca0b
generally not mounted the first time we do log_open() and hence
ddca0b
log_set_target(LOG_TARGET_KMSG) we do when running as PID 1 had not
ddca0b
effect. A lot later during start-up we call log_open() again where this
ddca0b
is fixed (after the point where we close all remaining fds still open),
ddca0b
but in the meantime no logs every got written to kmsg. This patch fixes
ddca0b
that.
ddca0b
ddca0b
(cherry picked from commit 0a2eef1ee1fef74be9d12f7dc4d0006b645b579c)
ddca0b
ddca0b
Resolves: #1749212
ddca0b
---
ddca0b
 src/core/main.c | 5 +++++
ddca0b
 1 file changed, 5 insertions(+)
ddca0b
ddca0b
diff --git a/src/core/main.c b/src/core/main.c
ddca0b
index 44dd8348be..af7b26d6f1 100644
ddca0b
--- a/src/core/main.c
ddca0b
+++ b/src/core/main.c
ddca0b
@@ -2215,6 +2215,11 @@ int main(int argc, char *argv[]) {
ddca0b
                                         goto finish;
ddca0b
                                 }
ddca0b
 
ddca0b
+                                /* Let's open the log backend a second time, in case the first time didn't
ddca0b
+                                 * work. Quite possibly we have mounted /dev just now, so /dev/kmsg became
ddca0b
+                                 * available, and it previously wasn't. */
ddca0b
+                                log_open();
ddca0b
+
ddca0b
                                 r = initialize_security(
ddca0b
                                                 &loaded_policy,
ddca0b
                                                 &security_start_timestamp,