Skip to content

Commit

Permalink
Suppress warning from systemd user session
Browse files Browse the repository at this point in the history
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 f47ca11)

Resolves: RHEL-67911
  • Loading branch information
jkonecny12 committed Nov 18, 2024
1 parent 5c10c74 commit 92ac0dd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion pyanaconda/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion tests/unit_tests/pyanaconda_tests/test_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 92ac0dd

Please sign in to comment.