I face occasional disk / file reading error on my VirtualBox (frequent apt-get
and 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.
- https://support.microsoft.com/en-my/help/3204980/virtualization-applications-do-not-work-together-with-hyper-v-device-g
- https://docs.microsoft.com/en-us/windows/wsl/wsl2-faq
- https://www.reddit.com/r/virtualbox/comments/g71tb0/how_do_i_fix_error_when_installing_ubuntu_on/
- https://askubuntu.com/questions/1239382/error-when-installing-ubuntu-20-04-in-virtualbox
How to disable WSL2
NOTE: By disabling Hyper-V / Virtual Machine, I can no longer use WSL2.
Run 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.
Type Turn Windows features on or off
in the search bar (or find in Control Panel
)
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 Hyper-V
, both Virtual Machine Platform
and Windows Hypervisor Platform
should be unchecked.
Click OK
and reboot the machine.
NOTE: Some indicate the need to run bcdedit /set hypervisorlaunchtype off
, but it is not necessary for my case.
Run 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.