How to Disable a Hyper-V VM Stuck in the Starting/Stopping State

Hyper-V is a well-known hardware virtualization platform that is popular because it is the native Windows hypervisor. Virtualization provides many advantages and running virtual machines is convenient. However, errors can occur. It may happen that you get the “Hyper-V failed to change state” error and the VM is stuck when trying to power it on or off. The start, stop and reset buttons don’t work for the VM in this case.

You cannot edit the VM settings and use the VM until you solve this issue. If you are already looking for how to disable Hyper-V or how to uninstall Hyper-V, don’t hurry up. This blog post explains the possible reasons for getting the “Hyper-V failed to change state” error and methods to resolve this issue.

NAKIVO for Hyper-V Backup

NAKIVO for Hyper-V Backup

Agentless, application-aware backups for Hyper-V. Anti-ransomware protection, instant VM boot from backup, other virtual/physical platform support and more.

Explanation of the Error

Start, stop, reset buttons are usually not available in the graphical user interface. If you try to click these buttons, the error message is displayed. The complete text of the Hyper-V VM stuck error message displayed when you try to start or stop a virtual machine in Hyper-V is displayed below:

The application encountered an error while attempting to change the state of the virtual machine.

VM-name Failed to change state.

The operation cannot be performed while the object is in its current state.

The “Hyper-V failed to change state” message can also contain this phrase:

The status cannot be changed.

Common reasons for the start/stop VM error are storage failure, incorrect network configuration, Routing and Remote Access configuration, VM power options, and insufficient permissions to access VM files.

Killing the Process of the Problematic VM

When you encounter a start/stop VM error, you cannot just kill the VM traditionally by killing the Virtual Machine Worker Process (vmwp.exe), which is one of the important Hyper-V services / processes. You need to know the Globally Unique Identifier (GUID) of the problematic VM because multiple instances of the vmwp.exe process are running in Windows and each instance is related to the appropriate VM. If you try to guess the needed vmwp.exe and kill each vmwp.exe instance, you can kill an unknown VM each time, and you could end up killing almost all of the VMs before you find the right one.

Method 1: Using native GUI tools

You can use the graphical user interface (GUI) of Windows and Hyper-V to identify the needed vmwp.exe process and end this process. Hyper-V Manager is a tool with a GUI for virtual machine management in the Windows Hyper-V environment.

Get the VM GUID in Hyper-V Manager. Right-click the name of your Hyper-V host in Hyper-V Manager and in the context menu select Hyper-V Settings.

Opening Hyper-V settings for virtual machine management

In the Hyper-V Settings window, click Virtual Machines in the left pane to find the path where VM files are located by default on the Hyper-V host. In our example, the path is E:\VMs\.

Checking the default folder to store Hyper-V virtual machines

When you know the location where VM files are stored, go to this folder in Windows Explorer. Find the subfolder where the files of the frozen VM are located. In my case, the VM name is “Ubuntu Hyper-V”. Open the VM folder, and you should see a subfolder and files with a long name consisting of digits and letters. This is the VM GUID needed to identify the vmwp.exe process and force the VM stop. In my example, the VM GUID is 3C555937-A999-4542-B77E-FD69488B8579.

Hyper-V failed to change state - checking the VM GUID to fix the error

If you cannot detect the VM GUID in the graphical user interface of Windows and Hyper-V, you can use Process Explorer or PowerShell (see sections below).

Once you have found the ID, you can end the vmwp exe task related to the problematic Hyper-V VM.

Open Windows Task Manager in the host operating system. Click Start > Run or press Win+R, type taskmgr and hit Enter.

Find the vmwp.exe process with the needed GUID in the User name column. Right-click the appropriate vmwp exe process and in the context menu select End task to power off the VM and get the correct stop VM state.

Turn off Hyper-V Windows services and restart them to fix the error

Note: You can right-click the column header, for example, User name, and click Select Columns. Select the Command line and Description checkboxes in the Select Columns window, then click OK. After that, you can see the VM GUID for each vmwp exe process in Command Line column of the task manager.

Ending the vmwp exe service in Windows Task Manager

Method 2: Using Process Explorer

You can identify the needed instance of the vmwp exe process related to the problematic VM with Process Explorer, which is a free tool provided by Microsoft. Download Process Explorer, which contains advanced options not included in the standard task manager from the Microsoft website. Unzip the Process Explorer files to a custom folder.

Open Hyper-V Manager, open VM settings for your problematic VM, and select virtual hard drive options. Copy the full path to a virtual hard disk file. In our case this path is:

“E:\VMs\Ubuntu Hyper-V\Virtual Hard Disks\Ubuntu Hyper-V.vhdx”

Checking the location of VM files

Start Process Explorer by running the appropriate execution file (procexp64.exe in our case).

Click the binocular icon and paste the path to the virtual disk file of the stuck VM in the Handle or DLL substring field, then click Search.

The instance of vmwp.exe needed is found. Click vmwp.exe that was found in the search window and the appropriate instance of the vmwp exe process is selected in Process Explorer automatically.

Search for the needed instance of the vmwp exe service in Process Explorer

