Building VMs within DaDesktop via Virt Manager

Getting Started

When setting up a course, it's often handy to run a virtual server inside DaDesktop, and maybe spin up one or two client VMs as well, either with the same OS or a mix of Windows and Linux.

Running 'Nested VMs' can be done either using Virt Manager or VirtualBox (with vagrant optionally on Linux), or VirtualBox if you're using Windows 10 as the DaDesktop machine.

DD Machines Nested Virt

Following thorough testing, we recommend going with Virt Manager, because VirtualBox has a few known glitches. So for now, we advise against using VirtualBox for this purpose.

VirtManager is an app that builds on the libvirt library to handle VM management. Its graphical interface lets you easily create, remove, and manage numerous virtual machines. While it's mainly aimed at KVM, it can also work with other hypervisors like Xen and LXC.

Virt Manager also integrates smoothly with Vagrant, simply run:

apt install vagrant-libvirt

Note that there aren't as many Vagrant boxes for libvirt/kvm as there are for VirtualBox, but converting them for libvirt is straightforward, as demonstrated here:

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

The UI gives you a handy overview showing each VM's status, CPU usage, a live performance chart of active VMs, and resource consumption stats.

If you're new to Virt Manager, it's quite like VirtualBox, though there are some key distinctions we'll cover next.

For a solid guide on using virt-manager with Ubuntu Linux, check out https://www.debugpoint.com/virt-manager/

 

Why go with Virt Manager instead of VirtualBox?

Advantages
  1. Performance is significantly better — Virt Manager taps into VirtIO drivers for storage, networking, and graphics, which deliver a major speed boost. These virtio drivers are KVM's paravirtualized device drivers, compatible with Linux and Windows guests on KVM hosts. They cover block storage, network controllers, and graphics. Being open source, VirtIO drivers are a breeze to install if your Linux distribution doesn't include them already.
  2. A wider range of configuration options.
  3. Integrates nicely with Vagrant.
  4. Portions of VirtualBox aren't completely open source.
  5. Virt Manager doesn't require recompiling modules after every kernel upgrade, unlike VirtualBox.
  6. VirtualBox occasionally breaks when a kernel upgrade rolls out.
Disadvantages
  1. VirtualBox arguably has a slightly gentler learning curve.
  2. Configuring host networking instead of NAT is simpler in VirtualBox, but NAT handles the majority of networking needs just fine on both platforms.
  3. VirtualBox runs on many platforms, whereas Virt Manager is Linux-only.


Overall, for running servers inside a DaDesktop environment, Virt Manager comes out on top.

 

Installing Virt Manager

Since libvirt keeps getting better, always go with the latest non-LTS release of Ubuntu or Debian.

Installing KVM and virt-manager: here are quick installation notes, but for the most accurate steps, follow a current guide tailored to your chosen DaDesktop OS. One helpful resource is https://www.debugpoint.com/virt-manager/

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

Reboot your DaDesktop machine, then launch Virt Manager from the Applications menu.

 

Configuration

  1. How do I import or convert virtual machines ? While you can quickly build VMs to match your desired OS and specs, for more complex configurations, it's often easier to import an existing VM setup, like a specific server or appliance. These often come as VMDK images, which can sometimes be added directly to Virt Manager, though the current version may not make this obvious. VirtualBox server images can't be imported straight into Virt Manager, but they can be exported to other virtualization formats such as the Open Virtualization Format (.OVF), which Virt Manager handles easily. Alternatively, you could use VMware Converter if available, or Virt-V2V (see https://www.redhat.com/en/blog/importing-vms-kvm-virt-v2v). Qemu-convert is another great open source tool that simplifies converting between different VM formats.
    To Convert from VirtualBox to Virt Manager KVM format follow these instructions https://ostechnix.com/how-to-migrate-virtualbox-vms-into-kvm-vms-in-linux/
  2. Best way to import large files inside standalone. There's now a method to seamlessly upload files from your own computer into the DaDesktop environment.

    If that doesn't suit, try a cloud storage service like Google Drive or Microsoft 365, and then log into that service from within the DaDesktop machine.

  3. When importing other virtual machines especially from other formats, often you will need to change graphics and / or disk types. One of Virt Manager's greatest strengths is its top-notch VirtIO driver support. These open source, fully virtualized drivers deliver far superior performance over default disk, network, and graphics drivers, and they're available for nearly all operating systems, with strong support even for Windows 10 guests. Provided your guest OS is compatible, VirtIO drivers are typically the go-to choice for both compatibility and speed when running Virt Manager (KVM). https://wiki.archlinux.org/title/Libvirt
  4. Optimal settings for virtual machines using Virt Manager VirtIO drivers are baked into nearly all modern open source server operating systems, and installing them on Windows is straightforward. In most situations, virtio drivers are your best bet, though other types may suit specific scenarios. NAT networking covers most use cases perfectly well; only if you need a more complex setup would you consider bridged host networking, which can be a bit trickier to configure. 
    https://wiki.manjaro.org/index.php?title=Virt-manager serves as a great beginner's guide.
    Running Windows requires a few extra steps, including slipstreaming the VirtIO drivers so the Windows 10 ISO can boot.
    For disk format, raw (.raw) files offer the best speed, unless you need snapshot support, in which case qcow2 is the way to go, albeit slightly slower.
  5. While Wayland generally performs well as a display manager, we still recommend sticking with X11 for the time being. That said, feel free to experiment with Wayland in your own setup, as distro support for it keeps improving.
  6. You can skip KSM; while it does work in nested environments and with Virt Manager, it rarely brings noticeable real-world gains.
  7. Tech Support is on hand if you need help converting disk images for Virt Manager or setting up Virt Manager for DaDesktop courses.
  8. Where do disk image files reside? Virt Manager defaults to storing them in this directory, though you can easily point it elsewhere:

    /var/lib/libvirt/images