Public bug reported:
This is a placeholder bug used to track the issue at
https://github.com/canonical/cloud-init/issues/7140.
# Bug report
Formatting and then mounting disks or partitions through `cloud-init`
(for example ephemeral disks on Azure Virtual Machines) has a common
race condition that results in the partition not being mounted and it is
only recovered after a reboot.
This issue happens on boot of a VM with an ephemeral disk, leaving the
ephemeral disk unmounted when I expect it to be mounted to `/mnt` and
accessible.
The reason for this issue is that `util-linux` recently transitioned to using
`udev` rather than `libblkid` in `libmount` (found in 2.42.2-1ubuntu2).
After formatting the partition in `cc_disk_setup.py`, `udev` runs a background
service that probes the partition for details.
This service does not complete in time before `cloud-init` tries to mount the
partition in `cc_mounts.py`.
## Steps to reproduce the problem
<!--Provide any applicable user-data, config, commandline or procedure to
reproduce this problem -->
Launch Ubuntu 26.10 Minimal on an Azure instance with VM size
`Standard_D2pds_v5`.
Run `lsblk` to see mounted partitions.
The ephemeral disk will not be mounted to `/mnt` as expected.
## Environment details
- Cloud-init version: 26.2-0ubuntu1
- Operating System Distribution: Ubuntu 26.10 Minimal
- Cloud provider, platform or installer type: Azure VM Size `Standard_D2pds_v5`
## cloud-init logs
<!--
Please provide either the applicable excerpt of /var/log/cloud-init.log
representing the failure or attach cloud-init-logs.tar.gz obtained by running
`sudo cloud-init collect-logs`. Add `--include-userdata` if there is no
sensitive information in your user data.
-->
```
2026-10-06 17:00:59,268 - modules.py[DEBUG]: Running module disk_setup (<module
'cloudinit.config.cc_disk_setup' from
'/usr/lib/python3/dist-packages/cloudinit/config/cc_disk_setup.py'>) with
frequency once-per-instance
2026-10-06 17:00:59,268 - handlers.py[DEBUG]: start:
init-network/config-disk_setup: running config-disk_setup with frequency
once-per-instance
2026-10-06 17:00:59,268 - util.py[DEBUG]: Writing to
/var/lib/cloud/instances/eeb910c3-e673-47e2-90c1-16fc66b38703/sem/config_disk_setup
- wb: [644] 24 bytes
2026-10-06 17:00:59,269 - helpers.py[DEBUG]: Running config-disk_setup using
lock (<FileLock using file
'/var/lib/cloud/instances/eeb910c3-e673-47e2-90c1-16fc66b38703/sem/config_disk_setup'>)
2026-10-06 17:00:59,269 - cc_disk_setup.py[DEBUG]: updated disk_setup device
entry 'ephemeral0' to '/dev/disk/cloud/azure_resource'
2026-10-06 17:00:59,269 - cc_disk_setup.py[DEBUG]: Partitioning disks:
{'/dev/disk/cloud/azure_resource': {'table_type': 'gpt', 'layout': [100],
'overwrite': True, '_origname': 'ephemeral0'}}
2026-10-06 17:00:59,269 - subp.py[DEBUG]: Running command ['udevadm', 'settle']
with allowed return codes [0] (shell=False, capture=True)
2026-10-06 17:00:59,275 - cc_disk_setup.py[DEBUG]: Checking values for /dev/sdb
definition
2026-10-06 17:00:59,275 - cc_disk_setup.py[DEBUG]: Checking against default
devices
2026-10-06 17:00:59,275 - cc_disk_setup.py[DEBUG]: Checking if device /dev/sdb
is a valid device
2026-10-06 17:00:59,275 - subp.py[DEBUG]: Running command ['lsblk', '--pairs',
'--output', 'NAME,TYPE,FSTYPE,LABEL', '/dev/sdb', '--nodeps'] with allowed
return codes [0] (shell=False, capture=True)
2026-10-06 17:00:59,324 - performance.py[DEBUG]: Running ['lsblk', '--pairs',
'--output', 'NAME,TYPE,FSTYPE,LABEL', '/dev/sdb', '--nodeps'] took 0.049 seconds
2026-10-06 17:00:59,325 - cc_disk_setup.py[DEBUG]: Checking if device layout
matches
2026-10-06 17:00:59,325 - subp.py[DEBUG]: Running command ['sfdisk', '-l',
'-J', '/dev/sdb'] with allowed return codes [0, 1] (shell=False, capture=True)
2026-10-06 17:00:59,330 - cc_disk_setup.py[DEBUG]: called
check_partition_gpt_layout(/dev/sdb, [100]), returned: ['7']
2026-10-06 17:00:59,330 - cc_disk_setup.py[DEBUG]: Layout types=[None]. Found
types=['7']
2026-10-06 17:00:59,330 - cc_disk_setup.py[DEBUG]: Device partitioning layout
matches
2026-10-06 17:00:59,330 - performance.py[DEBUG]: Creating partition on
/dev/disk/cloud/azure_resource took 0.061 seconds
2026-10-06 17:00:59,330 - cc_disk_setup.py[DEBUG]: setting up filesystems:
[{'filesystem': 'ext4', 'device': 'ephemeral0.1'}]
2026-10-06 17:00:59,330 - cc_disk_setup.py[DEBUG]: ephemeral0.1 is mapped to
disk=/dev/disk/cloud/azure_resource part=1
2026-10-06 17:00:59,330 - subp.py[DEBUG]: Running command ['udevadm', 'settle']
with allowed return codes [0] (shell=False, capture=True)
2026-10-06 17:00:59,334 - cc_disk_setup.py[DEBUG]: Checking /dev/sdb against
default devices
2026-10-06 17:00:59,334 - cc_disk_setup.py[DEBUG]: Manual request of partition
1 for /dev/sdb1
2026-10-06 17:00:59,334 - cc_disk_setup.py[DEBUG]: Checking device /dev/sdb1
2026-10-06 17:00:59,334 - subp.py[DEBUG]: Running command ['blkid', '-c',
'/dev/null', '/dev/sdb1'] with allowed return codes [0, 2] (shell=False,
capture=True)
2026-10-06 17:00:59,338 - cc_disk_setup.py[DEBUG]: Device '/dev/sdb1' has
check_label='Temporary Storage' check_fstype=ntfs
2026-10-06 17:00:59,338 - cc_disk_setup.py[DEBUG]: Device /dev/sdb1 is cleared
for formatting
2026-10-06 17:00:59,338 - cc_disk_setup.py[DEBUG]: File system type 'ext4' with
label 'None' will be created on /dev/sdb1
2026-10-06 17:00:59,338 - subp.py[DEBUG]: Running command ['lsblk', '--pairs',
'--output', 'NAME,TYPE,FSTYPE,LABEL', '/dev/sdb1', '--nodeps'] with allowed
return codes [0] (shell=False, capture=True)
2026-10-06 17:00:59,341 - cc_disk_setup.py[DEBUG]: Creating file system None on
/dev/sdb1
2026-10-06 17:00:59,341 - subp.py[DEBUG]: Running command
['/usr/sbin/mkfs.ext4', '/dev/sdb1'] with allowed return codes [0]
(shell=False, capture=True)
2026-10-06 17:01:01,828 - performance.py[DEBUG]: Running
['/usr/sbin/mkfs.ext4', '/dev/sdb1'] took 2.487 seconds
2026-10-06 17:01:01,828 - performance.py[DEBUG]: Creating new filesystem took
2.498 seconds
2026-10-06 17:01:01,828 - handlers.py[DEBUG]: finish:
init-network/config-disk_setup: SUCCESS: config-disk_setup ran successfully and
took 2.560 seconds (duration: 2.560s)
2026-10-06 17:01:01,828 - modules.py[DEBUG]: Running module mounts (<module
'cloudinit.config.cc_mounts' from
'/usr/lib/python3/dist-packages/cloudinit/config/cc_mounts.py'>) with frequency
once-per-instance
2026-10-06 17:01:01,828 - handlers.py[DEBUG]: start:
init-network/config-mounts: running config-mounts with frequency
once-per-instance
2026-10-06 17:01:01,829 - util.py[DEBUG]: Writing to
/var/lib/cloud/instances/eeb910c3-e673-47e2-90c1-16fc66b38703/sem/config_mounts
- wb: [644] 23 bytes
2026-10-06 17:01:01,829 - helpers.py[DEBUG]: Running config-mounts using lock
(<FileLock using file
'/var/lib/cloud/instances/eeb910c3-e673-47e2-90c1-16fc66b38703/sem/config_mounts'>)
2026-10-06 17:01:01,829 - cc_mounts.py[DEBUG]: mounts configuration is []
2026-10-06 17:01:01,829 - util.py[DEBUG]: Reading from /etc/fstab (quiet=False)
2026-10-06 17:01:01,829 - util.py[DEBUG]: Reading 255 bytes from /etc/fstab
2026-10-06 17:01:01,829 - cc_mounts.py[DEBUG]: Attempting to determine the real
name of ephemeral0
2026-10-06 17:01:01,830 - cc_mounts.py[DEBUG]: Mapped metadata name ephemeral0
to /dev/disk/cloud/azure_resource
2026-10-06 17:01:01,830 - cc_mounts.py[DEBUG]: changed ephemeral0 =>
/dev/disk/cloud/azure_resource-part1
2026-10-06 17:01:01,830 - cc_mounts.py[DEBUG]: Attempting to determine the real
name of swap
2026-10-06 17:01:01,830 - cc_mounts.py[DEBUG]: changed swap => None
2026-10-06 17:01:01,830 - cc_mounts.py[DEBUG]: Ignoring nonexistent default
named mount swap
2026-10-06 17:01:01,830 - cc_mounts.py[DEBUG]: no need to setup swap
2026-10-06 17:01:01,830 - util.py[DEBUG]: Writing to /etc/fstab - wb: [644] 393
bytes
2026-10-06 17:01:01,830 - cc_mounts.py[DEBUG]: Changes to fstab: ['+
/dev/disk/cloud/azure_resource-part1 /mnt auto
defaults,nofail,x-systemd.after=cloud-init-network.service,_netdev,comment=cloudconfig
0 2']
2026-10-06 17:01:01,830 - subp.py[DEBUG]: Running command ['mount', '-a'] with
allowed return codes [0] (shell=False, capture=True)
2026-10-06 17:01:01,902 - performance.py[DEBUG]: Running ['mount', '-a'] took
0.071 seconds
2026-10-06 17:01:01,902 - handlers.py[DEBUG]: finish:
init-network/config-mounts: FAIL: running config-mounts with frequency
once-per-instance (duration: 0.074s)
2026-10-06 17:01:01,902 - log_util.py[WARNING]: Running module mounts (<module
'cloudinit.config.cc_mounts' from
'/usr/lib/python3/dist-packages/cloudinit/config/cc_mounts.py'>) failed
2026-10-06 17:01:01,902 - log_util.py[DEBUG]: Running module mounts (<module
'cloudinit.config.cc_mounts' from
'/usr/lib/python3/dist-packages/cloudinit/config/cc_mounts.py'>) failed
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/cloudinit/config/modules.py", line 297,
in _run_modules
ran, _r = cc.run(
~~~~~~^
run_name, mod.handle, func_args, freq=freq
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/lib/python3/dist-packages/cloudinit/cloud.py", line 71, in run
return self._runners.run(name, functor, args, freq, clear_on_fail)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/cloudinit/helpers.py", line 156, in run
results = functor(**args)
File "/usr/lib/python3/dist-packages/cloudinit/config/cc_mounts.py", line
625, in handle
mount_if_needed(uses_systemd, bool(sops), dirs)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/cloudinit/config/cc_mounts.py", line
512, in mount_if_needed
subp.subp(["mount", "-a"])
~~~~~~~~~^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/cloudinit/subp.py", line 291, in subp
raise ProcessExecutionError(
stdout=out, stderr=err, exit_code=rc, cmd=args
)
cloudinit.subp.ProcessExecutionError: Unexpected error while running command.
Command: ['mount', '-a']
Exit code: 32
Reason: -
Stdout:
Stderr: mount: /mnt: wrong fs type, bad option, bad superblock on /dev/sdb1,
missing codepage or helper program, or other error.
dmesg(1) may have more information after failed mount system
call.
```
There is a relevant thread on Matrix as well that is tracking this bug and the
proposed changes to either cloud-init or util-linux:
https://matrix.to/#/!mPCSZ08zE3coMEgu8vtezUig4lnij6wwMmU6c96CSSQ/$AXTsZJeA8ti0Fyf5Kl9dnvD0is73hpV9Ah7MpaTtxqs?via=ubuntu.com&via=matrix.org&via=matrix.debian.social
** Affects: cloud-init (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2169908
Title:
Formatting and mounting ephemeral disks has race condition with util-
linux
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/2169908/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs