canonical / canonical/cloud-init

umount /run/cloud-init/tmp/tmpl5n7csdd failed

Open
#4,002 5 comments 0 reactions 0 assignees View on GitHub
incomplete launchpad
Dominant language
Python
Stars
3.8k
Forks
1.1k
Avg merge
3d 8h
Merged PRs (30d)
22

Description

This bug was originally filed in Launchpad as [LP: #1982902](https://bugs.launchpad.net/cloud-init/+bug/1982902)

Launchpad details

affected_projects = ['ubuntu']

assignee = mahdi3742
assignee_name = MehdiAmirirad
date_closed = None
date_created = 2022-07-27T01:38:08.171504+00:00
date_fix_committed = 2022-07-28T23:38:55.516212+00:00
date_fix_released = 2022-07-28T23:38:55.516212+00:00
id = 1982902
importance = undecided
is_complete = False
lp_url = https://bugs.launchpad.net/cloud-init/+bug/1982902
milestone = None
owner = jshen28
owner_name = norman shen
private = False
status = incomplete
submitter = jshen28
submitter_name = norman shen
tags = []
duplicates = []

_Launchpad user **norman shen(jshen28)** wrote on 2022-07-27T01:38:08.171504+00:00_

Hello,

I am using cloud-init version: /usr/bin/cloud-init 20.4.1-0ubuntu1~18.04.1, ubuntu version is root@ubuntu:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.5 LTS
Release: 18.04
Codename: bionic

I found that umount configdrive fails with device busy reported, it further causes temp folder failed to be deleted.

Logs are

```
2022-07-25 02:13:01,732 - handlers.py[DEBUG]: finish: init-local/search-ConfigDrive: FAIL: no local data found from DataSourceConfigDrive
2022-07-25 02:13:01,733 - util.py[WARNING]: Getting data from failed
2022-07-25 02:13:01,733 - util.py[DEBUG]: Getting data from failed
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/cloudinit/temp_utils.py", line 90, in tempdir
yield tdir
File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 1687, in mount_cb
return ret
File "/usr/lib/python3.6/contextlib.py", line 88, in __exit__
next(self.gen)
File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 1571, in unmounter
subp.subp(umount_cmd)
File "/usr/lib/python3/dist-packages/cloudinit/subp.py", line 295, in subp
cmd=args)
cloudinit.subp.ProcessExecutionError: Unexpected error while running command.
Command: ['umount', '/run/cloud-init/tmp/tmpl5n7csdd']
Exit code: 32
Reason: -
Stdout:
Stderr: umount: /run/cloud-init/tmp/tmpl5n7csdd: target is busy.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/cloudinit/sources/__init__.py", line 771, in find_source
if s.update_metadata([EventType.BOOT_NEW_INSTANCE]):
File "/usr/lib/python3/dist-packages/cloudinit/sources/__init__.py", line 660, in update_metadata
result = self.get_data()
File "/usr/lib/python3/dist-packages/cloudinit/sources/__init__.py", line 279, in get_data
return_value = self._get_data()
File "/usr/lib/python3/dist-packages/cloudinit/sources/DataSourceConfigDrive.py", line 81, in _get_data
mtype=mtype)
File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 1687, in mount_cb
return ret
File "/usr/lib/python3.6/contextlib.py", line 99, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/lib/python3/dist-packages/cloudinit/temp_utils.py", line 92, in tempdir
shutil.rmtree(tdir, ignore_errors=rmtree_ignore_errors)
File "/usr/lib/python3.6/shutil.py", line 486, in rmtree
_rmtree_safe_fd(fd, path, onerror)
File "/usr/lib/python3.6/shutil.py", line 424, in _rmtree_safe_fd
_rmtree_safe_fd(dirfd, fullname, onerror)
File "/usr/lib/python3.6/shutil.py", line 424, in _rmtree_safe_fd
_rmtree_safe_fd(dirfd, fullname, onerror)
File "/usr/lib/python3.6/shutil.py", line 444, in _rmtree_safe_fd
onerror(os.unlink, fullname, sys.exc_info())
File "/usr/lib/python3.6/shutil.py", line 442, in _rmtree_safe_fd
os.unlink(name, dir_fd=topfd)
OSError: [Errno 30] Read-only file system: 'network_data.json'
2022-07-25 02:13:01,783 - main.py[DEBUG]: No local datasource found

```

Contributor guide

Open the contributing guide

Research direction

Start by checking cloudinit/temp_utils.py and cloudinit/util.py around tempdir, mount_cb, and unmounter, then trace the ConfigDrive entry point in cloudinit/sources/DataSourceConfigDrive.py. The Launchpad details report a committed and released fix, so first establish whether the reported busy mount and cleanup errors still reproduce before defining the required change and regression coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cloud, infrastructure, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.