Troubleshooting Azure Hibernate/ Resume Issues

Unable to hibernate a VM

If you are unable to hibernate a VM, first check whether hibernation is enabled on the VM. For example, using the GET VM API, you can check if hibernation is enabled on the VM

    "properties": { 

        "vmId": "XXX", 

        "hardwareProfile": { 

            "vmSize": "Standard_D4s_v5" 

        }, 

        "additionalCapabilities": { 

            "hibernationEnabled": true 

        },

If hibernation is enabled on the VM, check if hibernation is successfully enabled in the guest OS.  

Windows For Windows, you can check the status of the Hibernation extension to see if the extension was able to successfully configure the guest OS for hibernation. 

The VM instance view  would have the final output of the extension : 

"extensions": [ 

   "name": "AzureHibernateExtension", 

   "type": "Microsoft.CPlat.Core.WindowsHibernateExtension", 

   "typeHandlerVersion": "1.0.2", 

   "statuses": [ 

     { 

       "code": "ProvisioningState/succeeded", 

       "level": "Info", 

       "displayStatus": "Provisioning succeeded", 

       "message": "Enabling hibernate succeeded. Response from the powercfg command: \tThe hiberfile size has been set to: 17178693632 bytes.\r\n" 

     } 

   ] 

}, 

Additionally, confirm that hibernate is enabled as a sleep state inside the guest. The expected output for the guest should look like this. 

If hibernate is not listed as a supported sleep state, there should be a reason associated with it which should help determine why hibernate is not supported. For example, the following would happen if guest hibernate has not been configured for the VM. 

If either the extension, or the guest sleep state reports an error, you will need to update the guest configurations as per the error descriptions to resolve the issue. After fixing all the issues, you can validate that hibernation has been enabled successfully inside the guest by running  the powercfg /a command - which should return Hibernate as one of the sleep states. 

Please also validate that the AzureHibernateExtension returns to a Succeeded state. If the extension is still in a failed state, then you will need to update the extension state by triggering Reapply VM API

Text Box
Commonly seen issues where the extension fails 

Issue 

Action 

Page file is in temp disk. Please move it to OS disk to enable hibernation. 

Move page file to the C: drive and trigger reapply on the VM to rerun the extension 

Windows failed to configure hibernation due to insufficient space for the hiberfile 

Ensure that C: drive has sufficient space. You can try expanding your OS disk, your C: partition size to overcome this issue. Once you have sufficient space, trigger the Reapply operation so that the extension can retry enabling hibernation in the guest and succeeds.  

Extension error message: “A device attached to the system is not functioning” 

Ensure that C: drive has sufficient space. You can try expanding your OS disk, your C: partition size to overcome this issue. Once you have sufficient space, trigger the Reapply operation so that the extension can retry enabling hibernation in the guest and succeeds. 

Hibernation is no longer supported after Virtualization Based Security (VBS) was enabled inside the guest 

Enable Virtualization in the guest to get VBS capabilities along with the ability to hibernate the guest. To enable virtualization in the guest, refer to this document: https://learn.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v#enable-hyper-v-using-powershell  

Enabling hibernate failed. Response from the powercfg command. Exit Code: 1. Error message: Hibernation failed with the following error: The request is not supported. The following items are preventing hibernation on this system. The current Device Guard configuration has disabled hibernation. An internal system component has disabled hibernation. Hypervisor 

Enable Virtualization in the guest to get VBS capabilities along with the ability to hibernate the guest. To enable virtualization in the guest, refer to this document: https://learn.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v#enable-hyper-v-using-powershell 

Windows guest unable to hibernate
If a hibernate operation succeeds, the following events are seen in the guest: 

If the guest fails to hibernate, then all or some of these events will be missing. 

Commonly seen issues:  

Issue 

Action 

Guest fails to hibernate because Hyper-V Guest Shutdown Service is disabled.  

Ensure that Hyper-V Guest Shutdown Service is not disabled. https://learn.microsoft.com/en-us/virtualization/hyper-v-on-windows/reference/integration-services#hyper-v-guest-shutdown-service
Enabling this service should resolve the issue.

Guest fails to hibernate because HVCI (Memory integrity) is enabled.  

Hibernation is not supported with HVCI. Disabling HVCI should resolve the issue.  

Logs needed for troubleshooting: If you encounter an issue outside of these known scenarios, the following logs can help Azure troubleshoot the issue:  

  • Event logs on the guest: Microsoft-Windows-Kernel-Power, Microsoft-Windows-Kernel-General, Microsoft-Windows-Kernel-Boot. 

  • 2. On bugcheck, a guest crash dump is helpful. 

Linux Likewise, for Linux, you can check the extension status if you used the extension to enable hibernation in the guest OS. 

If you used the hibernation-setup-tool to configure the guest for hibernation, you can check if the tool executed successfully through this command: 

systemctl status hibernation-setup-tool  

ResultCode 

errorDetails 

Action 

InternalOperationError 

The fabric operation failed. 

This is usually a transient issue. Please retry the Hibernate operation after 5mins. 

OperationNotAllowed 

Operation 'HibernateAndDeallocate' is not allowed on VM 'Z0000ZYH000' since VM has extension 'AzureHibernateExtension' in failed state 

Customer issue. Please confirm that VM creation with hibernation enabled  succeeded, and that the extension is in a healthy state. 

OperationNotAllowed 

The Hibernate-Deallocate Operation can only be triggered on a VM that is successfully provisioned and is running. 

Customer error. Please ensure that the VM is successfully running before attempting to Hibernate-Deallocate the VM. 

OperationNotAllowed 

The Hibernate-Deallocate Operation can only be triggered on a VM that is enabled for hibernation. Please enable the property additionalCapabilities.hibernationEnabled during VM creation, or after stop-deallocating the VM. 

Customer error. 

VMHibernateFailed 

Hibernating the VM 'hiber_vm_res_5' failed due to an internal error. Please retry later. 

Retry after 5mins. If it continues to fail after multiple retries, check if the guest is correctly configured to support hibernation or contact Azure support. 

VMHibernateNotSupported 

The VM 'Z0000ZYJ000' does not support hibernation. Please ensure that the VM is correctly configured to support hibernation. 

 

A successful status should return “Inactive (dead)”, and the log messages should say that Swap file for VM hibernation set up successfully 

Sample response azureuser@:~$ systemctl status hibernation-setup-tool 

  • hibernation-setup-tool.service - Hibernation Setup Tool 

   Loaded: loaded (/lib/systemd/system/hibernation-setup-tool.service; enabled; vendor preset: enabled) 

   Active: inactive (dead) since Wed 2021-08-25 22:44:29 UTC; 17min ago 

  Process: 1131 ExecStart=/usr/sbin/hibernation-setup-tool (code=exited, status=0/SUCCESS) 

 Main PID: 1131 (code=exited, status=0/SUCCESS) 

linuxhib2 hibernation-setup-tool[1131]: INFO: update-grub2 finished successfully. 

linuxhib2 hibernation-setup-tool[1131]: INFO: udev rule to hibernate with systemd set up in /etc/udev/rules.d/99-vm-hibernation.rules.  Telling udev about it. 


… 

linuxhib2 hibernation-setup-tool[1131]: INFO: systemctl finished successfully. 

linuxhib2 hibernation-setup-tool[1131]: INFO: Swap file for VM hibernation set up successfully 

If the guest OS is not configured for hibernation, take the appropriate action to resolve the issue. For example, if the guest failed to configure hibernation due to insufficient space, resize the OS disk to resolve the issue.  

Common Error Codes when a VM is unable to hibernate

Unable to resume a VM 

Starting a hibernated VM is similar to starting a stopped VM. For errors and troubleshooting steps related to starting a VM, refer to this guide.

In addition to commonly seen issues while starting VMs, certain issues are specific to starting a hibernated VM. These are described below-  

ResultCode 

errorDetails 

OverconstrainedResumeFromHibernatedStateAllocationRequest 

Allocation failed. VM(s) with the following constraints cannot be allocated, because the condition is too restrictive. Please remove some constraints and try again. Constraints applied are:
- Networking Constraints (such as Accelerated Networking or IPv6)
- Resuming from hibernated state (retry starting the VM after some time or alternatively stop-deallocate the VM and try starting the VM again).  

AllocationFailed/ComputeAllocationResumeFromHibernatedStateError 

VM allocation failed from hibernated state due to insufficient capacity. Please try again later or alternatively stop-deallocate the VM and try starting the VM. 

Windows guest resume status through VM instance view 

For Windows VMs, when you start a VM from a hibernated state, you can use the VM instance view to get more details on whether the guest successfully resumed from its previous hibernated state or if it failed to resume and instead did a cold boot.

Note: This is only available on VMs with minimum Azure Hibernate Extension version of 1.0.3

  1. When the guest successfully resumes, the VM instance view output will be

https://management.azure.com/subscriptions/XX/resourceGroups/myRG/providers/Microsoft.Compute/virtualMachines/myVM/instanceView?api-version=2022-11-01 

  "computerName": "myVM", 

  "osName": "Windows 11 Enterprise", 

  "osVersion": "10.0.22000.1817", 

  "vmAgent": { 

"vmAgentVersion": "2.7.41491.1083", 

"statuses": [ 

   { 

     "code": "ProvisioningState/succeeded", 

     "level": "Info", 

     "displayStatus": "Ready", 

     "message": "GuestAgent is running and processing the extensions.", 

     "time": "2023-04-25T04:41:17.296+00:00" 

   } 

], 

"extensionHandlers": [ 

   { 

     "type": "Microsoft.CPlat.Core.RunCommandWindows", 

     "typeHandlerVersion": "1.1.15", 

     "status": { 

       "code": "ProvisioningState/succeeded", 

       "level": "Info", 

       "displayStatus": "Ready" 

     } 

   }, 

   { 

     "type": "Microsoft.CPlat.Core.WindowsHibernateExtension", 

     "typeHandlerVersion": "1.0.3", 

     "status": { 

       "code": "ProvisioningState/succeeded", 

       "level": "Info", 

       "displayStatus": "Ready" 

     } 

   } 

  },   

  "extensions": [ 

   "name": "AzureHibernateExtension", 

   "type": "Microsoft.CPlat.Core.WindowsHibernateExtension", 

   "typeHandlerVersion": "1.0.3", 

   "substatuses": [ 

     { 

       "code": "ComponentStatus/VMBootState/Resume/succeeded", 

       "level": "Info", 

       "displayStatus": "Provisioning succeeded", 

       "message": "Last guest resume was successful." 

     } 

   ], 

   "statuses": [ 

     { 

       "code": "ProvisioningState/succeeded", 

       "level": "Info", 

       "displayStatus": "Provisioning succeeded", 

       "message": "Enabling hibernate succeeded. Response from the powercfg command: \tThe hiberfile size has been set to: XX bytes.\r\n" 

     } 

   ] 

  ], 

  "statuses": [ 

   "code": "ProvisioningState/succeeded", 

   "level": "Info", 

   "displayStatus": "Provisioning succeeded", 

   "time": "2023-04-25T04:41:17.8996086+00:00" 

}, 

   "code": "PowerState/running", 

   "level": "Info", 

   "displayStatus": "VM running" 

  ] 

  1. If the Windows guest fails to resume from its previously state and instead cold boots, then the VM instance view response will be:  

  "extensions": [ 

   "name": "AzureHibernateExtension", 

   "type": "Microsoft.CPlat.Core.WindowsHibernateExtension", 

   "typeHandlerVersion": "1.0.3", 

   "substatuses": [ 

     { 

       "code": "ComponentStatus/VMBootState/Start/succeeded", 

       "level": "Info", 

       "displayStatus": "Provisioning succeeded", 

       "message": "VM booted." 

     } 

   ], 

   "statuses": [ 

     { 

       "code": "ProvisioningState/succeeded", 

       "level": "Info", 

       "displayStatus": "Provisioning succeeded", 

       "message": "Enabling hibernate succeeded. Response from the powercfg command: \tThe hiberfile size has been set to: XX bytes.\r\n" 

     } 

   ] 

  ], 

  "statuses": [ 

   "code": "ProvisioningState/succeeded", 

   "level": "Info", 

   "displayStatus": "Provisioning succeeded", 

   "time": "2023-04-19T17:18:18.7774088+00:00" 

}, 

   "code": "PowerState/running", 

   "level": "Info", 

   "displayStatus": "VM running" 

  ] 

Windows Guest events while resuming 

If a guest successfully resumes, the following guest events will be available:  

If the guest fails to resume, all or some of these events will be missing. To troubleshoot why the guest failed to resume, the following logs will be needed:

1. Event logs on the guest: Microsoft-Windows-Kernel-Power, Microsoft-Windows-Kernel-General, Microsoft-Windows-Kernel-Boot.

2. On bugcheck, a guest crash dump is needed