Windows 11 on Chromebook (Linux 'Crostini' container)
Using Windows 11 on Chromebook
My Chromebook, an Asus CX9 with i5-1135G7 CPU and 16GB of memory, is extremely versatile. It can operate Android apps which are not available for Linux e.g. Pleco (a Chinese dictionary) and the YouVersion Bible App, as well as powerful and useful Linux applications such as RStudio, a data analysis environment, and Zotero, an academic citation tool.
Application compatibility layers such as CodeWeavers Crossover allow some Windows programs such as Wenlin (a Chinese dictionary) to work just fine, and Microsoft Office more-or-less works, with encouragement.
However, sometimes it is nice to have a complete Windows virtual machine available.
Unfortunately Virtualbox doesn’t work, because of a current lack of nested KVM support.
There is a paid option to run a Windows virtual machine, Parallels. However, using Parallels currently requires Chromebook to be set up as an Enterprise chromebook. This can be done on a ‘home-user’ Chromebook, but the process is involved, and the annual subscriptions required are a bit expensive!
However, there is also a free virtual machine (qemu) which can be used to install Windows. The process is described on Beebom.
Optimising performance
Running Windows 10 on my Lenovo Flex 5 (i5 tenth generation) was a bit slow, to say the least. I was keen to improve the performance of Windows 11 on my Asus CX9. The guide from farmerbb in ‘QEMU/KVM virt-manager vm very slow’ was particularly helpful. I didn’t actually use Leducc’s article ‘Improving the performance of a Windows Guest on KVM/QEMU’, but it looks pretty informative, too.
Like farmerbb, I applied all possible Hyper-V enlightenments.
<hyperv>
<relaxed state='on'/>
<vapic state='on'/>
<spinlocks state='on' retries='8191'/>
<vpindex state='on'/>
<synic state='on'/>
<stimer state='on'>
<direct state='on'/>
</stimer>
<reset state='on'/>
<frequencies state='on'/>
<reenlightenment state='on'/>
<tlbflush state='on'/>
<ipi state='on'/>
</hyperv>
I disabled all timers except for hypervclock
. Like farmerbb, and unlike some
other guides, I left hpet
disabled.
<clock offset='localtime'>
<timer name='rtc' present='no' tickpolicy='catchup'/>
<timer name='pit' present='no' tickpolicy='delay'/>
<timer name='hpet' present='no'/>
<timer name='kvmclock' present='no'/>
<timer name='hypervclock' present='yes'/>
</clock>
One particular caution I have with farmerbb’s guide is that the CPU pinning settings is specifically for his 6-core CPU, so blind copying of those settings will probably mismatch virtual cores e.g. matching core 1 to core 6. Some other articles mention getting the pinning setting wrong is a likely cause of worse performance. Currently, I have set any cCPU pinning.
I downloaded the Windows virtio drivers
as suggested by farmerbb. I placed both my Windows and virtio driver ISO (currently named ‘virtio-win-0.1.240.iso’) into the Crostini ‘normal’ user’s Download
directory. Trying
to install with those ISOs from a directory outside the Crostini directories did
not work, for some reason QEMU managed to lose contact with the files during the install
process. Unlike the QEMU XML snippet provided by farmerbb, I did not provide the address
,
as this appears to be auto-generated, and did not set cache
. Note that the disk
file is stored in the libvirt
directory.
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' io='threads' discard='unmap' iothread='1' queues='6'/>
<source file='/var/lib/libvirt/images/win11.qcow2'/>
<target dev='vda' bus='virtio'/>
</disk>
Standard users cannot access the libvirt
directory!
I followed Method 1 in the Ostechnix article!).
As sudo, I edited the /etc/libvirt/qemu.conf
file, adding:
user = "myusername"
group = "libvirt"
Then restarting the libvirtd
service, and making sure my regular user is part
of the libvirt
group.
sudo systemctl restart libvirtd
sudo usermod -a -G libvirt $(whoami)
Resizing Windows 11 guest window, Spice guest tools, Secure boot
I installed Spice guest tools, but it didn’t seem to be working, especially window resizing. The eventual solution was provided by ‘Wind Slightly’ in the post ‘virt-manager guest resize not working’.
It appears that the secure boot option in the boot manager/BIOS does not allow the spice guest tools to work. I entered the QEMU Windows 11 machine BIOS (I think by pressing the Escape key during boot) and disabled secure boot. After that, windows resize worked properly.
Inactive network (as seen in virt-manager)
For some reason, the network became disabled, as could be seen in the virt-manager GUI.
I was able to restart the network with the instructions included in a post written by elattlat
sudo virsh net-autostart default
sudo virsh net-start default