Install Kali Linux 2.0 On Hyper-V

If you have found yourself in a scenario where you need to deploy Kali Linux on Hyper-V, you are probably aware that the ISO isn’t compatible and dies during bootup. As with almost any technology, there are multiple ways to skin this cat, however in this article we will detail the steps required to get the Kali Linux 2.0 VMware image converted and running on Hyper-V.  The first thing you need to do is get the image. You can either make your own which has its benefits or you can follow the link in required software and download the pre-built VMware Image of your choice directly from Offensive Security.

Required software

  • Microsoft Virtual Machine Converter 3.0 available here.
  • Kali Linux 2.0 64 or 32 bit VMware Image available here.

Preparations

  • Download and install Microsoft Virtual Machine Converter 3.0.
  • Download and extract the Kali Linux 64 or 32 bit VMware Image referred to above.

Convert The Image

Next we will need to convert our VMware Image in order for Hyper-V to run it. This can be done using Powershell as seen below.

# Change Execution Policy so you can run the code
Set-ExecutionPolicy -ExecutionPolicy Unrestricted
# Import the Converter Powershell Module
Import-Module "C:\Program Files\Microsoft Virtual Machine Converter\MvmcCmdlet.psd1"
# Convert the VMware .vmdk to a Hyper-V .vhdx
ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath "D:\Kali\Kali-Linux-2.0.0-vm-amd64.vmdk" -DestinationLiteralPath "D:\Kali2.vhdx" -VhdType DynamicHardDisk -VhdFormat Vhdx

Using The Image

In order to use our newly created image we must first create a new Hyper-V virtual machine or edit one that has been previously created. In our example picture below we are editing a Virtual Machine we had already created. Important notes below

  • When creating your new virtual machine, you must ensure you select “Generation 1” when choosing the generation of the virtual machine.
  • The converted image can be moved to any location you choose.
  • The default username and password for our Kali Linux 2.0 Image is root and toor.

kali-disk
Once you have completed all the steps above, you should have a fully working Kali Linux 2.0 installation running on Hyper-V.

Did you find this article useful? Why not share it with your friends?

