AzureRM - Ubuntu VM created using uploaded VHD stuck waiting on boot prompt - linux

I have an Ubuntu Server 17.10 VM in vCenter that I exported using Export-VApp, then used Microsoft's Virtual Machine Converter to create a VHD. Created an Azure RM Disk Image from that and spun up a VM, all of which seemed to go fine. My problem is that the New-AzureRMVM gets stuck in creating, and when I go to the boot diagnostics from the screenshot it is stuck on a "Please unlock disk sda5_crypt:". First, from what I gather is there really no way to get console access to my VM so that I can enter this? It won't get past creating so connect is greyed out and I can't SSH into it. Is my only option here to go back to the VM on vCenter and migrate the entire partition to a new partition without disk encryption, then redeploy? Is there any sort of startup file Azure accepts that could input this for me?

Related

Nutanix VM migration to Azure - VM creation timed out

In the process of Nuntanix Virtual Machine migration to Azure, I had copied ral-rdmbuild-02 copy.ova file into a windows machine and extracted to get .vmdk and .mf. From the extracted file the .vhd file was created, later it was resized on a ubuntu to meet 1MB requirement.
Subsequently, the .vhd was copied to azure and attempted to create a vm to face the following error. Could someone can help me to overcome this issue.
{"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.","details":[{"code":"OSProvisioningTimedOut","message":"OS Provisioning for VM '' did not finish in the allotted time. The VM may still finish provisioning successfully. Please check provisioning state later. Also, make sure the image has been properly prepared (generalized).\r\n * Instructions for Windows: https://azure.microsoft.com/documentation/articles/virtual-machines-windows-upload-image/ \r\n * Instructions for Linux: https://azure.microsoft.com/documentation/articles/virtual-machines-linux-capture-image/ \r\n * If you are deploying more than 20 Virtual Machines concurrently, consider moving your custom image to shared image gallery. Please refer to https://aka.ms/movetosig for the same."}]}
• Please check whether the Nutanix VM hard disk is configured as a dynamic disk or not because dynamic disks don’t work with Azure, and they can’t be migrated. Also, the image of the Nutanix VM may not be prepared correctly, thus would suggest you recreate the image of the Nutanix VM and try migrating it to Azure once again.
• To convert the dynamic disk to fixed type of virtual disk, kindly refer to the below documentation link that guides to use the appropriate command for converting the same: -
Convert-VHD -Path c:\test\child1vhdx.vhdx -DestinationPath c:\test\child1vhd.vhd -VHDType Fixed
https://learn.microsoft.com/en-us/powershell/module/hyper-v/convert-vhd?view=windowsserver2019-ps
• Also, based on the error message that you are encountering, the OS deployment might have also failed from the Portal side as it was unable to pass on some of the required parameters which is why you got ‘TimeOut’ message. The VM also didn’t finish the deployment correctly. I would recommend trying stop(deallocate) and start the VM and see if that resolves the issue.
I would recommend you delete the VM and its related resources if created and take a snapshot of the OS disk, create a disk from the snapshot and then create the machine from that disk. Please refer to the link below for creating a VM from a ‘VHD’ by using the Azure portal: -
https://learn.microsoft.com/en-us/azure/virtual-machines/linux/create-upload-centos
• Finally, to generalize the VM and execute ‘sysprep’ on a VM to take its correct reference image such that it can be successfully migrated to another environment, please refer to the below link that explains the correct steps to perform for generalizing the VM: -
https://portal.nutanix.com/page/documents/details?targetId=Web-Console-Guide-Prism-v6_1:wc-windows-vm-customize-with-sysprep-clone-vm-wc-t.html

Azure - Failed to start virtual machine after resize

Today I accessed my VM on Azure and it was very slow, so I decided to upgrade it. I went to Size, selected a level up in RAM memory and CPU and then I clicked on the button "Resize". After waiting a few minutes, I got a fail message saying: Failed to resize the virtual machine 'xxx' to size 'xxx'. Error: Unknown error encountered when retrieving secret from the Key Vault with URL: xxx.
Since then I can't start my virtual machine, how can I solve this problem?
Thanks.
[EDIT] Apparently, I just need to update the secretURL for a key vault that I've created, I just don't know-how.
I would assume VM is having issues accessing the Key Vault. Can you try the following if possible?
Deallocated the VM to full stop.
Then start it back up
Check that the Key Vault and secret are still the same and have not been deleted or changed.
Check the access to the Key vault. The following documents may help with this.
Creating and configuring a key vault for Azure Disk Encryption
https://learn.microsoft.com/en-us/azure/virtual-machines/windows/disk-encryption-overview#networking-requirements
 In the meantime, please help me perform a quick check and log into the ‘serial console’ of this VM and confirm if you’re able to get into the ‘commandprompt’ from the ‘SAC’ mode: https://learn.microsoft.com/en-us/azure/virtual-machines/troubleshooting/serial-console-windows
