I face occasional disk / file reading error on my VirtualBox (frequent
npm disk error) after I installed WSL2 on Windows 10. I didn't know the cause of the problem until I try to install a new OS on VirtualBox, then I bump into the following issues
The installer encountered an error copying files to the hard disk:
Errno 5 Input/output error
This is often due to a faulty CD/DVD disk or drive, or a faulty hard disk. It may help to clean the CD/DVD, to burn the CD/DVD at a lower speed, to clean the CD/DVD drive lens ...
Initally I thought I have a disk problem, but a full disk scan didn't show any anomalies.
Then I bump into this article, which indicate the problem is caused by Hyper-V (a.k.a Virtual Machine), which is enabled when WSL2 is installed.
Multiple articles indicate that Hyper-V is not compatible with VirtualBox and VMWare, that there is also indicatation that VirtualBox is supporting Hyper-V on version 6 onwards. My guess is that VirtualBox still works with Hyper-V enabled, but maybe the disk reading error is an unexpected bug at the moment.
How to disable WSL2
NOTE: By disabling Hyper-V / Virtual Machine, I can no longer use WSL2.
systeminfo.exe to check if
Hyper-V is enabled. The text below indicate Hyper-V is enabled.
Hyper-V Requirements: A hypervisor has been detected. Features required for Hyper-V will not be displayed.
Turn Windows features on or off in the search bar (or find in
On Windows 10 (version 2004), it doesn't have an option named
Hyper-V. On my machine,
Virtual Machine Platform is ticked but
Windows Hypervisor Platform is not ticked. To disable
Virtual Machine Platform and
Windows Hypervisor Platform should be unchecked.
OK and reboot the machine.
NOTE: Some indicate the need to run
bcdedit /set hypervisorlaunchtype off, but it is not necessary for my case.
systeminfo.exe and you shall see the following.
Hyper-V Requirements: VM Monitor Mode Extensions: Yes Virtualization Enabled In Firmware: Yes Second Level Address Translation: Yes Data Execution Prevention Available: Yes
My VirtualBox Ubuntu disk problem is solved after I disable Hyper-V.