How to get Whonix running on Hyper-V

I really appreciated Krystical’s original post with instructions on how to convert Whonix images to run in Microsoft’s Hyper-V so I wanted to provide updated instructions that work with Whonix 14 in case anyone else desires such a setup. We already use Hyper-V so installing a second Hypervisor like VirtualBox was undesirable. I have updated the original instructions so they work in 2019.

Step 1) Download, extract, and install everything you need: Whonix images, dsfok tools, 7zip, Notepad++, Microsoft Virtual Machine Converter 3.0

Step 2) Open Whonix 14 images (Whonix-Gateway-XFCE-14.0.0.9.9.ova and Whonix-Workstation-XFCE-14.0.0.9.9.ova) using 7zip and extract the .vmdk files somewhere like c:\temp\

Step 3) Extract dsfok tools to some location like c:\temp\

Step 4) Using PowerShell or CMD prompt, enter a command like: c:\temp\dsfo.exe "c:\temp\Whonix-Gateway-XFCE-14.0.0.9.9-disk001.vmdk" 512 1024 descriptor.txt to extract the descriptor files from the VMDK file

Step 5) Use Notepad++ or similar to edit descriptor.txt, and comment out (Put # in front of) all lines starting with “ddb.uuid” and “ddb.comment” and save the file.

Step 6) Use a command like: c:\temp\dsfi.exe "c:\temp\Whonix-Gateway-XFCE-14.0.0.9.9-disk001.vmdk" 512 1024 descriptor.txt to inject the descriptor back into the VMDK file

Step 7) Repeat steps 4-6 using Whonix-Workstation-XFCE-14.0.0.9.9-disk001.vmdk so that you have two VMDK files with modified descriptors

Step 8) Install Microsoft’s VM Converter 3.0 (or newer) which you downloaded in step 1

Step 9) Open PowerShell (as administrator) and enter commands like this if you used c:\temp
1) Import converter module to powershell: Import-Module "C:\Program Files\Microsoft Virtual Machine Converter\MvmcCmdlet.psd1"
2) Convert the Gateway VMDK file to VHDX: ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath "c:\temp\Whonix-Gateway-XFCE-14.0.0.9.9-disk001.vmdk" -DestinationLiteralPath "c:\temp\Whonix-Gateway-XFCE-14.0.0.9.9.vhdx" -VhdType DynamicHardDisk -VhdFormat Vhdx
3) Convert the Workstation VMDK file to VHDX: ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath "c:\temp\Whonix-Workstation -XFCE-14.0.0.9.9-disk001.vmdk" -DestinationLiteralPath "c:\temp\Whonix-Workstation -XFCE-14.0.0.9.9.vhdx" -VhdType DynamicHardDisk -VhdFormat Vhdx

Step 10) In Microsoft’s Hyper-V Manager, create a Generation 1 (Not a GEN 2 EFI) Hyper-V virtual machine to use as the Whonix Gateway and use the option for selecting an existing hard drive. Then select the newly created VHDX file. Add 2 legacy network adapters to the virtual machine; the first legacy network adapter should be connected to a virtual switch which has external connectivity to your LAN. The second legacy network adapter should be connected to a private virtual switch; this switch will let your Whonix Workstation connect to the internet through your Gateway’s private network connection.

Step 11) The first time you boot the Whonix Gateway, you will need to “cancel” out of the Anon Connection Wizard and configure your network settings through the console. We need to change your ‘eth0’ to connect to your network via DHCP rather than use VirtualBox’s network settings (which are typically on a different subnet).

Step 12) In console, enter the command sudo nano /etc/network/interfaces.d/30_non-qubes-whonix to open the configuration file and uncomment the two lines which contain auto eth0 and iface eth0 inet dhcp by removing the # in front of them. Then exit and save the changes you made.

