Windows boot error in an Azure VM: An operating system wasn't found
Applies to: ✔️ Windows VMs
Original KB number: 4010142
This article provides a solution to an issue where Windows VM doesn't start with error "An operating system wasn't found".
Symptoms
Windows doesn't start, and it returns the following error message:
An operating system wasn't found. Try disconnecting any drivers that don't contain an operating system.
Press Ctrl+Alt+Del to restart
Cause
This issue occurs for one of the following reasons:
- The startup process can't locate an active system partition.
- The disk is corrupted.
- The disk isn't presented to the Hyper-V host.
- The host can't access the storage in which the disk is hosted.
Resolution
Tip
If you have a recent backup of the VM, you may try restoring the VM from the backup to fix the boot problem.
To fix this issue, stop (de-allocate) and restart the VM. Then, check whether the issue persists. If the issue persists, follow these steps.
Step 1: Verify whether the Windows partition is marked as active
Note
This mitigation applies only for Generation 1 VMs. Generation 2 VMs (using UEFI) don't use an active partition.
Start a Remote Desktop connection to the recovery VM.
Open Computer management > Disk management. Make sure that the disk is flagged as Online in the Disk Management console. Note the drive letter that is assigned to the attached system disk.
Identify the Boot partition and Windows partition. If there's only one partition on the OS disk, this partition is both Boot partition and Windows partition.
If the OS disk contains more than one partition, you can identify the partitions by viewing the folders in them:
The Windows partition contains a folder that is named Windows, and this partition is larger than the others.
The Boot partition contains a folder that is named Boot. This folder is hidden by default. To see the folder, you must display the hidden files and folders and disable the Hide protected operating system files (Recommended) option. The boot partition is typically 300 MB~500 MB.
Run the following command as an administrator to create a boot record:
bcdboot <Windows partition>:\Windows /S <windows partition>:
Use the DISKPART tool to check whether the Windows partition is active:
Open an elevated command prompt and open the DISKPART tool.
diskpart
List the disks on the system and look for added disks and proceed to select the new disk. In this example, the new disk is Disk 1.
list disk sel disk 1
List all the partitions on that disk and then proceed to select the partition you want to check. Usually System Managed partitions are smaller and around 350 MB in size. In the following image, this partition is Partition 1.
list partition sel partition 1
Check the status of the partition. In our example, Partition 1 is not active.
detail partition
If the partition isn't active, change the Active flag and then recheck the change was done properly.
active detail partition
Exit the DISKPART tool.
exit
Step 2: Repair the Boot Configuration data
Run the following command line as an administrator to verify the file system integrity and fix logical file system errors.
chkdsk <Windows partition>: /f
Run the following command line as an administrator, and then record the identifier of Windows Boot Loader (not Windows Boot Manager). The identifier is a 32-character code that resembles "xxxxxxxx-xxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx." You will use this identifier in the next step.
bcdedit /store <Boot partition>:\boot\bcd /enum /v
Repair the Boot Configuration data by running the following commands. Replace the placeholders by using the actual values.
Note
This step is applied to most corruption issues that affect startup configuration data. You must perform this step even if the Device and OSDevice values are pointing to the correct partition.
- <Windows partition> is the partition that contains a folder that is named "Windows."
- <Boot partition> is the partition that contains a hidden system folder that is named "Boot."
- <Identifier> is the identifier of Windows Boot Loader that you found in the previous step.
bcdedit /store <Boot partition>:\boot\bcd /set {bootmgr} device partition=<boot partition>: bcdedit /store <Boot partition>:\boot\bcd /set {bootmgr} integrityservices enable bcdedit /store <Boot partition>:\boot\bcd /set {<Identifier>} device partition=<Windows partition>: bcdedit /store <Boot partition>:\boot\bcd /set {<Identifier>} integrityservices enable bcdedit /store <Boot partition>:\boot\bcd /set {<identifier>} recoveryenabled Off bcdedit /store <Boot partition>:\boot\bcd /set {<identifier>} osdevice partition=<Windows partition>: bcdedit /store <Boot partition>:\boot\bcd /set {<identifier>} bootstatuspolicy IgnoreAllFailures
Check whether the issue is resolved.
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.