Bug 1843974 - File restoration doesn't work as expected when it is not owned by an rpm but available in /usr/etc/
Summary: File restoration doesn't work as expected when it is not owned by an rpm but ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Machine Config Operator
Version: 4.6
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 4.6.0
Assignee: Sinny Kumari
QA Contact: Yu Qi Zhang
URL:
Whiteboard:
Depends On:
Blocks: 1845457
TreeView+ depends on / blocked
 
Reported: 2020-06-04 14:17 UTC by Sinny Kumari
Modified: 2020-10-27 16:05 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1845492 1845494 (view as bug list)
Environment:
Last Closed: 2020-10-27 16:05:23 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Github openshift machine-config-operator pull 1781 None closed Bug 1843974: daemon: fix restoring file logic to avoid unnecessary deletion 2020-11-26 13:00:33 UTC
Red Hat Product Errata RHBA-2020:4196 None None None 2020-10-27 16:05:49 UTC

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


Note You need to log in before you can comment on or make changes to this bug.