Step 13) We still need to make one more configuration change to avoid getting a big ugly warning about Hyper-V not being a supported virtualizer. Open the configuration file for editing with the following command sudo nano /etc/whonix.d/30_whonixcheck_default.conf and then change the 0 to a 1 in the line to stop on the detection of an unsupported virtualizer. Reboot the virtual machine after you have saved these changes.

Step 14) In Microsoft’s Hyper-V Manager, create a Generation 1 (Not a GEN 2 EFI) Hyper-V virtual machine to use as the Whonix Workstation and use the option for selecting an existing hard drive. Then select the newly created Workstation VHDX file. Add 1 legacy network adapters to the virtual machine; and connect it to the same private virtual switch as you connected to the 2nd interface of the Gateway virtual machine. The Whonix workstation should not need any additional configuration and should work correctly when you start it.

Step 15) If you have followed these steps correctly and you didn’t encounter any problems, you should now be able to enjoy Whonix 14 on Hyper-V!


Edit by Patrick:
User @akcryptoguy and only user @akcryptoguy is responsible for this. This is a community project. Unsupported by Whonix developers. Whonix developers are delighted that Whonix can be modified and useful for others since this is in the spirit of Whonix.

At time of writing, Hyper-V is non-freedom software. Therefore the following Whonix policy is related:

Changed title from How to get Whonix 14 running on Hyper-V to How to get Whonix running on Hyper-V.

A very comprehensive instructable for someone very new to Whonix
However, I keep getting the error:

error: file ‘/boot/grub/1386-pc/normal.mod’ not found.
Entering rescue mode…
grub rescue>

And I do not know what is causing this, which step in this process could have lead to this?

I’m not sure how that could have happened. I presume we both started with the same image. I used the image for Whonix with XFCE and have not tested it yet with the CLI version. Did you encounter this error on the Gateway or Workstation, and did it happen the first time you booted the Hyper-V Guest or was it a subsequent reboot? Searching Google for problem you mentioned yields a large number of how-tos and fixes for it. This one looked promising: https://medium.com/@froositadwi/how-i-fixed-error-file-grub-i386-pc-normal-mod-not-found-b44c5ac7ff31. Please let me know if it works or if you encountered any troubles or errors during the conversion steps above. Also, are you running Hyper-V on Windows 10 or another operating system?

2 Likes

I did notice that step 14 does require the whonixcheck set to “1” as well. I’ve got it setup but I have issues with the default switch not getting an ip for the outside of the gateway so it’s not talking to the outside world at the moment. Desktop and Gateway don’t have an issue with each other so that works. I’ll get it working yet and I’ll let you know when I do.

Phoenyx33 I believe the problem with your default switch not getting an IP address is resolved in step 12 by directing the interface eth0 to user dhcp and receive it’s address. You may need to restart the VM after saving that change. Also you’ll need to be sure that in step 10 you added legacy network adapters instead of just network adapters. I have been using Whonix 14 in Hyper-V and everything is working correctly.

There is a slightly easier way to do this, especially since I couldn’t find dsfok anywhere anymore.

Install Whonix using the default installer. When you start it, click advanced (don’t click start, because if you have hyper-v running virtual box will not function).

Advanced will open the virtualbox interface, where you can click file > virtual media manager from the manager. Select each whonix drive in turn and click ‘copy’, then save somewhere in VHD format.

After that, uninstall whonix (also go to your users/username directory and nuke the virtualbox folders to free up the drive space).

At this point, you can resume these instructions from step 10) onwards. The VHD images you saved work fine. I’ve tested this with Whonix 15 on Windows 10 1903.

I am unable to make the DHCP work on the whonix gateway. Both methods (dsfok OR copying the image as VHD) work for me, but for some reason I can’t make the gateway connect to the internet. I have uncommented
auto eth0
iface eth0 inet dhcp
but I never get an IP from my host machine network.The hyper-v virtual switch is set to ‘External’, even though I also tried ‘Internal’ but it did not help.

Did someone had a similar issue? Or maybe you can share the virtual switch settings that must be used with this method?

Any help will be appreciated, thanks!

