Recently, I had such a case that I created a test virtual machine on a host with Hyper-V Server 2019 installed and I wanted to transfer it to a host with production machines on Windows Server 2016. As you know, live migration, restore from backup or export / import will fail with due to the fact that in version 2019 there is a newer version of the virtual machine configuration. While importing or transferring the machine from a lower version to a higher one is not a problem, in my case a problem arose and it was possible to solve it, and I will describe the method of doing it below.
The solution to the problem is to create the machine in a lower configuration version and connect the disk to it from the source machine. This is where creating a virtual machine with PowerShell will help:
PS C:\Users\Administrator> New-VM Debian10-v8.0 -Version 8.0 -Generation 2
Name State CPUUsage(%) MemoryAssigned(M) Uptime Status Version
---- ----- ----------- ----------------- ------ ------ -------
Debian10-v8.0 Off 0 0 00:00:00 Operating normally 8.0
Hyper-V Manager confirms that virtual machine created correctly.
Next, I set the parameters of the virtual machine through Hyper-V manager and connect the one from the source machine as a disk:
After setting boot from disk as the first in order, unfortunately the attempt to boot the machine ends like this:
After checking the Boot order parameters on the source machine, you can see that we have the File entry set first, which is not present in the newly created machine. File Hyper-V type added during system installation.
On the new machine, we need to add this entry and for this we will use, for example, starting the system from a Live CD with a Linux or booting the system in recovery mode from the installation CD and adding the entry using efibootmgr. I started the system in recovery mode and mounted the root and boot partition. Then I executed the command after which the appropriate entry appeared in Boot order:
efibootmgr --create --label Debian --disk /dev/sda1 --loader "\EFI\debian\shimx64.efi"
After restart Linux Debian starts correctly
Update: Running Debian in rescue mode
I decided to add some screenshots of Debian rescue mode in order to help with any problems that may occur. Please see below screenshots with complete solution that I did for the above problem that Debian cannot boot after attaching a disk from a lower version of Hyper-V virtual machine. For this purpose, I used Debian 11 ISO and as you can see the efibootmgr command doesn’t work, so I used grub-install
grub-install --force-extra-removable --target=x86_64-efi /dev/sda
Thanks a lot, you helped me in restoring a vhdx file from a broken debian to an other fresh debian vm (fixing grub)
Can you pls share what commands you used for this part – “..and mounted the root and boot partition.”. Thanks a lot.
Hi, I did not use any commands and this can be done from the creator after booting from ISO in rescue mode.
Hi Daniel,
I get this Error: Do you now what I do wrong?
Hi, have you mounted root and boot partition before using efibootmgr?
Please read this article 8.7. Recovering a Broken System (debian.org)
Having the same problem. I don’t have that command available.
I’m booting from Debian 11.5 amd64 ISO into rescue mode.
Executed the shell into /dev/sda1. Then ran efibootmgr command.
Can you share the complete steps on “mounting the root and boot partition” for those of us that have 0 linux experience?
Reading the above article did not help me unfortunatelly.
Thanks.
Hi Claudiu,
Please see update of article as I’ve added additional details about running Debian in rescue mode, so you will probably find solution to your problem.
Thank you, it works !
Solved my problem. Thank you so much! 🙂