Right-click the selected vmwp.exe process and in the context menu click Kill Process.

Killing the vmwp exe process in Process Explorer

Method 3: Using PowerShell to kill the VM process

Let’s open PowerShell and fix the error. If you try to run the Stop-VM -Force command, you can see that this command doesn’t work for stopping the VM after the VM gets stuck. Use this command to identify the unique ID of the VM:

Get-VM “VM-name” | fl *

Checking the VMID (VM GUID) in PowerShell

As a more elegant alternative, you can use these commands to check the ID:

$VMGUID = (Get-VM “Ubuntu Hyper-V”).ID

Get-VM | Select Name, Id

In our case, we need to know the GUID of the “Ubuntu Hyper-V” VM. The GUID of this VM is saved as the $VMGUID variable in the memory for this PowerShell session.

Checking the VM GUID in PowerShell

Run these commands to kill the process and stop VM:

$VMWMProc = (Get-WmiObject Win32_Process | ? {$_.Name -match ‘VMWP’ -and $_.CommandLine -match $VMGUID})

Stop-Process ($VMWMProc.ProcessId) -Force

Ending the vmwp exe process that makes the VM stuck

Now the problematic VM process is killed and the VM is stopped. You can try to edit the VM settings and run the VM.

Other Methods to Fix the Hyper-V Failed to Change State Error

It may happen that you have killed the hang VM process in Hyper-V but the VM cannot start. In this case, if you try to start the VM, you could get the Hyper-V error:

Virtual Machine Connection:

Failed to Change State.

Below, I provide other possible reasons of the “Hyper-V failed to change state” error, methods that can help fix the error and how to turn off Hyper-V VMs completely after getting this error.

DVD drive settings

Open VM settings and check DVD options for the VM. If the VM cannot access the ISO image, the error can occur. Make sure that the ISO file exists and the path is defined correctly. You can also disable a virtual DVD drive if this drive is not used in a virtual machine.

Storage errors

Check whether there is enough disk space on VM storage. If there is insufficient disk space for storing VM files, the storage failure can cause VM to get stuck and show a “Hyper-V failed to change state” error. If the VM failure occurred due to the lack of storage space, you may need to run these commands to fix disk errors inside VMs:

sfc /scannow
dism /online /cleanup-image /restorehealth

If you cannot start a VM normally or there is VM stuck in a continuous loop, insert a Windows installation ISO image to a virtual DVD drive, boot a VM from this ISO image (open virtual BIOS/UEFI and select DVD-ROM as the first boot device), select Repair mode, start CMD, and run the command:

chkdsk /f /r /x c:

When the disk check is finished and disk errors are fixed, reboot the VM, boot from a virtual hard disk drive (the VM should boot now) and run the commands mentioned before inside the guest OS:

sfc /scannow
dism /online /cleanup-image /restorehealth

You may also need to check your physical disks used for Hyper-V storage on a Hyper-V host.

Network configuration errors

Check the VM’svirtual network adapter settings. If the Network Adapter – Configuration Error status is displayed for at least one network adapter, then you might have start/stop VM issues in Hyper-V. VM network adapters must be connected to existing virtual switches for normal operation. This error can be displayed if the network configuration was changed or became corrupted.

Network failure or storage failure can be a reason of errors for Hyper-V VMs

Detecting issues in logs

Check Windows Event Logs and Hyper-V related errors. Run compmgmt.msc, then go to Event Viewer > Applications and Services Logs > Microsoft > Windows > Hyper-V-Worker. If you see error messages in the logs, the explanation of the error can point you to the source of the problem.

Blocking access by antivirus software

Check your antivirus software settings. The antivirus must not block access to Hyper-V VM files. If the antivirus blocks access to VM files, add folders where VM files are stored to exclusions in antivirus settings. Hyper-V must have full access to VM folders and files.

VM power options

Check the power options in the settings of the guest operating system. Sleep mode and hibernation must be disabled. In the Windows guest, open Control Panel, then go to Power Options, and make sure that the “Put the computer to sleep” option is set to Never. If Ubuntu Linux is installed as the guest operating system, use the command to disable the sleep mode:

sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

Checking VMMS

vmms.exe is a process used by Hyper-V. Make sure that the Hyper-V Virtual Management Service (VMMS), which is one of the important Hyper-V services, is running properly and the VMMS doesn’t get stuck and is not in the starting or stopping state (status). The service status must be Running.

The Hyper-V Virtual Machine Management service is running

The VMMS service is related to the vmms.exe process.

The vmms.exe process is related to the Virtual Machine Management service in Hyper-V

Disable RRAS

Misconfiguration of Routing and Remote Access Service (RRAS) can be a reason for a Hyper-V VM getting stuck due incorrect network configuration. Try to disable RRAS in Windows Server operating as a Hyper-V host.

Press Win+R to open the Run dialog box.

Type services.msc and hit Enter.

Find the Routing and Remote Access Service in the Services window, right-click the service and in the context menu click Properties. In the General tab of the Routing and Remote Access properties window, click Stop and change the startup type to Disabled.

