Building Virtual Machines in DaDesktop with Virt Manager

Introduction

When putting together a course, it's often handy to virtualize a server right inside DaDesktop, and maybe spin up a couple of client VMs as well—using the same OS or a Windows/Linux combination.

Running 'Nested VMs' is possible via Virt Manager, or VirtualBox with vagrant (optionally on Linux), or straight VirtualBox if your DaDesktop machine runs Windows 10.

DD Machines Nested Virt

After thorough testing, we recommend going with Virt Manager, as VirtualBox introduces a few bugs; at present, we advise against using VirtualBox in this context.

VirtManager leverages the libvirt library to manage virtual machines. Its desktop interface lets you create, delete, and oversee multiple VMs. While it's mainly built for KVM VMs, it also supports other hypervisors like Xen and LXC.

Virt Manager integrates nicely with Vagrant—simply run:

apt install vagrant-libvirt

Keep in mind that the selection of Vagrant boxes for libvirt/kvm is smaller than for VirtualBox, but they can be readily converted as shown here:

https://medium.com/@gamunu/use-vagrant-with-libvirt-unsupported-boxes-12e719d71e8e
 

The UI gives you a snapshot of all VMs—their status, CPU usage, a live performance graph of active VMs, and resource utilization stats.

If you're new to Virt Manager, it feels a lot like VirtualBox, but with a few key differences we'll outline.

This is a solid guide on using virt-manager on Ubuntu Linux: https://www.debugpoint.com/virt-manager/

 

Why choose Virt Manager over VirtualBox?

Advantages
  1. It delivers far superior performance, thanks to VirtIO drivers for storage, networking, and graphics. Virtio drivers are KVM's paravirtualized device drivers, compatible with Linux and Windows guest VMs running on KVM hosts. The virtio package covers block (storage) devices, network interface controllers, and graphics. Being open source, they're easy to install if not already present on your Linux distribution.
  2. A wider range of configuration options
  3. Plays nicely with Vagrant
  4. Parts of VirtualBox aren't fully open source
  5. Virt Manager doesn't require a module recompile on every kernel upgrade, unlike VirtualBox
  6. VirtualBox occasionally breaks when a new kernel update is needed
Disadvantages
  1. VirtualBox might have a slightly gentler learning curve
  2. Setting up host networking (as opposed to NAT) is simpler in VirtualBox, but NAT handles most networking use cases easily on both platforms
  3. VirtualBox runs on many operating systems, while Virt Manager is Linux-only


All in all, for running servers inside a DaDesktop environment in Brazil, Virt Manager is the preferred choice.

 

Installation

Since libvirt evolves rapidly, always stick with the latest non-LTS Ubuntu or Debian version.

Installing kvm and virt-manager: these are brief notes, but you should follow a current guide for your DaDesktop OS. One resource: https://www.debugpoint.com/virt-manager/

sudo apt install virt-manager
sudo adduser student libvirt
sudo systemctl restart libvirtd

Restart the DaDesktop machine, then open Virt Manager from the Applications menu.

 

Configuration

  1. Importing and converting VMs? While building VMs tailored to your OS and specs is straightforward, for complex setups it's often easier to import an existing VM configuration. These often come as VMDK images, which can be added directly to Virt Manager—though the process isn't obvious in the current version. VirtualBox server images can't be imported directly, but they can be exported to the Open Virtualization Format (.OVF), which Virt Manager handles easily. Alternatively, use VMware Converter or virt-v2v (https://www.redhat.com/en/blog/importing-vms-kvm-virt-v2v). Qemu-convert is another excellent open-source tool for converting between VM formats.
    To migrate from VirtualBox to Virt Manager (KVM), follow these steps: https://ostechnix.com/how-to-migrate-virtualbox-vms-into-kvm-vms-in-linux/
  2. Bringing large files into a standalone DaDesktop environment. A new way to upload files directly from your local machine to your DaDesktop instance has recently been introduced.

    Otherwise, you can use cloud storage services like Google Drive or Microsoft 365, then access them by logging in from within the DaDesktop machine.

  3. When importing VMs from other formats, you'll often need to adjust graphics and/or disk types. A standout feature of Virt Manager is its robust support for VirtIO drivers—open-source, fully virtualized drivers that deliver significantly better performance than standard disk, network, or graphics drivers. They're available for almost all operating systems, with excellent support for Windows 10 guests. If your guest OS is compatible, VirtIO drivers are typically the best choice for both performance and compatibility. https://wiki.archlinux.org/title/Libvirt
  4. Ideal Virt Manager VM settings VirtIO drivers are now included in most open-source server OSs and easily installed on Windows. While virtio is usually optimal, other driver types may be necessary in certain scenarios. NAT works for the majority of networking needs; only advanced setups require bridged host networking, which can be trickier to configure. 
    A good starting guide: https://wiki.manjaro.org/index.php?title=Virt-manager
    Running Windows involves extra steps, including slipstreaming VirtIO drivers into the Windows 10 ISO so it can boot.
    For disk format, raw files offer the best speed unless snapshots are needed; then use qcow2, which is slightly slower.
  5. While Wayland generally works fine as a display manager, we suggest sticking with X11 for now. However, feel free to test Wayland in your own setup—distros are improving Wayland support all the time.
  6. Skip KSM; though it works nested and in Virt Manager, it makes little practical difference.
  7. Tech Support is on hand if you need help converting disk images for Virt Manager or configuring it for your DaDesktop courses.
  8. Where are disk image files stored? By default, Virt Manager keeps them in:

    /var/lib/libvirt/images

    You can change this path if desired.