Skip to content

Commit

Permalink
Fix unreadable output in upgrade log
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dkubek committed Jan 8, 2025
1 parent 3c3421a commit a44e601
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion repos/system_upgrade/common/libraries/mounting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit a44e601

Please sign in to comment.