I will write what I did to solve some problems for VM creation. In a new project where I work, it’s complex infrastructure.
I need to use both Docker and VirtualBox VM on my machine.
Docker installation
Hardware assisted virtualization and data execution protection must be enabled in the BIOS
When I added Remote – Container extension to my VSCode, Docker was also installed. However, the following error occurred when Docker started up.
I could not open BIOS because it is company’s pc and it’s rocked by the IT. I’ve read Docker Desktop WSL2 backend and I recalled that I’ve uninstalled Ubuntu system.
So, I firstly uninstalled Docker, and then, I installed Ubuntu system but the used version was WSL1.
> wsl -l -v
NAME STATE VERSION
* Ubuntu-20.04 Stopped 1
I struggled with the update. I followed Manual installation steps for older versions of WSL. I didn’t read it well. It requires reboot to apply the change correctly.
However, the Ubuntu system didn’t start up due to virtualization related error. I repeated to uninstall the version and try another version.
Execute the following command, and then, reboot.
bcdedit /set hypervisorlaunchtype off
Try to install Ubuntu system again. If it doesn’t work, execute the following command, and then, reboot again.
bcdedit /set hypervisorlaunchtype auto
Then, install the Ubuntu system again.
I repeated this process, and the installation was finally successful. After the installtion, WSL2 was used correctly.
> wsl -l -v
NAME STATE VERSION
* Ubuntu-20.04 Stopped 2
Then, install Docker again and it works as expected.
Creating a VM in VirtualBox
I used VirtualBox version 6.0.x but it was not possible to use both Docker and VirtualBox at the same time on the same machine. So I updated VirtualBox to 6.1.x.
It seems that it doesn’t depend on whether or not Hyper-V is enabled but I disabled Hyper-V on Turn Windows Feature on or off
and enabled Virtual Machine platform
.
I executed Vagrant up --provision
for creating a VM but the process failed due to Virtulization issue again. I executed the following commands again.
Off -> reboot -> on -> reboot…
bcdedit /set hypervisorlaunchtype off
bcdedit /set hypervisorlaunchtype auto
I don’t remember on which setting the process succeeded. After the creation, the following error occurred in the VM.
I changed the VM settings.
But it didn’t work.
So, I removed the VM and created it again. Then, it worked as expected…
I’m not sure what was wrong.
Overview
The environment might be corrupted for some reason. In this case, uninstall Docker, VM or Ubuntu, or something else and then try to install them again.
If you run into virtulization related problem, try the following.
- Execute
bcdedit /set hypervisorlaunchtype off
- Reboot the machine and try to set up VM
- If it fails, execute
bcdedit /set hypervisorlaunchtype auto
- Reboot the machine and try to set up VM
- If it fails, execute
bcdedit /set hypervisorlaunchtype off
- Reboot the machine and try to set up VM
If it still doesn’t work,
- check/uncheck Hyper-V on
Turn Windows Feature on or off
screen - Reboot and try to install it again
- check/uncheck Hyper-V on
Turn Windows Feature on or off
screen - Reboot and try to install it again
Comments