Rebooting the Hyper-V host machine

If any of the methods above don’t help, try to reboot the Hyper-V host machine. If you have other Hyper-V hosts or a Hyper-V High Availability cluster, you can migrate running VMs to other hosts and then shut down the Hyper-V host with the problematic VM.

Fixing Hyper-V VM Stuck in the Saved State

Hyper-V VM getting stuck can happen not only in the start/stop VM state, but also in the saved VM state. The symptoms are similar and you cannot change the VM state of the problematic VM. The Start/Stop VM buttons don’t work. If you close Hyper-V while a VM is being backed up, you can get the Hyper-V VM stuck in the saved state. This can happen if the backup process is interrupted and a VM is put in the saved state. The VM can be corrupted or damaged in this case. Let’s explore common reasons for this error and methods to fix this error.

Disk errors

If a disk with VM files is unplugged while a VM is running, then the error can occur for a VM and the VM is put into the saved state. This error is more plausible for Hyper-V home users who store VM files on USB disks. However, administrators of organizations should be aware that this error can be caused by storage issues. In case of insufficient disk space, a VM hangs and can be also put in the saved state. If you have configured a VM to use virtual hardware that is not supported by a guest operating system, the VM can get stuck in the saved state. This issue can happen if you create a new VM and import an existing virtual disk with the installed guest OS. Edit VM options, select the correct storage controller and other disk options. Read about the difference between Generation 1 VMs and Generation 2 VMs for more information.

Insufficient hardware resources

If you run multiple resource-hungry VMs on a Hyper-V host, in a case of insufficient memory and CPU performance, a VM can crash and be put in the saved state. Then you should make an effort to fix the crashed VM. To avoid this issue, upgrade your hardware or don’t run multiple heavy VMs on the host with low performance. Migrate the VM to another Hyper-V host if possible.

Incorrect folder permissions

If there are not enough permissions for folders and VM files, then the VM can get stuck in the Saved state. Open the properties of the folder where the VM files are stored. Check the Security and Sharing tabs (if a VM is in a shared folder on the shared storage). Set permissions to Allow all for the needed user or group.

Deleting the virtual machine

This is another method to resolve the VM stuck in the Starting/Stopping/Saved State issue if other methods didn’t help. You don’t want to lose data and for this reason, you should copy virtual disk files to a safe location. Then delete the problematic VM including VM configuration files from the original location (right-click the VM and hit Delete in Hyper-V Manager). Create a new VM, copy the virtual disks from a backup to the new VM location and select an existing virtual disk when creating a new VM in Hyper-V.

A VM is stuck in the “Backing up” status

Another similar issue is the Hyper-V VM stuck in the Running state with the Backing up status. You cannot start and stop VMs in this state in Hyper-V Manager. Rebooting the Hyper-V host usually helps resolve this issue, but reboot is not desired because other VMs running on the host must be shut down or migrated.

How to turn off Hyper-V VMs hanging with the backing up status

The possible cause of this error is an issue with the Microsoft Hyper-V VSS Writer service on the Hyper-V host.

Open the command line (CMD) as administrator and run this command to check the status of VSS writers:

vssadmin list writers

If there are no errors, the output for each VSS writer is similar to the output displayed on the screenshot below.

Checking VSS writers on a Hyper-V host

The Microsoft Hyper-V VSS Writer service depends on the parent Hyper-V Virtual Machine Management service. For this reason, you have to restart the Hyper-V Virtual Machine Management service to restart the needed VSS service and fix the issue.

The fastest way to restart the Hyper-V Virtual Machine Management service is to open Services in Computer Management or run services.msc, right-click the service name and select Restart.

Restarting the Hyper-V Virtual Machine Management service

If Hyper-V VSS Writer is hanging and not responding, you should manually end the vmms.exe process in Task Manager. Open Task Manager, right-click vmms.exe and select End Process Tree in the context menu.

Ending the vmms.exe process and restarting Virtual Machine Management service

After you end the vmms.exe process, virtual machines should disappear in Hyper-V Manager. Start the Hyper-V Virtual Machine Management service, and you should see the list of your VMs again and the backing up status of the problematic VM should be gone. Restarting these Hyper-V services should resolve the issue.

Conclusion

The Hyper-V failed to change state error is an unpleasant error for users and administrators when using virtual machines. Fortunately, there is a high probability to fix the error related to the Hyper-V VM stuck when you cannot stop VMs that are problematic. This blog post looked at common reasons and possible methods for fixing the “Hyper-V failed to change state” and “failed to restore virtual machine state” errors.

You should be aware that sometimes VM data can be corrupted after this error, other errors, and hardware failures. For this reason, it is recommended that you perform Hyper-V VM backup regularly to avoid data loss. Use NAKIVO Backup & Replication to back up your Hyper-V VMs with optimal performance and space-saving features.

1 Year of Free Data Protection: NAKIVO Backup & Replication

1 Year of Free Data Protection: NAKIVO Backup & Replication

Deploy in 2 minutes and protect virtual, cloud, physical and SaaS data. Backup, replication, instant recovery options.

People also read