Cloud–init-enabled VM takes a long time to start up
This article describes how to troubleshoot an unexpected startup delay on an Azure Virtual Machine (VM) that uses the cloud-init feature. This delay can cause a cloud-init-enabled Azure VM deployment to require more than two minutes (120 seconds) to start up.
Symptoms
Starting an Azure VM takes more than two minutes to finish on VM products that don't provide local ephemeral disks, such as the following products:
- Ev4 and Esv4-series
- Dv5 and Dsv5-series
- Dasv5 and Dadsv5-series
- DCasv5 and DCadsv5-series confidential
If you check log files such as /var/log/cloud-init.log and /var/log/waagent.log (init stage), you'll see output that resembles the following example:
# grep "did not appear after 120 seconds" *
cloud-init.log:2021-12-01 19:35:50,455 - DataSourceAzure.py[WARNING]: ephemeral device '/dev/disk/cloud/azure_resource' did not appear after 120 seconds.
cloud-init.log:2021-12-01 21:19:58,531 - DataSourceAzure.py[WARNING]: ephemeral device '/dev/disk/cloud/azure_resource' did not appear after 120 seconds.
cloud-init-output.log:2021-12-01 19:35:50,455 - DataSourceAzure.py[WARNING]: ephemeral device '/dev/disk/cloud/azure_resource' did not appear after 120 seconds.
cloud-init-output.log:2021-12-01 21:19:58,531 - DataSourceAzure.py[WARNING]: ephemeral device '/dev/disk/cloud/azure_resource' did not appear after 120 seconds.
messages:Dec 1 19:35:50 redhat84noephstor01 cloud-init[1065]: 2021-12-01 19:35:50,455 - DataSourceAzure.py[WARNING]: ephemeral device '/dev/disk/cloud/azure_resource' did not appear after 120 seconds.
messages:Dec 1 21:19:58 redhat84noephstor01 cloud-init[931]: 2021-12-01 21:19:58,531 - DataSourceAzure.py[WARNING]: ephemeral device '/dev/disk/cloud/azure_resource' did not appear after 120 seconds.
# /var/log/cloud-init.log
2021-12-01 19:35:50,481 - util.py[WARNING]: Failed partitioning operation
Device /dev/disk/cloud/azure_resource did not exist and was not created with a udevadm settle.
2021-12-01 19:35:50,481 - util.py[DEBUG]: Failed partitioning operation
Device /dev/disk/cloud/azure_resource did not exist and was not created with a udevadm settle.
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/cloudinit/config/cc_disk_setup.py", line 141, in handle
func=mkpart, args=(disk, definition))
File "/usr/lib/python3.6/site-packages/cloudinit/util.py", line 2292, in log_time
ret = func(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/cloudinit/config/cc_disk_setup.py", line 780, in mkpart
assert_and_settle_device(device)
File "/usr/lib/python3.6/site-packages/cloudinit/config/cc_disk_setup.py", line
Cause
During VM startup, cloud-init runs the DataSourceAzure.py file in Python, and then waits for the local ephemeral disks (/mnt/azure_resource) to become available. Because you're using an Azure VM that doesn't have local ephemeral disks, cloud-init must wait until the process times out. The timeout interval for ephemeral disks is 120 seconds before the startup process continues.
Solution
Upgrade your copy of cloud-init to version 21.2 or a later version.
Workaround
If you can't upgrade cloud-init to version 21.2 or a later version, you can edit the DataSourceAzure.py file to shorten the timeout value. The following example modifies the timeout value from 120 seconds to two seconds:
sudo sed -i 's/maxwait=120/maxwait=2/g' $(locate DataSourceAzure.py)
Contact us for help
If you have questions or need help, create a support request, or ask Azure community support. You can also submit product feedback to Azure feedback community.
Visszajelzés
https://aka.ms/ContentUserFeedback.
Hamarosan elérhető: 2024-ben fokozatosan kivezetjük a GitHub-problémákat a tartalom visszajelzési mechanizmusaként, és lecseréljük egy új visszajelzési rendszerre. További információ:Visszajelzés küldése és megtekintése a következőhöz: