cloud-init throws an error because the attribute 'run_dir' does not exist.

Solution Verified - Updated -

Issue

  • cloud-init.service fails with the error "systemd: Failed to start Initial cloud-init job (pre-networking)"
  • At that time, cloid-init throws the following error and traceback:

    2020-04-01 03:31:58,459 - util.py[WARNING]: failed stage init-local
    2020-04-01 03:31:58,459 - util.py[DEBUG]: failed stage init-local
    Traceback (most recent call last):
     File "/usr/lib/python2.7/site-packages/cloudinit/cmd/main.py", line 652, in status_wrapper
       ret = functor(name, args)
     File "/usr/lib/python2.7/site-packages/cloudinit/cmd/main.py", line 351, in main_init
       _maybe_persist_instance_data(init)
     File "/usr/lib/python2.7/site-packages/cloudinit/cmd/main.py", line 694, in _maybe_persist_instance_data
       init.datasource.persist_instance_data()
     File "/usr/lib/python2.7/site-packages/cloudinit/sources/__init__.py", line 304, in persist_instance_data
       json_file = os.path.join(self.paths.run_dir, INSTANCE_JSON_FILE)
    AttributeError: 'Paths' object has no attribute 'run_dir'
    

Environment

  • Red Hat Enterprise Linux 7
  • cloud-init-18.2.1 and later

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content