Bug 1867960

Summary: RHEL8 installation failed with PCI-DSS profile with a file which name contains non-utf8 characters.
Product: Red Hat Enterprise Linux 8 Reporter: Masahiro Matsuya <mmatsuya>
Component: oscap-anaconda-addonAssignee: Matěj Týč <matyc>
Status: CLOSED ERRATA QA Contact: Release Test Team <release-test-team-automation>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.2CC: mhaicman, pjanda, pzatko, wsato
Target Milestone: rcKeywords: Patch
Target Release: 8.0   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-11-04 03:46:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1812825    

Description Masahiro Matsuya 2020-08-11 09:24:47 UTC
Description of problem:

The customer reported an RHEL8 installation failure caused by the oscap command to apply the PCI-DSS profile.

The actual root cause was the existence of a custom file which name contains an unexpected characters. The customer could resolve the installation failure by removing the file, but he is expecting that the installation doesn't fail with this kind of the python code exception. The installation could not complete with this problem.

Please backport this one: https://github.com/OpenSCAP/oscap-anaconda-addon/pull/124 to fix it.

This is the anaconda exception with UnicodeDecodeError, and the installation could not finish.

anaconda 29.19.2.17 exception report
Traceback (most recent call first):
File "/usr/share/anaconda/addons/org_fedora_oscap/common.py", line 140, in execute
self.stderr = stderr.decode()
File "/usr/share/anaconda/addons/org_fedora_oscap/common.py", line 269, in run_oscap_remediate
proc.execute(preexec_fn=do_chroot)
File "/usr/share/anaconda/addons/org_fedora_oscap/ks/oscap.py", line 549, in execute
chroot=getSysroot())
File "/usr/lib64/python3.6/site-packages/pyanaconda/addons.py", line 92, in execute
v.execute(storage, ksdata, instClass, users, payload)
File "/usr/lib64/python3.6/site-packages/pyanaconda/installation_tasks.py", line 446, in run_task
self._task(*self._task_args, **self._task_kwargs)
File "/usr/lib64/python3.6/site-packages/pyanaconda/installation_tasks.py", line 453, in run_task
raise e
File "/usr/lib64/python3.6/site-packages/pyanaconda/installation_tasks.py", line 487, in start
self.run_task()
File "/usr/lib64/python3.6/site-packages/pyanaconda/installation_tasks.py", line 311, in start
item.start()
File "/usr/lib64/python3.6/site-packages/pyanaconda/installation_tasks.py", line 311, in start
item.start()
File "/usr/lib64/python3.6/site-packages/pyanaconda/installation.py", line 211, in doConfiguration
configuration_queue.start()
File "/usr/lib64/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/usr/lib64/python3.6/site-packages/pyanaconda/threading.py", line 286, in run
threading.Thread.run(self)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc7 in position 558: invalid continuation byte



Version-Release number of selected component (if applicable):
RHEL8.2

How reproducible:
Always by locating a file which name is not UTF-8 

Steps to Reproduce:
1. Start RHEL8.2 installation
2. Locate a file which name is not UTF-8 into /root
Or, use pre-existing filesystem including such a file for the installation.
3. Select PCI-DSS security policy

Actual results:
The installation failed with unexpected unknown error.

Expected results:
The installation can complete, and the oscap problem can be reviewed after installation.

Comment 3 Matěj Týč 2020-08-11 12:53:04 UTC
This issue touches very peculiar waters of filename encoding. IIRC, there is no way for the scanner to know what filename encoding does a particular filesystem use, so fixing such issues reliably is very difficult.
This patch should improve the situation on the Anaconda side, and it looks like that there is no other problem (i.e. oscap doesn't crash), so there is a high likelihood that the issue is indeed fixed.

This usually happens on network drives that are shared across multiple OSs, and therefore more likely to contain problematic filename encoding. Could you please check out whether the file was on a network filesystem? If you know which rule caused this, that would be awesome, but that's more difficult to find out.
I am asking because it could be that there is a glitch in the content as well.

Comment 5 Petr Janda 2020-08-17 17:02:42 UTC
Reproduced on RHEL-8.3.0-20200811.0 x86_64

steps to reproduce by manual installation
setup:
- prepare machine with separate /data filesystem (minimal packageset is enough)
- put file with problematic name to /data/
  $ touch /data/$(echo "00000000: 5468 6174 47c7 d673 2063 6f72 7265 6374  ThatG..s correct" | xxd -r)

test:
- start new installation
- choose custom patritioning
- instruct installer to reuse and NOT reformat /data partition
- choose PCI-DSS security policy
- start installation (minimal packageset is enough)
it stops with traceback

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc7 in position 558: invalid continuation byte

Comment 14 errata-xmlrpc 2020-11-04 03:46:16 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (oscap-anaconda-addon bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:4772