|
| 1 | +--- |
| 2 | +title: Windows virtual machine cannot boot due to windows boot manager |
| 3 | +description: This article provides steps to resolve issues where Windows Boot Manager prevents the booting of an Azure Virtual Machine. |
| 4 | +services: virtual-machines-windows |
| 5 | +documentationcenter: '' |
| 6 | +author: v-miegge |
| 7 | +manager: dcscontentpm |
| 8 | +editor: '' |
| 9 | +tags: azure-resource-manager |
| 10 | +ms.assetid: a97393c3-351d-4324-867d-9329e31b3598 |
| 11 | +ms.service: virtual-machines-windows |
| 12 | +ms.workload: infrastructure-services |
| 13 | +ms.tgt_pltfrm: na |
| 14 | +ms.topic: troubleshooting |
| 15 | +ms.date: 03/26/2020 |
| 16 | +ms.author: v-mibufo |
| 17 | + |
| 18 | +--- |
| 19 | + |
| 20 | +# Windows VM cannot boot due to Windows Boot Manager |
| 21 | + |
| 22 | +This article provides steps to resolve issues where Windows Boot Manager prevents the booting of an Azure Virtual Machine (VM). |
| 23 | + |
| 24 | +## Symptom |
| 25 | + |
| 26 | +The VM is stuck waiting upon a user prompt and doesn't boot unless manually instructed to. |
| 27 | + |
| 28 | +When you use [Boot diagnostics](https://docs.microsoft.com/azure/virtual-machines/troubleshooting/boot-diagnostics) to view the screenshot of the VM, you'll see that the screenshot displays the Windows Boot Manager with the message *Choose an operating system to start, or press TAB to select a tool:*. |
| 29 | + |
| 30 | +Figure 1 |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | +## Cause |
| 35 | + |
| 36 | +The error is due to a BCD flag *displaybootmenu* in the Windows Boot Manager. When the flag is enabled, Windows Boot Manager prompts the user, during the booting process, to select which loader they wish to run, causing a boot delay. In Azure, this feature can add to the time it takes to boot a VM. |
| 37 | + |
| 38 | +## Solution |
| 39 | + |
| 40 | +Process Overview: |
| 41 | + |
| 42 | +1. Configure for Faster Boot Time using Serial Console. |
| 43 | +2. Create and Access a Repair VM. |
| 44 | +3. Configure for Faster Boot Time on a Repair VM. |
| 45 | +4. **Recommended**: Before you rebuild the VM, enable serial console and memory dump collection. |
| 46 | +5. Rebuild the VM. |
| 47 | + |
| 48 | +### Configure for Faster Boot Time using Serial Console |
| 49 | + |
| 50 | +If you have access to serial console, there are two ways you can achieve faster boot times. Either decrease the *displaybootmenu* wait time, or remove the flag altogether. |
| 51 | + |
| 52 | +1. Follow directions to access [Azure Serial Console for Windows](https://docs.microsoft.com/azure/virtual-machines/troubleshooting/serial-console-windows) to gain access to the text-based console. |
| 53 | + |
| 54 | + > [!NOTE] |
| 55 | + > If you're unable to access serial console, skip ahead to [Create and Access a Repair VM](#create-and-access-a-repair-vm). |
| 56 | +
|
| 57 | +2. **Option A**: Reduce Waiting Time |
| 58 | + |
| 59 | + a. Waiting time is set at 30 seconds by default but can be changed to a faster time (e.g. 5 seconds). |
| 60 | + |
| 61 | + b. Use the following command in serial console to adjust the timeout value: |
| 62 | + |
| 63 | + `bcdedit /set {bootmgr} timeout 5` |
| 64 | + |
| 65 | +3. **Option B**: Remove the BCD Flag |
| 66 | + |
| 67 | + a. To prevent the Display Boot Menu prompt altogether, enter the following command: |
| 68 | + |
| 69 | + `bcdedit /deletevalue {bootmgr} displaybootmenu` |
| 70 | + |
| 71 | + > [!NOTE] |
| 72 | + > If you were unable to use serial console to configure a faster boot time in the steps above, you can instead continue with the following steps. You'll now be troubleshooting in offline mode to resolve this issue. |
| 73 | +
|
| 74 | +### Create and Access a Repair VM |
| 75 | + |
| 76 | +1. Use [steps 1-3 of the VM Repair Commands](https://docs.microsoft.com/azure/virtual-machines/troubleshooting/repair-windows-vm-using-azure-virtual-machine-repair-commands) to prepare a Repair VM. |
| 77 | +2. Use Remote Desktop Connection connect to the Repair VM. |
| 78 | + |
| 79 | +### Configure for Faster Boot Time on a Repair VM |
| 80 | + |
| 81 | +1. Open an elevated command prompt. |
| 82 | +2. Enter the following to enable DisplayBootMenu: |
| 83 | + |
| 84 | + Use this command for **Generation 1 VMs**: |
| 85 | + |
| 86 | + `bcdedit /store <VOLUME LETTER WHERE THE BCD FOLDER IS>:\boot\bcd /set {bootmgr} displaybootmenu yes` |
| 87 | + |
| 88 | + Use this command for **Generation 2 VMs**: |
| 89 | + |
| 90 | + `bcdedit /store <VOLUME LETTER OF EFI SYSTEM PARTITION>:EFI\Microsoft\boot\bcd /set {bootmgr} displaybootmenu yes` |
| 91 | + |
| 92 | + Replace any greater than or less than symbols as well as the text within them, e.g. "< text here >". |
| 93 | + |
| 94 | +3. Change the timeout value to 5 seconds: |
| 95 | + |
| 96 | + Use this command for **Generation 1 VMs**: |
| 97 | + |
| 98 | + `bcdedit /store <VOLUME LETTER WHERE THE BCD FOLDER IS>:\boot\bcd /set {bootmgr} timeout 5` |
| 99 | + |
| 100 | + Use this command for **Generation 2 VMs**: |
| 101 | + |
| 102 | + `bcdedit /store <VOLUME LETTER OF EFI SYSTEM PARTITION>:EFI\Microsoft\boot\bcd /set {bootmgr} timeout 5` |
| 103 | + |
| 104 | + Replace any greater than or less than symbols as well as the text within them, e.g. "< text here >". |
| 105 | + |
| 106 | +### Recommended: Before you rebuild the VM, enable serial console and memory dump collection |
| 107 | + |
| 108 | +To enable memory dump collection and Serial Console, run the following script: |
| 109 | + |
| 110 | +1. Open an elevated command prompt session (Run as administrator). |
| 111 | +2. Run the following commands: |
| 112 | + |
| 113 | + Enable Serial Console |
| 114 | + |
| 115 | + `bcdedit /store <VOLUME LETTER WHERE THE BCD FOLDER IS>:\boot\bcd /ems {<BOOT LOADER IDENTIFIER>} ON` |
| 116 | + |
| 117 | + `bcdedit /store <VOLUME LETTER WHERE THE BCD FOLDER IS>:\boot\bcd /emssettings EMSPORT:1 EMSBAUDRATE:115200` |
| 118 | + |
| 119 | + Replace any greater than or less than symbols as well as the text within them, e.g. "< text here >". |
| 120 | + |
| 121 | +3. Verify that the free space on the OS disk is as much as the memory size (RAM) on the VM. |
| 122 | + |
| 123 | + If there's not enough space on the OS disk, you should change the location where the memory dump file will be created and refer that to any data disk attached to the VM that has enough free space. To change the location, replace "%SystemRoot%" with the drive letter (for example, "F:") of the data disk in the below commands. |
| 124 | + |
| 125 | +#### Suggested configuration to enable OS Dump |
| 126 | + |
| 127 | +**Load Broken OS Disk**: |
| 128 | + |
| 129 | +`REG LOAD HKLM\BROKENSYSTEM <VOLUME LETTER OF BROKEN OS DISK>:\windows\system32\config\SYSTEM` |
| 130 | + |
| 131 | +**Enable on ControlSet001:** |
| 132 | + |
| 133 | +`REG ADD "HKLM\BROKENSYSTEM\ControlSet001\Control\CrashControl" /v CrashDumpEnabled /t REG_DWORD /d 1 /f` |
| 134 | + |
| 135 | +`REG ADD "HKLM\BROKENSYSTEM\ControlSet001\Control\CrashControl" /v DumpFile /t REG_EXPAND_SZ /d "%SystemRoot%\MEMORY.DMP" /f` |
| 136 | + |
| 137 | +`REG ADD "HKLM\BROKENSYSTEM\ControlSet001\Control\CrashControl" /v NMICrashDump /t REG_DWORD /d 1 /f` |
| 138 | + |
| 139 | +**Enable on ControlSet002:** |
| 140 | + |
| 141 | +`REG ADD "HKLM\BROKENSYSTEM\ControlSet002\Control\CrashControl" /v CrashDumpEnabled /t REG_DWORD /d 1 /f` |
| 142 | + |
| 143 | +`REG ADD "HKLM\BROKENSYSTEM\ControlSet002\Control\CrashControl" /v DumpFile /t REG_EXPAND_SZ /d "%SystemRoot%\MEMORY.DMP" /f` |
| 144 | + |
| 145 | +`REG ADD "HKLM\BROKENSYSTEM\ControlSet002\Control\CrashControl" /v NMICrashDump /t REG_DWORD /d 1 /f` |
| 146 | + |
| 147 | +**Unload Broken OS Disk:** |
| 148 | + |
| 149 | +`REG UNLOAD HKLM\BROKENSYSTEM` |
| 150 | + |
| 151 | +### Rebuild the Original VM |
| 152 | + |
| 153 | +Use [step 5 of the VM Repair Commands](https://docs.microsoft.com/azure/virtual-machines/troubleshooting/repair-windows-vm-using-azure-virtual-machine-repair-commands#repair-process-example) to reassemble the VM. |
0 commit comments