I am have been running VirtualBox for my VMs on a Linux host for some time now. But when kernel 5.10 was installed there was some issue with compiling the drivers for VirtualBox. I think there is a workaround out there, but I needed to fix this asap. So I decided to migrate to kvm. And this is how I did that. I have for now Ubuntu 20.20 on my laptop also get the VMs up and running.
Goal for this
Get VirtualBox out of the box
Migrate my vms to qemu/kvm
Use my vms has before
We start with the short description of below events.
- Install KVM
- Convert your disk to kvm
- Create a new machine
- Start the VM
- Install stuff
Install KVM and other nice stuff
sudo apt install -y qemu qemu-kvm libvirt-daemon libvirt-clients bridge-utils virt-manager
Backup VM first
this step is not necessary, who remembers a coward?
VirtualBox needs to be installed for the conversion of disk files.
Here is a directory where a virtual machine is created with VirtualBox.
I was not able to convert directly to qcow2 format because I had multiple disk files so I needed to convert to raw format first. I did not investigate how this is possible to do, but I had enough disk space to do this i two steps.
vboxmanage clonemedium --format RAW ./Disk.vdi ./Disk.img
Delete everything, save only the img file that we converted
Change owner for the file to you user in my case roger
chown roger:roger Disk.img
Then we want to convert it to a format that KVM will understand. This can take a while but just wait. After the clone is done delete the img file.
qemu-img convert -f raw Disk.img -O qcow2 Disk.qcow2
Then we can start virt-manager to create our machine but we point out the disk that we converted above.
Assign memory as you please
Then after some reboots the VM is up and running
Uninstall any guest tools
Install new guest tools from
Install spice client to get copy / paste work between host and guest
Thanx for reading this far, you are a nerd!
That was all for today! Keep hacking!