@moreevilthanyou

i had the same issue, it was because dhclient was not found, can just install by copying the .deb installer (and dependencies) over

here is how i did:
shut down vm, right click on whonix .vhd file, and click mount
it will show some error on mount, just press ok
windows can not browse ext partition natively, many tools available for this, i used paragon linuxfs
after install paragon linuxfs, you will see new disk partition with size 99 gb in windows explorer
download these (sorry it didn’t allow links, i rot13 ciphered them, these are links to debian official site)
uggcf://cnpxntrf.qrovna.bet/ohfgre/nzq64/vfp-qupc-pbzzba/qbjaybnq
uggcf://cnpxntrf.qrovna.bet/ohfgre/nzq64/yvovfp-rkcbeg1100/qbjaybnq
uggcf://cnpxntrf.qrovna.bet/ohfgre/nzq64/yvoqaf-rkcbeg1104/qbjaybnq
uggcf://cnpxntrf.qrovna.bet/ohfgre/nzq64/vfp-qupc-pyvrag/qbjaybnq
and put .deb files in somewhere in the linux partition
if used paragon linuxfs like me, open paragon linuxfs, choose unmount (otherwise changes do not get saved i think)
open diskmgmt.msc, find 100 gb linux vdisk, and unmount
(need to right click on the disk in the lower pane of diskmgmt.msc, on the left side, where “disk x, basic, 100.00 GB, Online” is written)
it will ask you to specify path on unmount, leave it as is and press ok
boot up vm
login and then run:
sudo apt-get install /path/to/file.deb
for each .deb file
install in the same order as i posted the download links
after each install, it will show something which goes “N: Download is performed unsandboxed as root as file…”,
just ignore that message, it installs just fine
now finally run:
sudo whonixsetup
and it should be working now

hope it was helpful

What alternative is available for microsoft virtual machine converter? it is not available anymore.

Hello, I am trying to run Whonix in Hyper-V I am following duck’s guide found on github.
After getting to grub I get:
_

on a black screen. I tried switching ttys but its very slow.

Non-freedom software.

Therefore:

Updated the download page accordingly just now:

I would like to use Hyper-V since its integrated into Windows and has better performance.

1 Like

You know, even if you’re a developer – people here are asking for a solution. The somewhat savvy user would already know these things that you are posting here in the chat. I know, this is again the politics of free Software… but you are decreasing their security, if you say to them they have to deactivate core isolation and other Hyper-V things on their windows machine, just to be able to run Virtualbox. Because this is basically what you are actually doing here.

See it as a propose for harm reaction.

Best regards

What does that imply?

And since I don’t plan on working on it, the right thing is to communicate that clearly, which was done. Very likely follow-up question “why not” is also answered.

Answers are written with general readers in mind, not for technical users only.

No, wiki page on Microsoft Windows Hosts clearly discourages any use of Windows. Related: Arguments for keeping VirtualBox Support

From that position, any huge investment (porting to an additional non-freedom virtualizer running on top of a non-freedom, privacy intrusive operating system) is out of scope.

As from a time management perspective, existing Qubes-Whonix for Qubes R4.0 users are also asking for Qubes-Whonix support for Qubes R4.1. Doing that all at once is just impossible. Therefore project directions are defined, limited and out of scope feature request are declined so users know they don’t need to wait and should consider finding a different solution.

Hi @ryanrambharose, with a bit of effort I got it running based on the bare-metal approach… There are a few gotchas. If you are still interested let me know and I’ll send some details along.

Hi everyone, looking for Whonix 16.0.9.0 running on Hyper-V, @akcryptoguy made good job but dsfok tools is not available anymore…about Microsoft Virtual Machine Converter 3.0, just let you know Starwind V2V Converter make the job; hope @Aquinas can explain us better than this small how to steps he wrote about it, and informer maybe can help us too !!

… I am talking about something like @akcryptoguy did in these forum (maybe a youtube video)

Happy Fixing !!! :+1: