Migrating VMs from VirtualBox to KVM: Networking Bungle

Executive Summary

I’m currently working on switching over from VirtualBox to KVM. I’ve been able to successfully follow the guides available online to convert VDI disk images to QCOW2. I’ve also followed steps to create virtual machines within the Virtual Machine Manager (GUI). I can also successfully start said machines, but they don’t have any networking available. I can also successfully create virtual machines in KVM that network just fine (bridged despite VMM’s warning).

The big question: Where did I go wrong?*

  • Besides not falling into the hole in the first place :wink:

Details

Host Machines

  • Host A: Windows 10 (fully updated) running Oracle’s VirtualBox 6.1 (latest).
  • Host B: Linux Ubuntu Server 20.04 LTS running KVM.
  • Edit: I also have VirtualBox running on Host B as part of experimenting. Not sure if that’s interfering with anything, but will experiment by removing it. Update: no difference.

Steps to Take to Attempt to Recreate the Problem

  • On Host A: Create a virtual machine on VirtualBox: Linux Ubuntu Server 20.04. Create VDI dynamic image (500 GB; I also experimented with VMDK). 4096 MB RAM. 2 CPUs. Bridged network adapter. Install system using defaults for everything (I experimented between Static IP and DHCP).
  • Copy VDI disk image from Host A to Host B.
  • On Host B: Convert VDI file to QCOW2 (I experimented with root or [user]). Two methods here: 1) convert straight over or 2) create a RAW image first. I was unable to create a RAW image on Host B because of space limitations ¯_(ツ)_/¯. The command to execute the first option is: qemu-img convert -f vdi -O qcow2 [image.vdi] [image.qcow2]
  • Create a virtual machine on Virtual Machine Manager. Change “Network selection” to “Host device…” (I experimented with this on a guest machine I created on Host B. This will normally work). I experimented with either SATA or VirtIO.
  • Log into guest machine and execute command: ip a. For me, the network adapter settings come up as: 1: lo: (blah blah blah the loopback is normal) and 2: enp1s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000 link/ether 52:54:00:00:fa:ca brd ff:ff:ff:ff:ff:ff

You need to update the system with the new interface names. Also make sure you have removed any Virtualbox tools that were previously installed.

1 Like

Bingo! That did it. Thanks for your help!

(For those who might need specifics: In Ubuntu Server 20.04 (and in other systemd versions?) the network configuration file is stored in /etc/netplan as a yaml file. This needs to be CAREFULLY edited because yaml is picky about formatting. That said, simply identify the host’s bridge adapter name and put that in as the new network adapter name. This needs to be done in the configuration file because when you issue the ‘ip a’ command “out of the box,” it will return the bridge adapter’s name as your network interface, but it won’t have an ip address). ← Hope that makes sense to anyone in the future who has this issue.

1 Like

Is there a way to mark this as “solved?” Also–even though yours is the only resolution posted–is there a way to mark it as, “correct answer?”