Bug 1843974

Summary: File restoration doesn't work as expected when it is not owned by an rpm but available in /usr/etc/
Product: OpenShift Container Platform Reporter: Sinny Kumari <skumari>
Component: Machine Config OperatorAssignee: Sinny Kumari <skumari>
Status: CLOSED ERRATA QA Contact: Yu Qi Zhang <jerzhang>
Severity: high Docs Contact:
Priority: high    
Version: 4.6CC: amurdaca, jerzhang, walters
Target Milestone: ---   
Target Release: 4.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1845492 1845494 (view as bug list) Environment:
Last Closed: 2020-10-27 16:05:23 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: 1845457    

Description Sinny Kumari 2020-06-04 14:17:20 UTC
Description of problem:
In some situation original file doesn't get restored while they are available in /usr/etc/.

How reproducible:
Reproducible when try to modify a file available in /usr/etc/ and /etc/ but not owned by any rpm.

Steps to Reproduce:

1. Install a 4.6 or older version cluster (also observed on 4.3). Get shell access into one of the worker node. Notice that /etc/iscsi/initiatorname.iscsi and /usr/etc/initiatorname.iscsi both exist but not owned by any rpm package.

$ rpm -qf /etc/iscsi/initiatorname.iscsi 
file /etc/iscsi/initiatorname.iscsi is not owned by any package

2. Create following Machinconfig

$ cat iscsi-mc.yaml 
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
metadata:
  labels:
    machineconfiguration.openshift.io/role: worker
  name: 99-iscsi-initiator
spec:
  config:
    ignition:
      version: 2.2.0
    storage:
      files:
        - contents:
            source: data:text/plain;charset=utf-8;base64,SW5pdGlhdG9yTmFtZT1pcW4uMTk5NC0wNS5jb20ubnV0YW5peDprOHMtd29ya2VyCg==
          filesystem: root
          mode: 420
          path: /etc/iscsi/initiatorname.iscsi

2. Apply the Machinconfig by running `oc create -f iscsi-mc.yaml`
3. MachineConfig is successfully applied on worker node, can be verified by getting access to one of worker node and check content of /etc/iscsi/initiatorname.iscsi
3. Now delete the applied MachineConfig by running `oc delete mc 99-iscsi-initiator`
4. Observe the MCD log and will see in the log
"Deleting stale config file: /etc/iscsi/initiatorname.iscsi"

Expected results:
/etc/iscsi/initiatorname.iscsi gets restored with file content available in /usr/etc/iscsi/initiatorname.iscsi

Comment 2 Colin Walters 2020-06-05 13:25:29 UTC
Related https://github.com/open-iscsi/open-iscsi/pull/207

Comment 7 Yu Qi Zhang 2020-06-18 20:35:00 UTC
Tested with 4.6.0-0.nightly-2020-06-17-180933 with the steps mentioned. Can confirm that the file was correctly restored after MC is deleted.

Comment 9 errata-xmlrpc 2020-10-27 16:05:23 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 (OpenShift Container Platform 4.6 GA Images), 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:4196