unrelenting.technology

Download original

Current Windows 10 has a feature called “Windows Sandbox” which spawns a tiny Hyper-V VM with allegedly a very smart slim disk image thing that shares the OS files with the host, and smart memory management, and so on.. and virtualized GPU support, like virgl in the free world.

So can it run Crysis, or at least Quake? Is it what we need for isolating old games? Well.. it has the ability to load up the host GPU with work and to show the results, but it’s absolutely unsuitable for gaming in its current state. Seems like it uses regular RDP for the window, and there aren’t any special optimizations that make 3D fast. The frame pacing is awful, framerate is weirdly limited, etc.

Also, this is not obviously found on google right now: if you have a compressed disk, you need to decompress C:\ProgramData\Microsoft\Windows\Containers for it to work.

Moving VMs from VirtualBox to Client Hyper-V

I’ve decided to move the VMs on my desktop from VirtualBox to Microsoft Hyper-V. Because reasons.

Actually because I’ve upgraded my desktop to an AMD Ryzen CPU: first, AMD-V/SVM is not supported by the Intel HAXM thing from the Android SDK, so I wanted to try out Microsoft’s Hyper-V based Android “emulator” (VM configurator/runner thingy) instead. Second, giving 16 virtual CPUs on an SMT 8-core to a FreeBSD guest in VirtualBox results in a weird performance issue. (Though giving 4 vCPUs to multiple VMs on a 4-core CPU worked fine.) Third, it’s Oracle VM VirtualBox and no one likes Oracle.

So, here’s how you can do it as well.

How to get Hyper-V

You need Windows 10 Pro, Enterprise or Education. (Or Windows Server, obviously.) Just enable it as a feature and restart.

Alternatively, installing the MS Android “emulator” automatically enables it.

How to migrate a VM (FreeBSD, Linux or Windows with EFI)

(NOTE: older versions of FreeBSD apparently had some loader issue that prevented EFI boot in Hyper-V. Everything works for me on a recent build of 11-STABLE.)

In VirtualBox, go to the Virtual Media Manager (Ctrl+D) and copy your disk as VHD. In the Hyper-V Manager, use the Edit Disk dialog to convert the VHD to VHDX.

If you haven’t done that yet, go to the Virtual Switch Manager and make a virtual switch (“External” is like bridge mode in VBox).

Now make a virtual machine. Generation 2, no dynamic memory (FreeBSD doesn’t support that), select the virtual switch and the VHDX disk.

Click Connect and it should just work.

By the way, it’s nice that you can always close the console window without powering off the VM, unlike in VirtualBox where you need a special “Detachable start”.

Interestingly, if you create the VM without a disk and attach the disk later, you won’t see “boot from hard drive” in the firmware / boot order settings. And there’s no add button! (WTF?) The fix is to use PowerShell:

$vm = Get-VM "YOUR VM NAME"
Set-VMFirmware $vm -FirstBootDevice (Get-VMHardDiskDrive $vm)

Speaking of which, it’s nice to have a directly integrated PowerShell interface to all the things. My little xvmmgr script was initially written for VirtualBox, and that required COM.

How to migrate a VM (other OS)

Well, a similar process, but use Generation 1.

My experience so far

Client Hyper-V has pleasantly surprised me. It’s a very smooth experience: it looks like a Type 2 hypervisor even though it’s actually Type 1, it runs VMs without any performance issues… what else could you ask for?

Well, the downside is its lack of flexibility in terms of paravirtualized (MS calls them “synthetic” or something) vs emulated devices.

All you get is the choice between two generations. Generation 1 means legacy BIOS boot from an emulated IDE drive with emulated all the things plus optionally some paravirtualized devices like the NIC. Generation 2 means EFI boot from a SCSI drive with paravirtualized everything. Oh and the SCSI controller is also on the vmbus. So there’s no way to use EFI and SCSI with e.g. OpenBSD, you need full Hyper-V support for at least the disk and network to do that. Thankfully Microsoft contributed that support to FreeBSD! :)

Wow. Windows will no longer require admin rights to create a symlink. Amazing.

So it’s possible to control an external monitor’s brightness over DDC/CI. There’s e.g. ClickMonitorDDC for Windows. Why the hell doesn’t Windows support this natively?! It shows the native brightness slider for laptops, but not for desktops!?

PSA: if you’re using VirtualBox on Windows and you need USB passthrough, do not install usbpcap when installing Wireshark.

Installing “Ubuntu on Windows”. While it’s downloading, the ConEmu taskbar icon shows a progress bar. I’m pretty impressed.

The Windows install on my desktop suddenly decided to start resetting some settings every time I log in. The wallpaper, Start and taskbar pinned items, Firefox profile… Thankfully, not the Steam profile :D

Oh, by the way, recently I was reminded of one of the most infuriating Windows things. It’s 2016 and Windows is still not UTF-8 everywhere. The cmd console is whatever (CP1251 for Russian locale), Visual Studio saves by default in whatever (I’ve seen CP1251 and… UTF-8 with BOM). There’s also the \r\n newline stuff. And Windows users are convinced that Windows defaults aren’t the problem, it’s those weird Unix people who cause problems.

You know the operating system chooser light blue screen that pops up when you upgrade to a new build of Windows 10?

I just saw that it can become “not responding” for a moment – complete with a white overlay and spinning circle cursor!

A fresh install of Visual Studio 2015 RC w/o any optional things is 7 GB. Seven. Gigabytes. Why.

(also, “close VS to reduce the probability of required restart” is a lie, it required a restart anyway)