daandemeyer / rpms / systemd

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