← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1884819] [NEW] cloud-init service failed to start with FileExistsError: [Errno 17] File exists: '/var/lib/cloud/data'

 

Public bug reported:

When I restart cloud-init in a loop with the following script, I get the
error as mentioned in summary.

#Start of test script

#!/bin/bash

set -e

for i in {1..30}; do
  echo -n "$i "
  cloud-init clean -ls
  sleep 1
  systemctl restart cloud-*.service
done
echo ""

#End of test script

This is observed after applying fix: https://github.com/canonical/cloud-
init/commit/0755cff078d5931e1d8e151bdcb84afb92bc0f02

Error message is:

```
Jun 23 18:37:23 phdev cloud-init[2240]: Traceback (most recent call last):
Jun 23 18:37:23 phdev cloud-init[2240]:   File "/usr/bin/cloud-init", line 11, in <module>
Jun 23 18:37:23 phdev cloud-init[2240]:     load_entry_point('cloud-init==20.2', 'console_scripts', 'cloud-init')()
Jun 23 18:37:23 phdev cloud-init[2240]:   File "/usr/lib/python3.7/site-packages/cloudinit/cmd/main.py", line 893, in main
Jun 23 18:37:23 phdev cloud-init[2240]:     get_uptime=True, func=functor, args=(name, args))
Jun 23 18:37:23 phdev cloud-init[2240]:   File "/usr/lib/python3.7/site-packages/cloudinit/util.py", line 2618, in log_time
Jun 23 18:37:23 phdev cloud-init[2240]:     ret = func(*args, **kwargs)
Jun 23 18:37:23 phdev cloud-init[2240]:   File "/usr/lib/python3.7/site-packages/cloudinit/cmd/main.py", line 600, in status_wrapper
Jun 23 18:37:23 phdev cloud-init[2240]:     util.ensure_dirs((data_d, link_d,))
Jun 23 18:37:23 phdev cloud-init[2240]:   File "/usr/lib/python3.7/site-packages/cloudinit/util.py", line 1645, in ensure_dirs
Jun 23 18:37:23 phdev cloud-init[2240]:     ensure_dir(d, mode)
Jun 23 18:37:23 phdev cloud-init[2240]:   File "/usr/lib/python3.7/site-packages/cloudinit/util.py", line 1698, in ensure_dir
Jun 23 18:37:23 phdev cloud-init[2240]:     os.makedirs(path)
Jun 23 18:37:23 phdev cloud-init[2240]:   File "/usr/lib/python3.7/os.py", line 221, in makedirs
Jun 23 18:37:23 phdev cloud-init[2240]:     mkdir(name, mode)
Jun 23 18:37:23 phdev cloud-init[2240]: FileExistsError: [Errno 17] File exists: '/var/lib/cloud/data'
Jun 23 18:37:23 phdev systemd[1]: cloud-init.service: Main process exited, code=exited, status=1/FAILURE
Jun 23 18:37:23 phdev systemd[1]: cloud-init.service: Failed with result 'exit-code'.
Jun 23 18:37:23 phdev systemd[1]: Failed to start Initial cloud-init job (metadata service crawler).
```

Find the attached for the log tarball.

** Affects: cloud-init
     Importance: Undecided
         Status: New

** Attachment added: "cloud-init.tar.gz"
   https://bugs.launchpad.net/bugs/1884819/+attachment/5386540/+files/cloud-init.tar.gz

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1884819

Title:
  cloud-init service failed to start with FileExistsError: [Errno 17]
  File exists: '/var/lib/cloud/data'

Status in cloud-init:
  New

Bug description:
  When I restart cloud-init in a loop with the following script, I get
  the error as mentioned in summary.

  #Start of test script

  #!/bin/bash

  set -e

  for i in {1..30}; do
    echo -n "$i "
    cloud-init clean -ls
    sleep 1
    systemctl restart cloud-*.service
  done
  echo ""

  #End of test script

  This is observed after applying fix: https://github.com/canonical
  /cloud-init/commit/0755cff078d5931e1d8e151bdcb84afb92bc0f02

  Error message is:

  ```
  Jun 23 18:37:23 phdev cloud-init[2240]: Traceback (most recent call last):
  Jun 23 18:37:23 phdev cloud-init[2240]:   File "/usr/bin/cloud-init", line 11, in <module>
  Jun 23 18:37:23 phdev cloud-init[2240]:     load_entry_point('cloud-init==20.2', 'console_scripts', 'cloud-init')()
  Jun 23 18:37:23 phdev cloud-init[2240]:   File "/usr/lib/python3.7/site-packages/cloudinit/cmd/main.py", line 893, in main
  Jun 23 18:37:23 phdev cloud-init[2240]:     get_uptime=True, func=functor, args=(name, args))
  Jun 23 18:37:23 phdev cloud-init[2240]:   File "/usr/lib/python3.7/site-packages/cloudinit/util.py", line 2618, in log_time
  Jun 23 18:37:23 phdev cloud-init[2240]:     ret = func(*args, **kwargs)
  Jun 23 18:37:23 phdev cloud-init[2240]:   File "/usr/lib/python3.7/site-packages/cloudinit/cmd/main.py", line 600, in status_wrapper
  Jun 23 18:37:23 phdev cloud-init[2240]:     util.ensure_dirs((data_d, link_d,))
  Jun 23 18:37:23 phdev cloud-init[2240]:   File "/usr/lib/python3.7/site-packages/cloudinit/util.py", line 1645, in ensure_dirs
  Jun 23 18:37:23 phdev cloud-init[2240]:     ensure_dir(d, mode)
  Jun 23 18:37:23 phdev cloud-init[2240]:   File "/usr/lib/python3.7/site-packages/cloudinit/util.py", line 1698, in ensure_dir
  Jun 23 18:37:23 phdev cloud-init[2240]:     os.makedirs(path)
  Jun 23 18:37:23 phdev cloud-init[2240]:   File "/usr/lib/python3.7/os.py", line 221, in makedirs
  Jun 23 18:37:23 phdev cloud-init[2240]:     mkdir(name, mode)
  Jun 23 18:37:23 phdev cloud-init[2240]: FileExistsError: [Errno 17] File exists: '/var/lib/cloud/data'
  Jun 23 18:37:23 phdev systemd[1]: cloud-init.service: Main process exited, code=exited, status=1/FAILURE
  Jun 23 18:37:23 phdev systemd[1]: cloud-init.service: Failed with result 'exit-code'.
  Jun 23 18:37:23 phdev systemd[1]: Failed to start Initial cloud-init job (metadata service crawler).
  ```

  Find the attached for the log tarball.

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1884819/+subscriptions


Follow ups