From ebf1c4f01581f045dbd5935dac95fe9aed11bcab Mon Sep 17 00:00:00 2001 From: Jiri Konecny Date: Tue, 5 Nov 2024 10:13:50 +0100 Subject: [PATCH] Suppress warning from systemd user session Anaconda is starting systemd --user for RDP session. This unfortunately, will result in message: ``` Failed to adjust memory pressure threshold, ignoring: Device or resource busy ``` This message is printed directly to terminal and bypassing stdout or stderr. Force this message to be logged to the journal instead of terminal. Suggested-by: Lukas Nykryn (cherry picked from commit f47ca11bfe4f082258612450323b9268010190b2) Resolves: RHEL-67911 --- pyanaconda/display.py | 5 ++++- tests/unit_tests/pyanaconda_tests/test_display.py | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pyanaconda/display.py b/pyanaconda/display.py index 2a9d2b062d6..112462e2fbd 100644 --- a/pyanaconda/display.py +++ b/pyanaconda/display.py @@ -77,7 +77,10 @@ def start_user_systemd(): # Start the user instance of systemd. This call will also cause the launch of # dbus-broker and start a session bus at XDG_RUNTIME_DIR/bus. - childproc = util.startProgram(["/usr/lib/systemd/systemd", "--user"]) + # Without SYSTEMD_LOG_TARGET variable the systemd is logging directly to terminal + # bypassing stdout and stderr + childproc = util.startProgram(["/usr/lib/systemd/systemd", "--user"], + env_add={"SYSTEMD_LOG_TARGET": "journal-or-kmsg"}) WatchProcesses.watch_process(childproc, "systemd") # Set up the session bus address. Some services started by Anaconda might call diff --git a/tests/unit_tests/pyanaconda_tests/test_display.py b/tests/unit_tests/pyanaconda_tests/test_display.py index adf5b37ca59..231061b063a 100644 --- a/tests/unit_tests/pyanaconda_tests/test_display.py +++ b/tests/unit_tests/pyanaconda_tests/test_display.py @@ -45,7 +45,8 @@ def test_start_user_systemd(self, util_mock, conf_mock, watch_mock): start_user_systemd() util_mock.startProgram.assert_called_once_with( - ["/usr/lib/systemd/systemd", "--user"] + ["/usr/lib/systemd/systemd", "--user"], + env_add={"SYSTEMD_LOG_TARGET": "journal-or-kmsg"} ) watch_mock.watch_process.assert_called_once_with( 100, "systemd"