Setting Up Virtual Machines in DaDesktop with Virt Manager

Introduction

When preparing educational content, it is often beneficial to virtualize a server within DaDesktop. You may also want to virtualize one or two client machines simultaneously, whether they run the same operating system or a mix of Windows and Linux.

Creating 'Nested VMs' can be achieved using Virt Manager or VirtualBox. On Linux systems, you can optionally use Vagrant, while on Windows 10 DaDesktop machines, VirtualBox is the standard approach.

DD Machines Nested Virt

Based on extensive testing, our recommended approach is to use Virt Manager. This is due to several bugs associated with VirtualBox; consequently, we do not currently recommend using VirtualBox in this specific manner.

The VirtManager application leverages the libvirt library to deliver virtual machine management services. It features a desktop interface that simplifies the creation, deletion, and management of multiple virtual machines. While primarily designed for KVM VMs, it also supports other hypervisors such as Xen and LXC.

Virt Manager integrates seamlessly with Vagrant, simply by installing the following package:

apt install vagrant-libvirt

Note that fewer Vagrant boxes are natively available for libvirt/kvm compared to VirtualBox. However, these can be easily converted to work with libvirt, as demonstrated in the resource below:

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

The user interface offers a comprehensive overview of all VMs, including their status, CPU usage, live performance graphs for active VMs, and resource utilization statistics.

If you are new to Virt Manager, you will find it similar to VirtualBox, though with a few key differences outlined below.

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

Why should I choose Virt Manager over VirtualBox?

Benefits

  1. Performance is significantly improved. Virt Manager utilizes VirtIO drivers for storage, networking, and graphics, which yields superior performance. Virtio drivers are KVM's paravirtualized device drivers, available for Linux and Windows guest VMs running on KVM hosts. The virtio package supports block (storage) devices, network interface controllers, and graphics. Since VirtIO drivers are open source, they can be easily installed if not already pre-installed on your Linux distribution.
  2. Offers a broader range of configuration options
  3. Integrates well with Vagrant
  4. Parts of VirtualBox are not fully open source
  5. Virt Manager does not require module recompilation after kernel upgrades, a step necessary with VirtualBox.
  6. VirtualBox is prone to breaking during kernel upgrades.

Drawbacks

  1. VirtualBox may have a slightly gentler learning curve
  2. Setting up 'Host networking' instead of NAT is slightly more straightforward in VirtualBox, although NAT works effectively for most networking use cases in both systems.
  3. VirtualBox is available on many platforms, whereas Virt Manager is exclusively available on Linux


Overall, we find that Virt Manager is the preferred tool for running servers within a DaDesktop machine.

Installation

Since libvirt is continuously improving, it is advisable to always use the latest non-LTS Ubuntu or Debian version.

To install kvm and virt-manager, these are brief installation notes. However, please consult an up-to-date guide specific to your preferred DaDesktop OS. Here is one such guide: https://www.debugpoint.com/virt-manager/

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

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

Configuration

  1. How do I import or convert virtual machines? While creating new VMs tailored to your OS and specification requirements is straightforward, complex setups often benefit from importing an existing VM configuration for a specific server or appliance. These are frequently supplied as VMDK images, which can be added directly to Virt Manager, though clarity on this capability with the current version is limited. Virtual Box server images cannot be imported directly into Virt Manager but can be easily exported to other virtualization formats, such as Open Virtualisation Format (.OVF), which Virt Manager can import without issue. Alternatively, you can use VMWare Converter if available, or Virt-V2V instead: https://www.redhat.com/en/blog/importing-vms-kvm-virt-v2v. Qemu-convert is also an excellent open-source tool that facilitates easy conversion between different virtual machine formats.
    To Convert from VirtualBox to Virt Manager KVM format, please follow these instructions: https://ostechnix.com/how-to-migrate-virtualbox-vms-into-kvm-vms-in-linux/
  2. The best way to import large files into standalone environments. Recently, a feature was added to easily upload files from your host machine to your DaDesktop machine.

    Otherwise, consider using cloud file tools such as Google Drive or Microsoft 365. You can access these by logging into the service within the DaDesktop machine.

  3. When importing virtual machines, especially from other formats, you often need to adjust graphics and/or disk types. One of Virt Manager's strongest features is its excellent support for VirtIO drivers. These are fully virtualized, open-source drivers that offer significantly better performance compared to traditional disk, network, or graphic drivers. They are available for nearly all operating systems, including robust support for Windows 10 guest machines. If your Guest OS supports them, VirtIO drivers are generally the preferred choice for compatibility and performance when using Virt Manager (KVM). See: https://wiki.archlinux.org/title/Libvirt
  4. Optimal settings for virtual machines using Virt Manager VirtIO drivers are included in almost all modern open-source server operating systems and can be easily installed on Windows. Generally, virtio is the best driver choice, though you may use other types in specific cases. NAT is usually sufficient for most networking needs unless you require a more complex setup involving Bridged Host networking, which can be trickier to configure.
    https://wiki.archlinux.org/title/Virt-manager is an excellent starting guide.
    Running Windows requires additional steps, including slipstreaming VirtIO drivers to ensure the Windows 10 ISO can boot.
    When selecting a hard disk format, .raw files are best for speed unless snapshots are required; in that case, use qcow2 format, though it is slightly slower.
  5. Although Wayland works well for most scenarios as a display manager, we recommend continuing to use X11 for now. That said, it may be worth testing Wayland in your specific setup, as distributions are continuously improving their Wayland support.
  6. There is no need to use KSM, as although it works in nested environments and Virt Manager, it provides little practical benefit.
  7. Tech Support is available if you need assistance converting disk images to work with Virt Manager, as well as setting up Virt Manager for DaDesktop courses.
  8. Where are disk image files located within the filesystem? Virt Manager uses the following location to store image files by default, though this is configurable and you can use other locations if preferred.

    /var/lib/libvirt/images