Problem
After restoring a RHEL machine to AWS from a backup copy taken from Azure the machine is unreachable.
Error Message
The following errors can be seen when trying to connect to EC2 Console:
[ERROR]: Azure datasource failure occurred: result=error | reason=failure to find primary DHCP interface | agent=Cloud-Init
[ERROR]: Azure datasource failure occurred: result=error | reason=http error 401 querying IMDS
Cause
Cloud-init auto-configuration during VM boot up runs into an infinite loop when endpoints aren’t reachable and cloud-init is unable to successfully configure the endpoints.
Solution
1. Wait for the restored machine to boot up on AWS
2. From the instance details page, select connect and launch the EC2 serial console. If you're in emergency/recovery mode, ensure all partitions are mountable. This will ensure the machine boots normally on restart. For any issues during boot up please refer to the 'Cross cloud provider restore' section of NetBackup™ Web UI Cloud Administrator's Guide.
Consider the following scenarios to help diagnose the boot issue :-
Scenario A : If you can login to rescue mode -
a. If you're in emergency/recovery/rescue mode, mount the actual root partition to access the directory /etc/cloud and proceed.
b. Create an empty file cloud-init.disabled in /etc/cloud/ directory:
# touch /etc/cloud/cloud-init.disabled
c. Reboot the machine. This time cloud-init should not start at boot up, you may choose to re-configure it for AWS.
Scenario B: Unable to login to rescue mode -
a. If you're unable to access the root partition due to the VM being stuck during cloud-init configuration, detach the boot disk from your restored VM and attach it temporarily to another machine which is able to boot up normally.
b. Mount the root volume of the restored vm on the normal VM and create the file cloud-init.disabled in the directory: <DISK_MOUNT_PATH>/etc/cloud/
c. Detach this disk from the normal VM and attach it back to the restored VM and start it.