RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1744526 - [cloud-init][RHEL7][OpenStack] cloud-init can't persist instance-data.json
Summary: [cloud-init][RHEL7][OpenStack] cloud-init can't persist instance-data.json
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: cloud-init
Version: 7.6
Hardware: x86_64
OS: Linux
high
urgent
Target Milestone: rc
: ---
Assignee: Eduardo Otubo
QA Contact: Yuhui Jiang
URL:
Whiteboard:
: 1745381 1757787 (view as bug list)
Depends On:
Blocks: 1744718 1757907 1822233 1822234
TreeView+ depends on / blocked
 
Reported: 2019-08-22 10:42 UTC by Yuhui Jiang
Modified: 2024-11-20 07:54 UTC (History)
16 users (show)

Fixed In Version: cloud-init-18.5-6.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1744718 1822233 1822234 (view as bug list)
Environment:
Last Closed: 2020-03-31 20:07:08 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker CEECBA-5735 0 None None None 2021-09-02 08:09:42 UTC
Red Hat Knowledge Base (Solution) 4875331 0 None None None 2020-03-04 23:21:20 UTC
Red Hat Product Errata RHBA-2020:1155 0 None None None 2020-03-31 20:07:42 UTC

Description Yuhui Jiang 2019-08-22 10:42:46 UTC
Description of problem:
There are some datas can't be dumped by json module, so cloud-init print an error log, and cloud-init can't write data to instance-data.json. This issue is same as bz#1631167

Version-Release number of selected component (if applicable):
RHEL7.7
cloud-init-18.2-5.el7.x86_64.rpm
cloud-init-18.5-1.el7.x86_64.rpm

How reproducible:
100%

Steps to Reproduce:
1. Create a vm on OpenStack with cloud-init installed
2. Login the vm and check cloud-init's log

Actual results:
2019-08-21 10:51:45,040 - __init__.py[WARNING]: Error persisting instance-data.json: 'utf8' codec can't decode byte 0xfa in position 0: invalid start byte

Expected results:
There shoudn't be this error log and can successfully write data to instance-data.json

Additional info:
Below is a part of code of /usr/lib/python2.7/site-packages/cloudinit/sources/__init__.py(I add some code into it to print some log)

    def get_data(self):
        """Datasources implement _get_data to setup metadata and userdata_raw.

        Minimally, the datasource should return a boolean True on success.
        """
        return_value = self._get_data()
        json_file = os.path.join(self.paths.run_dir, INSTANCE_JSON_FILE)
        if not return_value:
            return return_value

        instance_data = {
            'ds': {
                'meta-data': self.metadata,
                'user-data': self.get_userdata_raw(),
                'vendor-data': self.get_vendordata_raw()}}
        instance_data.update(
            self._get_standardized_metadata())
        try:
            LOG.error("===========")
            LOG.error(str(instance_data))
            LOG.error("===========")
            # Process content base64encoding unserializable values
            content = util.json_dumps(instance_data)
            # Strip base64: prefix and return base64-encoded-keys
            processed_data = process_base64_metadata(json.loads(content))
        except TypeError as e:
            LOG.warning('Error persisting instance-data.json: %s', str(e))
            return return_value
        except UnicodeDecodeError as e:
            LOG.warning('Error persisting instance-data.json: %s', str(e))
            return return_value
        write_json(json_file, processed_data, mode=0o600)
        return return_value

Below is the log

