Creating Virtual Machines on DaDesktop with Virt Manager

Introduction

When developing course materials, it is often beneficial to virtualize a server environment on DaDesktop. Additionally, virtualizing one or more client machines using either the same operating system or a mix of Windows and Linux can be highly effective.

Managing Nested VMs can be achieved through Virt Manager or VirtualBox. In a Linux environment, you may optionally utilize Vagrant alongside these tools, while Windows 10 DaDesktop machines typically rely on VirtualBox.

DD Machines Nested Virt

Following rigorous testing, we recommend Virt Manager as the preferred solution. This is due to several bugs associated with VirtualBox, leading us to advise against using VirtualBox in this specific context at this time.

The Virt Manager application leverages the libvirt library to deliver comprehensive virtual machine management services. Its desktop interface simplifies the creation, deletion, and administration of multiple virtual machines. While it is primarily designed for KVM VMs, it also supports other hypervisors such as Xen and LXC.

Virt Manager integrates seamlessly with Vagrant :-

apt install vagrant-libvirt

Please note that the library of Vagrant boxes available for libvirt/kvm is smaller than that for VirtualBox. However, existing boxes can be easily converted for compatibility with libvirt, as demonstrated in this resource :-

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, real-time performance graphs for active instances, and detailed resource utilization metrics.

If you are new to Virt Manager, you will find it resembles VirtualBox, albeit with several key distinctions outlined below.

A helpful guide on using virt-manager with Ubuntu Linux can be found here - https://www.debugpoint.com/virt-manager/

Why choose Virt Manager over VirtualBox?

Advantages
  1. Superior Performance - Virt Manager utilizes VirtIO drivers for storage, networking, and graphics, resulting in significantly enhanced performance. Virtio drivers are KVM’s paravirtualized device drivers, supporting both Linux and Windows guest VMs on KVM hosts. The virtio package supports block (storage) devices, network interface controllers, and graphics. Being open source, these drivers are straightforward to install if not pre-installed on your Linux distribution.
  2. Greater configurability options are available
  3. Strong compatibility with Vagrant
  4. Portions of VirtualBox are not fully open source
  5. Virt Manager avoids the need for module recompilation after kernel upgrades, a requirement for VirtualBox.
  6. VirtualBox has a history of breaking following kernel upgrades.
Disadvantages
  1. VirtualBox generally has a slightly gentler learning curve
  2. Configuring 'Host networking' rather than NAT is more straightforward in VirtualBox, though NAT functions effectively for most networking scenarios on both platforms.
  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 recommended choice.

Installation

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

Installing kvm and virt-manager is straightforward. These are concise installation notes; however, please refer to an up-to-date guide for your specific DaDesktop OS. One such guide is available at https://www.debugpoint.com/virt-manager/

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

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

Configuration

  1. How to import or convert virtual machines? While creating custom VMs tailored to your OS and specifications is simple, complex setups often benefit from importing existing VM configurations for specific servers or appliances. These are frequently provided as VMDK images. Although direct import into Virt Manager is not always clear with current versions, VirtualBox server images can be easily exported to other virtualization formats like Open Virtualisation Format (.OVF), which Virt Manager can import. 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 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 methods for importing large files into standalone environments. A new feature has been added that allows you to easily upload files from your local machine to your DaDesktop machine.

    Alternatively, consider using cloud file services such as Google Drive or Microsoft 365. These can be accessed by logging into the respective service within the DaDesktop machine.

  3. Adjusting graphics and/or disk types when importing VMs from other formats. A key advantage of Virt Manager is its robust support for VirtIO drivers. These open-source, fully virtualized drivers offer significantly better performance than native disk, network, or graphic drivers and are available for nearly all operating systems, with excellent support for Windows 10 guest machines. If your Guest OS supports them, VirtIO drivers are generally the preferred option for compatibility and performance when using Virt Manager (KVM). https://wiki.archlinux.org/title/Libvirt
  4. Optimal settings for VMs using Virt Manager VirtIO drivers are now standard in most open-source server operating systems and can be easily installed on Windows. While VirtIO is generally the best choice, other types may be required in specific cases. For networking, NAT 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 is an excellent introductory guide.
    Running Windows requires additional steps, including slipstreaming VirtIO drivers to ensure the Windows 10 ISO boots correctly.
    When selecting a hard disk format, .raw files offer the best speed unless snapshots are needed. In that case, use the qcow2 format, which is slightly slower.
  5. Although Wayland functions well in most scenarios as a display manager, we currently recommend using X11. That said, you may wish to test Wayland in your specific setup, as distribution support for Wayland is continuously improving.
  6. Avoid using ksm, as while it works in nested environments and Virt Manager, it offers negligible practical benefits.
  7. Tech Support is available for assistance with converting disk images for Virt Manager compatibility and for setting up Virt Manager for DaDesktop courses.
  8. Where are disk image files stored within the filesystem? Virt Manager defaults to the following location for image files, though this is configurable, and you may use alternative locations if preferred.

    /var/lib/libvirt/images