none
Hyper-v server 2016 doesn't restart VM (just stop)

    Question

  • hello,

    just finished provisioning a new hpe dl380g9 server with hyperv server 2016. Installed it on microsd (yes, it is supported by HPE). All recommended updates installed.

    everything seemed smooth but now, provisioning VMs I have major troubles. Being them either Linux or Windows VM, if I try to restart a VM, what I got MOSTLY is just a Stop. Now and then the VM actually restarts.

    I've tryed several methods: reboot from within the VM or reboot via powershell cmdlets. In either case reboot randomply fails with a high rate (>75% tries).

    If I run from powershell, Restart-VM gives the following error when the restart fails:

    Restart-VM -Name zi-erp-as
    
    Confirm
    Are you sure you want to restart virtual machine "zi-erp-as"?
    [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [?] Guida (il valore predefinito è "Y"):
    Restart-VM : 'zi-erp-as' failed to change state.
        + CategoryInfo          : NotSpecified: (:) [Restart-VM], VirtualizationException
        + FullyQualifiedErrorId : OperationFailed,Microsoft.HyperV.PowerShell.Commands.RestartVM


    I've tried to restart the entire server but issue is still here!

    several stop-VM; start-VM seem to work.

    Honestly I don't even know from where to start sorting this out.

    Any hint?

    regards,

    M


    • Edited by MatteoN Friday, March 24, 2017 4:27 PM
    Friday, March 24, 2017 4:25 PM

All replies

  • I post here some system settings:

    hyper-v server is on microsd

    VM are in 2 arrays each one managed by a raid controller.

    when a VM is created in array 1 I (think to) put all required files (from definitions to paging) into such an array, nothing is kept on the sd.

    the only actual change to hyper-v server (other than HPE drivers installed by windows at automatically at install time) is that I've disabled the paging file. 

    VM are all gen2 with dynamic vhdx and dynamic memory

    Friday, March 24, 2017 4:34 PM
  • I'm not entirely sure what your end goal is from your description, but if you're expecting a graceful restart using any of the built-in tools, then you won't get one. From Restart-VM's help:

    DESCRIPTION
        The Restart-VM cmdlet restarts a virtual machine. Running this cmdlet results in a "hard" restart, like powering
        the computer down, then back up again. This can result in data loss in the virtual machine.


    Eric Siron
    Altaro Hyper-V Blog
    I am an independent contributor, not an Altaro employee. I accept all responsibility for the content of my posts. You accept all responsibility for any actions that you take based on the content of my posts.

    Friday, March 24, 2017 4:43 PM
  • gosh! mixed the things up!

    my goal is basically to be able to restart a VM remotely either from ssh or powershell.

    I've started, as first, connecting to the hyper-v virtual console updating the VMs and issuing some reboot/shutdown -r etc...

    very often I do not get a proper reboot but just the shutdown. this kills the remote usage as I cannot restart the machine.

    then I've tried to go more "deep" and -due to misunderstanding or tiredness- I was sure that restart-vm did the job at hypervisor level.

    Still, I cannot reliably reboot a machine from within it. several start+stop at powershell seem perfectly working!

    thank you to point out at least this error!

    M





    • Edited by MatteoN Friday, March 24, 2017 6:03 PM
    Friday, March 24, 2017 5:56 PM
  • If your goal is a graceful restart without turning to third party options, you have two options:

    • Restarting from within the guest
    • Using Hyper-V's tools to issue a graceful shutdown, waiting for it to complete, then issuing a start command

    If you have done the former and it is failing, that problem must be troubleshot from within the guest. In order for any computer, physical or virtual, to restart, it must signal the ACPI system to reset. If Hyper-V won't restart a guest, it's because the hypervisor never received that ACPI reset command. I seem to have a special talent for breaking my Linux guests so that they won't restart, but it is always a problem within the guest.

    If you're looking for simpler control from the hypervisor layer, you'll need to roll your own solution or find a third party answer. I rolled my own: http://www.altaro.com/hyper-v/free-script-restart-virtual-machines-hyper-v/. I'm sure mine isn't the only one.


    Eric Siron
    Altaro Hyper-V Blog
    I am an independent contributor, not an Altaro employee. I accept all responsibility for the content of my posts. You accept all responsibility for any actions that you take based on the content of my posts.

    Friday, March 24, 2017 6:24 PM
  • Thank Eric,

    reboot from within the guest is my goal. (but I'll keep a bookmark for your script)

    I'll investigate the ACPI issue, but... how is possible that a brand new server core 2012r2 simply has messed up acpi? I can understand some conflicts between -say- ubuntu and hyper-v, but windows on windows was in my mind a no-brainer. Instead even server core 2012r2 doesn't restart on my hyper-v 2016.

    Or, better, now and then they all restart. I've just installed server core and applied all the recommended updates. for sure I've not touched any acpi related setting. this is what puzzles me. Anyway I'll follow your suggestion and will check for any acpi info!

    Friday, March 24, 2017 6:49 PM
  • It doesn't have a messed up ACPI. The host's ACPI never comes into play. We are talking about the ACPI construct that Hyper-V builds for each of its guests.

    Unless you've uncovered a Hyper-V bug, restart failures are always problems within the guest. It is an operating system's responsibility to perform whatever cleanup it wants and then issue an ACPI reset command. When Hyper-V receives that command, it does the exact same thing that you would do by pushing Hyper-V's reset button or using the built-in Restart-VM cmdlet. If a guest is not restarting, it is always because the guest failed to transmit the ACPI reset command to Hyper-V.


    Eric Siron
    Altaro Hyper-V Blog
    I am an independent contributor, not an Altaro employee. I accept all responsibility for the content of my posts. You accept all responsibility for any actions that you take based on the content of my posts.

    Friday, March 24, 2017 6:59 PM
  • It doesn't have a messed up ACPI. The host's ACPI never comes into play. We are talking about the ACPI construct that Hyper-V builds for each of its guests.

    Sorry, this is a misunderstanding:

    hyper-v 2016 is my host, server core 2012r2 is one of the guests. and even it doesn't reboot but just shutdown 75% of time!

    so my consideration was: how is possible that a brand new 2012r2 on 2016 doesn't signal ACPI correctly to the hypervisor,?! it is microsoft over microsoft! sounds strange!

    I've not messed up with any guest config yet (just added a network card via vm manager, booted, entered the VM and setup an IP via sconfig).

    I do not think this is an hyper-v but either: none in this world has this issue apparently (google didn't return anything) and every day millions of VM are rebooted for sure on hyper-v from a remote session IN the guest!

    how does hyper-v manage the acpi part? has it anything to do with the underlying HW? I suppose NOT but never say never: when whatever guest OS refuses to run properly, it seems more of a hypervisor issue.

    I agree anyway that acpi signalling is done by the rebooting OS to the underlying software layer so guest is to be checked.

    here is where I Iost myself: all guest are wrong? all of them? usually this means that the cause is somewhere else. say the hypervisor; anyway acpi signalling comes from the guest. wow, this could mean I've applied the same config to all VM (as I did) and that config is wrong... I don't see any other solution. but where in the config, does acpi behaviour can come up?

    Friday, March 24, 2017 7:11 PM
  • Well, I wasn't there when you had all of these problems so all I can do is guess. It's not strange for a Windows Server guest to be appear to be hung to all outward appearances but in reality be doing something like processing updates. I've seen some sit for over 10 minutes looking completely frozen. Especially brand-new VMs that are getting right with the world.

    There's always a chance that there's a bug in Hyper-V related to ACPI, but it's such a simple thing that it seems quite unlikely. If you can successfully use the reset button in the console connection or use Restart-VM, then it's even less likely that there's a bug.


    Eric Siron
    Altaro Hyper-V Blog
    I am an independent contributor, not an Altaro employee. I accept all responsibility for the content of my posts. You accept all responsibility for any actions that you take based on the content of my posts.

    Friday, March 24, 2017 7:22 PM
  • Restart-VM message has to be send to host machine not to the guest. Have you an hypervisor installed on guest machine?

    If you want to restart within guest machine via powershell use "shutdown /r" instead Restart-VM

    Hope helps you

    Sunday, March 26, 2017 7:32 AM
  • OK,

    sorry for the late reply: the server mobo blown away!

    I hoped that the faulty mobo was the issue, but after a fresh reinstall still I got the same issues. In the meantime I've used hyperv on my pc (win 10) and to be honest everything works as expected.

    I think it is a combination of drivers/bios settings at this point. Unfortunately I've installed the latest HP service pack and it doesn't change anything.

    are you aware of any particular setup required by hyperv in bios?

    Monday, April 03, 2017 7:31 AM
  • additional news today:

    - if I build a full bloated server with GUI

    - if I build a "barebone" server core the VM just shuts down and is not able to restart...

    main difference I notice is that the shutdown in a full server requires more io activity and cpu activity, and takes more time...



    • Edited by MatteoN Tuesday, April 04, 2017 3:28 PM
    Tuesday, April 04, 2017 3:27 PM
  • problem partially solved by keeping the smart paging location of VM in the default hypervisor location.

    I think it was neither the hypervisor nor the VMs but a mismatch between firmare/os/drivers in the server controllers...

    Thursday, April 06, 2017 1:00 PM
  • Hi,

    Thank you for taking the time to update the result. Your detail sharing might be helpful for other people who has the similar problem.

    If there is anything else we can do for you, please feel free to post in the forum.

    Best Regards,
    Eve Wang

    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Friday, April 07, 2017 2:06 AM
    Moderator
  • I've had this exact same problem, in at least 3 places:

    • In the guest, issue "shutdown /r", the hyper-v guest just turns off.
    • From server manager, issue a restart to a machine, it just turns off.
    • Guest's "Automatic Start" action is set to "Always start" or "start if running before", host reboots, guest stays stubbornly turned off.

    Finally fixed it from the ideas here - I just set the smart paging location back to the default (C:\ProgramData\Microsoft\Windows\Hyper-V) and now after a shutdown /r the guest actually comes back up.

    That also fixes it from Server Manager. I have high hopes for it being fixed during a host restart too, which is probably the most important case.

    • Proposed as answer by schrippe Tuesday, May 08, 2018 11:45 AM
    Wednesday, July 19, 2017 8:55 PM