2019-08-21 10:51:45,039 - __init__.py[ERROR]: ===========
2019-08-21 10:51:45,040 - __init__.py[ERROR]: {'v1': {'region': None, 'local-hostname': u'yujiangcloudinitrun1', 'availability-zone': u'nova', 'instance-id': 'e75af6c7-6781-41bf-ab79-54ffb1169b75', 'cloud-name': 'openstack'}, 'ds': {'vendor-data': None, 'meta-data': {'local-hostname': u'yujiangcloudinitrun1', u'random_seed': '\xfa\xee\x1cb\x85\x8c\x1c\xf3\xb4%o\xf2n\x0b\xe5\xf4j\x86\xc5\xad;V\x1e\x82o\xb4\x93\x9f\x16\x1clRXr\xdc4\x03\xfc\xc8\xc9\xd4\x03\x01\x12?\xac\xa0.\x8b\x1f\xe1\x86\x01\x93\n"\xb1\xfe\x92\xd5t3l\xfe\xcf\xddG\x11wg\xb7f\xfb\xc2\x1f\xb3\xce\xb9\x98\xda=\xb2(\xf7\xd4\xad\x13\x93\x03]\xca6nG\xd48\xc3\x87/\xcb\x00\x9c4\xc76z\xb4\xc3\xaf=5\x99\xfb\xcbP\xbb\xb4\xa4\xc4\x82\x07ZyG\xd4\xb0Y;\xc5":\xae\x10\x9fd\xb0o\x0fNE\x06=\xe7\xb0\x80\xe7\xe4\x16-+H\x8e\xe910\x1a\x89s(\x7f\x0b\x98\x08F\x01\xb3Y\xeaA\x040Gd\xd2\xd9H\xd9\xe1yM\xc9\x93i=\xb7E\x95S\x9f\x8d\xea\xe4\t\xe4#\x12\xa9Y\xfcZ\xe9\x1e\xaf\xb3L\x0e\xd0\xedC\xb6y\xb1\x02\x8f\xd5kF\xca\xfed\xab&\xc5\x0cgCs\x17Y\xbd\xf0l.\x80"\xa6v6RL$\xb6\x8d7l\xdd\xaeE\x87\xc72\x98\xbf\xf8&\xad\xa0\'\x97\xe6\xe8\xb0\x95\xf0h,\xf9h\xd3\x91<\xb4z\xed?\x7f=W\x8e3\xdc\xbbR(\x1e\xbf\xd8\x8b\x91\xa7\xda1M\xd5Dk\x8fr\xf8\xdcM\xcbV\xf6\x8c\xa1\x00\xbe\xc5\xf1\xb1\x10\x7fU\xe9\xa5*N\xc1-\xb8\xb4\xea\x1b\x14OJ$\xd0=\xfejmL\xfeH\x1b|q\xbeh\xfb\xd0\x1a\xf7\xf9\x9b.\x1a\x95\xe8\x8b\x98\t\x9e\xe6\xd4\xd7\xd2xP\x1e\xd1"\xe8]\x89z\xcd\xd2>1(\xd4\xdb\xa3H\x1b\'@\xcfb\xdfB\xfe\xd3w\x92T\xe3\xb5\x89\xa4iqh\n)e\x9f\x0f\xc3\xfd\xf2G\x12\xf8R\x01K\',\xa5\xe79\x9d\xd9F\x92\x06\xfdA\x06]P\x98\x96\xc3\x8a\xa44\xdcO\xeakOWn\xd0\xc1\x7f\xe6,\x84ay\xf7\x10\xb4\xbcE\xcd\xab\x05\xad\xe1V\xff\x07\x83\xa2\xe5\xdb\xce\xc8R\x06\xe1I\x85\x11[:\xbd\x85[6\x1c#\xf3\xc1\xd1\xe4b\xba\xb3\x1a\xb6\xe2NzI\xee\x95\x98E|\xdc\x0e\xd1\n\x02\x99\xe0\x9e\x93\x0e\x0e\xb8\xc7Go', u'uuid': u'e75af6c7-6781-41bf-ab79-54ffb1169b75', u'availability_zone': u'nova', u'keys': [{u'type': u'ssh', u'data': u'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDBMeFwSPKrSdlUc2Tp9D5LTtOnyln4w6fzxyDz/TbOrwzPuFVB83kIyyeFwCh3b3Iq/5h0EFaeVFcGD3uwgtRWXlemB4zHNM3yiXaeVLwRUOS3jKtvAlYZQXNW0Kw3YirumVulo8gRXOicBMLVMDFr8uuo5qD/JxKMD8Stc+v6O7xJ9axhW/x/nqVaiG7s6gXUCDAuWpPiBGJHS5D21JRG6jWkdnDsr1hdROuKflZ7EykUiTcgQEMSwRCKqDL+MoNYGUm0VV5gHozefin49ZCYpNhpOtchcqNSLY4KpD4SNTQASzK/05wUy0GHEMLOEVF9Kgb1wOiX+0CWKyt/TVvr', u'name': u'yujiang'}], u'hostname': u'yujiangcloudinitrun1', u'launch_index': 0, u'public_keys': {u'yujiang': u'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDBMeFwSPKrSdlUc2Tp9D5LTtOnyln4w6fzxyDz/TbOrwzPuFVB83kIyyeFwCh3b3Iq/5h0EFaeVFcGD3uwgtRWXlemB4zHNM3yiXaeVLwRUOS3jKtvAlYZQXNW0Kw3YirumVulo8gRXOicBMLVMDFr8uuo5qD/JxKMD8Stc+v6O7xJ9axhW/x/nqVaiG7s6gXUCDAuWpPiBGJHS5D21JRG6jWkdnDsr1hdROuKflZ7EykUiTcgQEMSwRCKqDL+MoNYGUm0VV5gHozefin49ZCYpNhpOtchcqNSLY4KpD4SNTQASzK/05wUy0GHEMLOEVF9Kgb1wOiX+0CWKyt/TVvr'}, u'project_id': u'fb13525cb3a04702938869f90ebc1432', 'instance-id': u'e75af6c7-6781-41bf-ab79-54ffb1169b75', u'name': u'yujiangcloudinitrun1'}, 'user-data': ''}}
2019-08-21 10:51:45,040 - __init__.py[ERROR]: ===========

Due to the value of "random_seed" can't be handled by json, so cloud-init print the error log.

Comment 4 Yaju Cao 2019-08-26 02:58:02 UTC
*** Bug 1745381 has been marked as a duplicate of this bug. ***

Comment 12 Rick Barry 2019-10-08 20:11:03 UTC
*** Bug 1757787 has been marked as a duplicate of this bug. ***

Comment 23 Radosław Piliszek 2019-11-04 13:24:50 UTC
When will it be available for 7.7?

Comment 34 errata-xmlrpc 2020-03-31 20:07:08 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, 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:1155


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