From a44e60135673033b3ee71a20b32ce670c5c9b182 Mon Sep 17 00:00:00 2001 From: David Kubek Date: Wed, 8 Jan 2025 12:05:57 +0100 Subject: [PATCH] Fix unreadable output in upgrade log This commit resolves an issue where unwanted escape sequences (e.g., ANSI codes) appear in the output of certain commands like `dnf` during upgrades. The issue arises because, starting with version 242, `systemd-nspawn` introduced new pseudo-TTY capabilities (see the `Input/Output Options` section in `systemd-nspawn(1)`). As a result, commands run within container may include these escape sequences. To address this, pseudo-TTY support is explicitly disabled in `systemd-nspawn` for upgrades on RHEL9 and later. JIRA: RHEL-69829 --- repos/system_upgrade/common/libraries/mounting.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/repos/system_upgrade/common/libraries/mounting.py b/repos/system_upgrade/common/libraries/mounting.py index a546e9d006..2eb19d315f 100644 --- a/repos/system_upgrade/common/libraries/mounting.py +++ b/repos/system_upgrade/common/libraries/mounting.py @@ -5,7 +5,7 @@ from collections import namedtuple from leapp.libraries.common.config import get_all_envs -from leapp.libraries.common.config.version import get_source_major_version +from leapp.libraries.common.config.version import get_source_major_version, matches_source_version from leapp.libraries.stdlib import api, CalledProcessError, run # Using ALWAYS_BIND will crash the upgrade process if the file does not exist. @@ -88,6 +88,9 @@ def make_command(self, cmd): # in such a case, just add line into the previous solution.. # TODO: the same about --capability=all final_cmd += ['--keep-unit', '--capability=all'] + if matches_source_version('>= 9.0'): + # Disable pseudo-TTY in container + final_cmd += ['--pipe'] return final_cmd + ['-D', self.target] + binds + setenvs + cmd class CHROOT(_Implementation):