24 thoughts on “Install Kali Linux 2.0 On Hyper-V

  1. Matthew, thank you for taking the time for the post and replies.

    I need some help or guidance.
    I cannot convert the image using W10 Pro on my personal laptop. I have full admin rights. I have not had any issues with other programs or apps.

    When I try to convert the image I get following error message: The entry 4 is not a supported disk database entry for the descriptor.
    Do you know what “entry 4” is referring to?

    I tried searching for solutions via Google and did not come up with anything that works so far. I did learn that there are other users with same error and did not get a fix.

    Text from command window:
    PS C:\WINDOWS\system32> ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath “C:\Kali\Kali-Linux-2016.1-vm-amd64.vmdk” -Dest
    inationLiteralPath “C:Kali\Kali2.vhdx” -VhdType DynamicHardDisk -VhdFormat Vhdx
    ConvertTo-MvmcVirtualHardDisk : The entry 4 is not a supported disk database entry for the descriptor.
    At line:1 char:1
    + ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath “C:\Kali\Kali-Linux- …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : WriteError: (Microsoft.Accel…nversionService:DriveConversionService) [ConvertTo-MvmcVi
    rtualHardDisk], VmdkDescriptorParseException
    + FullyQualifiedErrorId : DiskConversion,Microsoft.Accelerators.Mvmc.Cmdlet.Commands.ConvertToMvmcVirtualHardDiskC
    ommand

    ConvertTo-MvmcVirtualHardDisk : One or more errors occurred.
    At line:1 char:1
    + ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath “C:\Kali\Kali-Linux- …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : WriteError: (Microsoft.Accel…nversionService:DriveConversionService) [ConvertTo-MvmcVi
    rtualHardDisk], AggregateException
    + FullyQualifiedErrorId : DiskConversion,Microsoft.Accelerators.Mvmc.Cmdlet.Commands.ConvertToMvmcVirtualHardDiskC
    ommand

    I have tried entering only the ConvertTo as shown and get the same entry 4 not supported.:
    PS C:\WINDOWS\system32> ConvertTo-MvmcVirtualHardDisk

    cmdlet ConvertTo-MvmcVirtualHardDisk at command pipeline position 1
    Supply values for the following parameters:
    SourceLiteralPath: C:\Kali\Kali-Linux-2016.1-vm-amd64.vmdk
    ConvertTo-MvmcVirtualHardDisk : The entry 4 is not a supported disk database entry for the descriptor.
    At line:1 char:1
    + ConvertTo-MvmcVirtualHardDisk
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : WriteError: (Microsoft.Accel…nversionService:DriveConversionService) [ConvertTo-MvmcVi
    rtualHardDisk], VmdkDescriptorParseException
    + FullyQualifiedErrorId : DiskConversion,Microsoft.Accelerators.Mvmc.Cmdlet.Commands.ConvertToMvmcVirtualHardDiskC
    ommand

    ConvertTo-MvmcVirtualHardDisk : One or more errors occurred.
    At line:1 char:1
    + ConvertTo-MvmcVirtualHardDisk
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : WriteError: (Microsoft.Accel…nversionService:DriveConversionService) [ConvertTo-MvmcVi
    rtualHardDisk], AggregateException
    + FullyQualifiedErrorId : DiskConversion,Microsoft.Accelerators.Mvmc.Cmdlet.Commands.ConvertToMvmcVirtualHardDiskC
    ommand

    I enter the source with double quotation marks and get file does not exist; same result if I use single ticks:
    PS C:\WINDOWS\system32> ConvertTo-MvmcVirtualHardDisk

    cmdlet ConvertTo-MvmcVirtualHardDisk at command pipeline position 1
    Supply values for the following parameters:
    SourceLiteralPath: “C:\Kali\Kali-Linux-2016.1-vm-amd64.vmdk”
    ConvertTo-MvmcVirtualHardDisk : The file ‘”C:\Kali\Kali-Linux-2016.1-vm-amd64.vmdk”‘ does not exist.
    At line:1 char:1
    + ConvertTo-MvmcVirtualHardDisk
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : WriteError: (Microsoft.Accel…nversionService:DriveConversionService) [ConvertTo-MvmcVi
    rtualHardDisk], FileNotFoundMvmcException
    + FullyQualifiedErrorId : DiskConversion,Microsoft.Accelerators.Mvmc.Cmdlet.Commands.ConvertToMvmcVirtualHardDiskC
    ommand

    ConvertTo-MvmcVirtualHardDisk : One or more errors occurred.
    At line:1 char:1
    + ConvertTo-MvmcVirtualHardDisk
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : WriteError: (Microsoft.Accel…nversionService:DriveConversionService) [ConvertTo-MvmcVi
    rtualHardDisk], AggregateException
    + FullyQualifiedErrorId : DiskConversion,Microsoft.Accelerators.Mvmc.Cmdlet.Commands.ConvertToMvmcVirtualHardDiskC
    ommand

    I am running W10 Pro, Microsoft Windows Version 1511 (OS Build 10586.164) [Version 10.0.10586]
    on platform ASUS N501VW, Intel i7-6700HQ, 16GB memory, 500GB SSD.

    I am using copy/paste and copy path to be sure I am providing the proper source path. I have tried changing location of folders to shorten file path; and I am running as admin.

    “C:\Kali\Kali-Linux-2016.1-vm-amd64.vmdk” File Permission are set to “Full” for the admin user. I also tried turning of personal Windows Firewall and Windows Defender with same results. I am not using any other malware protection.

    Any help is appreciated. This is my first attempt at using Hyper-V with Kali. I am familiar with using VM’s. I normally use VMware Fusion and VMware Workstation Pro without too many issues.

    Thanks,
    Wally

          1. I tried converting a VM of Windows 7 and was unable to convert with mvmc. That threw an error 1. With Debug turned on the mvmc does not like “setup” of the vmdk. I wonder if this issue has something to do with using skylake chipset on a brand new ASUS Zenbook.

            I do not understand the “error #” messages.

          2. It almost seems like may be hardware related. I don’t currently have Windows 10 installed on hardware so I really cant help much at the moment.

          3. I loaded vmware workstation and that is okay. When I get time I will try hyper-v again using tool like Vmdk2Vhd

    1. ConvertTo-MvmcVirtualHardDisk : The entry 4 is not a supported disk database entry for
      The descriptor.

      3. Run in the CMD window:
      E:\> e:\dsfok\dsfo “[full path to VMDK]” 512 1024 descriptor1.txt

      E:\> e:\notepad2\notepad2.exe descriptor1.txt
      Add a hash sign before the ddb.toolsInstallType = “4” on line 20. #
      Delete the last line of NUL, and ensure that it is still 1024 bytes (the status bar is 1.00KB)
      Close notepad2 after saving

      E:\> dsfi “[full path to VMDK]” 512 1024 descriptor1.txt
      OK, written 1024 bytes at offset 512

      4. Go back to PowerShell and run the conversion command again.
      PS> ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath “[full path to VMDK]” -DestinationLiteralPath “[path to new VHD]” -VhdType DynamicHardDisk -VhdFormat Vhdx
      Wait for the conversion to complete.

        1. Mostly welcome.

          Just for info; i had to install some scripts myself which caused a little bit trouble. It doesn`t have anything to do with your instructions of course. They were perfect.

          I downloaded the Virtual Kali but for VMWare. I will now download the ISO and create my own VHD etc. to compare them.

          Once i got info, i can give feedback if there is any difference.

    1. Dennis, i worked on several international companies as IT koordinator.
      Usually there are group policies to restrict the functions which means a lot of futures can`t be used.
      Enabling virtualization are one of them.

      Another point, there are also some companies which doesn`t include usage of virtualization into the policies. (or forget)

      It might be an BIOS issue as well.

      I usually check the BIOS for virtualization first because it needs to be enabled.

      *It can be found under ‘Advanced Chipset settings’

  2. Thank you very much for this information! Also, you may want to include a comment on Execution Policy to make it run.
    Here’s the updated script for you:
    —————————————————–
    # Change Execution Policy so you can run the code
    Set-ExecutionPolicy -ExecutionPolicy Unrestricted
    # Import the Converter Powershell Module
    Import-Module “C:\Program Files\Microsoft Virtual Machine Converter\MvmcCmdlet.psd1”
    # Convert the VMware .vmdk to a Hyper-V .vhdx
    ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath “D:\Kali\Kali-Linux-2.0.0-vm-amd64.vmdk” -DestinationLiteralPath “D:\Kali2.vhdx” -VhdType DynamicHardDisk -VhdFormat Vhdx
    # Change Execution Policy back to Restricted to protect the machine
    Set-ExecutionPolicy -ExecutionPolicy Restricted
    —————————————————————-
    Just contributing and thank you again for the excellent tutorial!
    Tom

  3. Thank you for this well written explanation.
    I am using Win10 Pro, 1511
    i receive “No UEFI-Compatible File System was Found” error.
    I have tried turning off the Virtual Machine “Secure Boot” requirement, I still receive the error.
    It appears to work on Win10 the Grub needs to be modified.

  4. Cheers for this. Never used Powershell before either but now have a working Kali2 machine in Hyper-V configured on my Windows 10 laptop. Invaluable. Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.