Creating VMs within DaDesktop using Virt Manager

Introduction

When preparing courses, it is often beneficial to virtualize a server within DaDesktop. Similarly, virtualizing one or two client machines using the same operating system or a mixed Windows/Linux environment can be advantageous.

You can run 'Nested VMs' by using Virt Manager or VirtualBox. If you are using Linux, Vagrant can be optionally utilized alongside VirtualBox; for Windows 10 DaDesktop machines, VirtualBox is the standard choice.

DD Machines Nested Virt

Based on extensive testing, we recommend using Virt Manager due to several bugs identified in VirtualBox. Consequently, we currently advise against using VirtualBox for this specific purpose.

The VirtManager application leverages the libvirt library to provide virtual machine management services. Its desktop interface 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, which can be set up using the following command:

apt install vagrant-libvirt

Please note that while there are fewer Vagrant boxes available for libvirt/kvm compared to VirtualBox, these can be easily converted to work with libvirt, as demonstrated in the following resource:

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

The user interface offers a comprehensive summary view of all VMs, including their status, CPU usage, real-time performance graphs for running VMs, and resource utilization statistics.

If you are new to Virt Manager, note that while it resembles VirtualBox, there are several important differences, detailed below.

This is a useful guide on using virt-manager on Ubuntu Linux - 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, significantly enhancing performance. Virtio drivers are KVM's paravirtualized device drivers, compatible with Linux and Windows guest virtual machines running on KVM hosts. The virtio package supports block (storage) devices, network interface controllers, and graphics. Being open source, these drivers are easily installed if not pre-installed on your Linux distribution.
  2. Greater configurability options available
  3. Seamless integration with Vagrant
  4. VirtualBox has components that are not fully open source
  5. Virt Manager eliminates the need for module recompilation after kernel upgrades, a common requirement for VirtualBox.
  6. VirtualBox is occasionally known to malfunction following kernel upgrades.
Disadvantages
  1. VirtualBox may offer a slightly gentler learning curve
  2. Configuring 'Host networking' rather than NAT is more straightforward in VirtualBox, although NAT is sufficient for most networking use cases in both systems.
  3. VirtualBox is available on multiple platforms, whereas Virt Manager is exclusive to Linux


Overall, we find that Virt Manager is the preferred choice 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, follow these brief notes. However, for a comprehensive setup, please refer to an up-to-date guide for your preferred 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 do I import or convert virtual machines? While creating new VMs tailored to your operating system and specification requirements is straightforward, complex setups often benefit from importing existing VM configurations for specific servers or appliances. These are frequently provided as VMDK images, which can be added directly to Virt Manager, though the current version's support for this is not entirely clear. VirtualBox 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 supports. Alternatively, you may use VmWare Convertor (if available) or Virt-V2V, as detailed here: 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. Best way to import large files inside standalone. A feature has recently been added to easily upload files from your host machine to the DaDesktop environment.

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

  3. When importing virtual machines from other formats, you may need to adjust graphics and/or disk types. One of Virt Manager's key strengths is its robust support for VirtIO drivers. These fully virtualized, open-source drivers deliver significantly better performance compared to legacy disk, network, or graphic drivers and are compatible with nearly all operating systems, including excellent support for Windows 10 guest machines. If your Guest OS supports them, VirtIO is typically the recommended option for optimal compatibility and performance in Virt Manager (KVM). Reference: https://wiki.archlinux.org/title/Libvirt
  4. Optimal settings for virtual machines using Virt Manager VirtIO drivers are included in most modern open-source server operating systems and are easy to install on Windows. While virtio is generally the best choice, other driver types may be required in specific scenarios. For networking, NAT is usually sufficient, although more complex setups may require Bridged Host networking, which can be trickier to configure. Reference: https://wiki.archlinux.org/title/Virt-manager is a great starter guide.
    Running Windows requires additional steps, specifically slipstreaming VirtIO drivers to ensure the Windows 10 ISO boots correctly.
    When selecting a hard disk format, .raw files are best for speed unless snapshots are required, in which case the qcow2 format should be used, though it is slightly slower.
  5. Although Wayland performs well in most scenarios as a display manager, we recommend continuing to use X11 for now. However, it may be worth experimenting with Wayland in your specific setup, as distributions are improving Wayland support continuously.
  6. There is no need to enable ksm, as although it works in nested environments and Virt Manager, it offers little practical benefit.
  7. Tech Support is available if you require assistance with converting disk images for Virt Manager or setting up Virt Manager for DaDesktop courses.
  8. Where are disk image files located within the filesystem? Virt Manager stores image files in the following location by default, though this path is configurable and other locations can be used if preferred.

    /var/lib/libvirt/images