Option2 Step 1: On portal select Key Vault à “Access Policy” and ensure that “Azure Disk Encryption for volume encryption” is enabled. If not, enable it, save changes and try to Start the VM again.
Step 2: If “Azure Disk Encryption for volume encryption” is already checked , make sure that “secret “ is present under the Key Vault and it has a “version” of in enabled state. If there is any expiration date set for the version, make sure that we are within the expiration period.
Repair a Windows VM by using the Azure Virtual Machine repair commands: https://learn.microsoft.com/en-us/azure/virtual-machines/troubleshooting/repair-windows-vm-using-azure-virtual-machine-repair-commands
Can you try redeploying the VM that this is happening on? This will place the VM on new hardware and rule out a platform issue if it stops happening after the redeploy.
Try to remove the extension and add it back to the VM. Extension must have failed sometime. https://learn.microsoft.com/en-us/cli/azure/vm/extension?view=azure-cli-latest
Resize virtual machines
There is similar thread discussion in SO, you may also refer to the suggestion mentioned over-there which gives some idea on your query

Creating Windows Image from VM using Packer

I have to create an Image from an existing VM using Packer.This is the link I'm following to do so.
Now I have few doubts in this before proceeding further.
Can I run all these commands remotely.
If yes, where should I install Packer , is it on client Machine or remote machine?
If it has to be installed on remote machine, from which the image is being created, is there any workaround for that. I will not have access to install anything on the remote machine.
No where the VM details are not mentioned. Does that mean, it will automatically take the VM details when we run the commands on the VM?
Where can I see the output of the whole process? Will it be available in azure portal?
Any inputs on the above questions are appreciated.Thanks!
First of all, there is something you have misunderstood about Packer.
The Azure builder can create either a VHD, or a managed image. If you
are creating a VHD, you must start with a VHD. Likewise, if you want
to create a managed image you must start with a managed image.
It means you must create the image from the image or VHD, not VM.
The answer to your question.
Yes, you can run the command remotely, just like Azure CLI.
You can install Packer on your on-premise machine.
From the description of Packer, it just needs the image information.
You can see the output where you run the Packer command.
Update
When you want to create the image from VHD file, you can make an instead:
"image_publisher": "Canonical",
"image_offer": "UbuntuServer",
"image_sku": "16.04.0-LTS",
Into
"image_url": "https://my-storage-account.blob.core.windows.net/path/to/your/custom/image.vhd",
If your vm is managed by Azure, you can pay attention to the option of custom_managed_image and images in Azure. Hope this will be helpful.

How to prepare a windows vm so that it`s os disk can be used to provision other vms

I am using create_option as from_image to create new vm and passing the old vhd url in it but it is not successfully provisioned.
What steps i need to follow to make it work ?
My vm is in azure from whose os disk i want to create new vms.
You will want to sysprep and generalize your VM and capture an image to use to deploy new VMs.
Follow the documentation located here: https://learn.microsoft.com/en-us/azure/virtual-machines/windows/capture-image-resource

Web Console Access for Azure Virtual Machine?

There's any way to access a Virtual Machine with boot problems in windows azure ?
i have a linux VM and i misconfigured a swap file causing boot problems
but Azure dont let me check the details.
In the portal i only have the option to restart or shutdown or delete.
When i google at the problem the only solution i found is:
Download Azure Hard Disk Drive attached to virtual machinne
Mount it locally on a Virtual Instance on my PC
Fix the configuration and save it
Upload the whole HD back to azure VM and pray.
Any other solutions ?
DigitalOcean has a webinterface that let you see the boot procces on your VMs. There is something like this on azure ?
When i contact Azure Support they give this solution:
As console access is not an available feature yet in Azure, you will basically be mounting the problem OS disk as a data disk on a working VM to correct changes to the file system configuration:
A = Original VM (Inaccessible VM)
B = New VM (New Temp VM)
1) Stop VM A via the Azure management portal
2) Delete VM A BUT select “keep the attached disks”
3) Once the lease is cleared, attach the Data Disk from A to VM B via the Azure Portal, Virtual Machines, Select “A”, Attach Disk
4) On VM “B” eventually the disk will attach and you can then mount it.
5) Locate the drive name to mount, on VM “B” look in relevant log file note each linux is slightly different.
grep SCSI /var/log/kern.log (ubuntu)
6) Mount the attached disk onto mountpoint /tempmount
df -h
mkdir /tempmount
mount /dev/sdc1 /tempmount
df –h
7) Change into /etc directory where the original OS disk from resides
cd /tempmount/etc/
cp fstab fstab_orig
8) Now that you have made a backup of you fstab you can proceed to make the changes you require using vi, nano or your preferred text editor.
vi fstab
cd /
umount /tempmount
9) Detach the disk from VM B via the management portal
10) Recreate the original VM A (Create VM from Gallery, Select My Disks) you will see the Disk referring to VM A – Select the original Cloud Service name.
i think that there is the best solution for now.

Resources