For Linux users, making a clean break from the Microsoft ecosystem is often a rather challenging task. Even now, the possibility of needing Windows to perform some task still exists—perhaps as part of an employer requirement, a dependency on legacy technology, or to interact with legacy or specialty hardware which has no Linux driver.
The long arm of Microsoft’s embrace is similarly difficult to escape. While it is simple to build your own PC (or simply use an Intel NUC), laptops and all-in-one systems are typically impossible to build in the same way. As such, unless you are buying a System76 computer, or a Dell developer laptop, you are already paying the «Windows Tax» for your device.
SEE: Linux distribution comparison chart (Tech Pro Research)
Considering that the license has already been paid for with most pre-built, retail computers, it is likely a worthwhile endeavor to install Windows 10 in a virtual machine rather than dual booting. After all, this is Windows—using a fresh ISO direct from Microsoft eliminates OEM-bundled bloatware which typically accompanies a new computer. It is also important to note that using a VM for Windows also prevents any future Windows update from interfering with your computer’s boot partition, which could render both your Linux and Windows installations unbootable.
Because of Microsoft’s licensing terms, it is not permissible to transfer the Windows 10 license from one computer to another. Attempting to do so is likely to trigger an alert from Windows Genuine Advantage, as the hardware information about the computer attached to an OEM license is likely transmitted to Microsoft from the factory. Therefore, this guide is specifically for an in-place switch for people who install Linux on a computer which has an OEM license for Windows 10 from the manufacturer.
Getting the installation ISO from Microsoft
Thankfully, Microsoft directly provides ISO downloads of Windows 10. Because the installation ISO will be mounted from the local disk for installation on a virtual machine, there is no need to burn the ISO to a disc for installation. Aside from the time spent burning to disc, the read speeds from using a locally mounted ISO are substantially higher than using optical media.
The link provided above only offers downloads of the latest version of Windows 10 Home or Windows 10 Pro. For people using Education editions of Windows 10, you can download the latest version here, though a product key is required. Likewise, users of Windows 10 Enterprise will need to download from the Volume Licensing Service Center.
Installing a Linux distribution
Naturally, in order to install Windows 10 inside a VM on a Linux computer, installing Linux is necessary. For this guide, Fedora Workstation was used for all of the subsequent steps, though practically any modern distribution will work with these instructions. For newcomers to Linux, TechRepublic’s Jack Wallen offers great advice on how to find the right Linux distribution for your needs.
Extracting your Windows license key
Prior to Windows 8, the Windows license key could be found on a sticker on the back or bottom of a computer. Now, the license key is rather unhelpfully embedded inside the computer. Perhaps more unhelpfully, there is no option to view the key in the BIOS on most computers, including the Lenovo ThinkPad W550s used for this article. As such, the key must be manually extracted from the ACPI table in which it is stored. Fortunately, there is an open source tool to do so.
In order to do this, the acpica-tools package must be installed via the command line. On Fedora, Red Hat Enterprise Linux, CentOS, and SUSE, this is:
sudo dnf install acpica-tools
Alternatively, for Debian and Ubuntu users:
sudo apt-get install acpica-tools
With this installed, the acpidump command can be used to view the entire table. Dumping the contents of all ACPI tables would produce a lot of extraneous data, so to select only the license key, use the following command:
sudo acpidump -n MSDM
This will return data that looks like this:
MSDM @ 0x0000000000000000 0000: 4D 53 44 4D 55 00 00 00 03 B1 4C 45 4E 4F 56 4F MSDMU.....LENOVO 0010: 54 50 2D 4E 31 31 20 20 40 11 00 00 50 54 45 43 TP-N11 @...PTEC 0020: 02 00 00 00 01 00 00 00 00 00 00 00 01 00 00 00 ................ 0030: 00 00 00 00 1D 00 00 00 46 43 4B 47 57 2D 52 48 ........FCKGW-RH 0040: 51 51 32 2D 59 58 52 4B 54 2D 38 54 47 36 57 2D QQ2-YXRKT-8TG6W- 0050: 32 42 37 51 38 2B7Q8
The five sets of five characters separated by dashes at the end is the license key. In this example, this is FCKGW-RHQQ2-YXRKT-8TG6W-2B7Q8.
Selecting a virtual machine and installing Windows
In Linux, using KVM/QEMU is the most pain-free virtualization option, as it is built into the kernel and there are no kernel extensions to configure. The Boxes app provides a very easy to use GUI for this (and is installed by default on Fedora), though if you need extensive configuration options, virt-manager is intended for power users. For cases like this, where Windows 10 is a guest on a Linux machine, the VirtIO package is needed for networking and disk device drivers. They can be downloaded from here. Likewise, SPICE is used for 3D acceleration, clipboard sharing, USB device sharing, and other functions. The SPICE guest tools package can be downloaded here.
SEE: Windows 10: The smart person’s guide
For comparison, support for 3D-accelerated graphics is comparatively poor in VirtualBox. An experimental driver for that exists, though it is somewhat inconsistent in certain situations, particularly involving HiDPI displays. VMWare Player has a better 3D acceleration driver than VirtualBox and is free for noncommercial use. It is not recommended for this purpose unless you already happen to have it installed, as kernel updates for your Linux installation will require modules to be rebuilt each time. (This may not be automated depending on your Linux distribution.)
For 64-bit installations of Windows 10, the minimum system requirements include 20 GB of disk space and 2 GB RAM. Windows is more pleasant with more RAM. The laptop used in this example includes 16 GB RAM, so I can easily spare 4 GB for Windows. Under KVM/QEMU, it is possible to increase the disk space later, but not decrease it. As such, it might be best to start with 20 GB as default—the space available to the VM is only allocated on the host disk as it is used.
Compressing the Windows 10 OS image
This next step is entirely optional, and perhaps of questionable real benefit, as consumer grade SSDs are often quite large and fast. Thanks to some clever engineering by Microsoft, the base install size of Windows 10 is the smallest since Windows XP. (Despite this, it is still about four times the size of a fresh Fedora installation.)
You can compress the installation size of Windows 10 by entering the following command in a command prompt (as an administrator):
This was principally intended for use with netbooks, which often have a relatively paltry amount of flash storage. In a fresh installation of 64-bit Windows 10 (build 1511), this reduced the installation size by 1.06 GB, to 9.14 GB. However, because of the file operations involved to compress Windows files, this actually resulted in an increase of the virtual disk file in Fedora by several gigabytes. This is a temporary issue—as more programs are installed and used on the Windows system, the space freed by this operation will be used before more space is allocated on the host file system.
What’s your view?
Do you prefer your Windows confined to containers? Is there a particular program or task which you still rely on Windows for, despite preferring Linux? Share your thoughts in the comments.