Generating Virtual Machines in DaDesktop via Virt Manager

Introduction

When designing a course, virtualizing a server environment within DaDesktop is often highly beneficial. Additionally, provisioning one or two client machines in the same manner—whether using a homogeneous OS setup or a mix of Windows and Linux—can streamline the process.

Deploying 'Nested VMs' can be achieved through Virt Manager or VirtualBox. When using Linux, Vagrant can optionally be integrated with either, while Windows 10 DaDesktop instances rely on VirtualBox.

DD Machines Nested Virt

Based on extensive testing, Virt Manager is the recommended tool, as VirtualBox exhibits certain bugs in this context. Consequently, we currently advise against using VirtualBox for this specific purpose.

The VirtManager application leverages the libvirt library to deliver robust virtual machine management services. It offers a desktop interface for creating, deleting, and managing multiple virtual machines. While primarily optimized for KVM VMs, it also supports other hypervisors, including Xen and LXC.

Virt Manager integrates seamlessly with Vagrant, simply via the command:

apt install vagrant-libvirt

It is important to note that while the selection of Vagrant boxes for libvirt/kvm is smaller than for VirtualBox, they can be easily converted for libvirt compatibility as demonstrated here:

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

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

For those new to Virt Manager, it functions similarly to VirtualBox but includes several key differences detailed below.

A useful guide on utilizing virt-manager on Ubuntu Linux is available here: https://www.debugpoint.com/virt-manager/

Why should I use Virt Manager instead of Virtualbox?

Advantages
  1. Superior performance - Virt Manager utilizes VirtIO drivers for storage, networking, and graphics, yielding significantly better results. Virtio drivers are paravirtualized device drivers for KVM, available for Linux and Windows guest VMs on KVM hosts. The virtio package supports block devices, network interface controllers, and graphics. As these drivers are open source, they are easily installed if not pre-installed on your Linux distribution.
  2. Greater configuration flexibility
  3. Strong compatibility with Vagrant
  4. VirtualBox components are not entirely open source
  5. Virt Manager avoids the need for module recompilation after kernel upgrades, a common requirement for VirtualBox.
  6. VirtualBox may experience instability following kernel upgrades.
Disadvantages
  1. VirtualBox may offer a slightly gentler learning curve
  2. Configuring 'Host networking' is more straightforward in VirtualBox than with NAT, although NAT functions adequately for most networking scenarios on both systems.
  3. VirtualBox supports multiple platforms, whereas Virt Manager is exclusively available on Linux


Overall, for running servers within a DaDesktop machine, Virt Manager is the preferred solution.

Installation

Given the continuous improvements in libvirt, it is best to use the latest non-LTS Ubuntu or Debian version.

Installation of kvm and virt-manager follows a simple process. These are brief notes, but please consult an up-to-date guide for your specific DaDesktop OS. A suitable guide can be found at: https://www.debugpoint.com/virt-manager/

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

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

Configuration

  1. Importing or converting virtual machines While creating VMs tailored to your OS and specification requirements is straightforward, importing existing VM setups for complex servers or appliances is often preferred. These are frequently provided as VMDK images, which can be added to Virt Manager, although direct compatibility with the current version may vary. Virtual Box server images cannot be imported directly but can be exported to other formats like the Open Virtualisation Format (.OVF), which Virt Manager supports. Alternatively, you may use VmWare Converter or Virt-V2V (https://www.redhat.com/en/blog/importing-vms-kvm-virt-v2v). Qemu-convert is also an excellent open-source tool for converting 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. Optimal method for importing large files into standalone environments. A feature has been added to easily upload files from your host machine to your DaDesktop machine.

    Alternatively, consider using cloud storage tools like Google Drive or Microsoft 365. You can access these services by logging in within the DaDesktop environment.

  3. Adjusting graphics and/or disk types when importing VMs When bringing in VMs from other formats, you will often need to modify graphics and/or disk types. A major benefit of Virt Manager is its excellent support for VirtIO drivers. These open-source, fully virtualized drivers offer superior performance compared to standard disk, network, or graphics drivers and are compatible with nearly all operating systems, including robust support for guest Windows 10 machines. If your Guest OS supports them, VirtIO drivers are the recommended choice for compatibility and performance when using Virt Manager (KVM). https://wiki.archlinux.org/title/Libvirt
  4. Optimal settings for virtual machines in Virt Manager VirtIO drivers are included in most open-source server operating systems and can be easily installed on Windows. While virtio is generally the best driver choice, other types may be necessary in specific cases. NAT networking is usually sufficient, unless a more complex setup requires Bridged Host networking, which can be more challenging to configure.
    https://wiki.archlinux.org/title/Virt-manager serves as a helpful starting guide.
    Running Windows requires additional steps, including slipstreaming VirtIO drivers to ensure the Windows 10 ISO boots correctly.
    For hard disk formats, .raw files offer the best speed, unless snapshots are required, in which case qcow2 format should be used, albeit with slightly reduced performance.
  5. Although Wayland functions well in most scenarios as a display manager, we recommend continuing to use X11 for the time being. However, it may be worth testing Wayland in your specific setup, as distribution support for Wayland is improving continuously.
  6. Avoid using KSM, as while it works in nested environments and Virt Manager, it offers little practical benefit.
  7. Tech Support is available if assistance is needed when converting disk images for Virt Manager compatibility, or for setting up Virt Manager for DaDesktop courses.
  8. Where are disk image files stored within the filesystem? Virt Manager uses the following location by default to store image files, though this is configurable and other locations can be used if preferred.

    /var/lib/libvirt/images