Creating VMs within DaDesktop using Virt Manager

Introduction

When preparing a course, it is often beneficial to virtualise a server within DaDesktop. Similarly, you might virtualise one or two client machines using either the same operating system or a combination of Windows and Linux.

You can run 'Nested VMs' using Virt Manager or VirtualBox. If you are using Linux, Vagrant can optionally be used with VirtualBox; however, if DaDesktop is running Windows 10, VirtualBox is the standard choice.

DD Machines Nested Virt

Based on extensive testing, we recommend Virt Manager. VirtualBox has known bugs in this context, so we currently advise against using it for this specific setup.

Virt Manager leverages the libvirt library to provide virtual machine management services. It offers a desktop interface that simplifies the creation, deletion, and management of multiple virtual machines. While it is primarily used for KVM VMs, it also supports other hypervisors like Xen and LXC.

Virt Manager integrates seamlessly with Vagrant:

apt install vagrant-libvirt

Please note that the selection of Vagrant boxes available for libvirt/kvm is smaller than for VirtualBox. However, these can be easily converted to work with libvirt, as demonstrated here:

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

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

If you are new to Virt Manager, you will find it similar to VirtualBox, albeit with some key differences outlined below.

For a solid guide on using virt-manager on Ubuntu Linux, see this resource: https://www.debugpoint.com/virt-manager/

 

Why should I use Virt Manager instead of Virtualbox?

Advantages
  1. Performance is significantly superior. Virt Manager utilizes VirtIO drivers for storage, networking, and graphics, resulting in enhanced performance. Virtio drivers are KVM's paravirtualized device drivers, available for Linux and Windows guest virtual machines running on KVM hosts. The virtio package supports block (storage) devices, network interface controllers, and graphics. Since VirtIO drivers are open source, they are easy to install if not already pre-installed on your Linux distribution.
  2. It offers a broader range of configuration options.
  3. It integrates well with Vagrant.
  4. Parts of VirtualBox are not fully open source.
  5. Virt Manager does not require module recompilation after a new kernel upgrade, a requirement that applies to VirtualBox.
  6. VirtualBox is occasionally prone to breaking when a new kernel upgrade is installed.
Disadvantages
  1. VirtualBox may have a slightly gentler learning curve.
  2. Setting up 'Host networking' (as opposed to NAT) is easier in VirtualBox, although NAT functions effectively for most networking use cases in both systems.
  3. VirtualBox is available on many platforms, whereas Virt Manager is exclusive to Linux.


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

 

Installation

Given that libvirt is continuously improving, always use the latest non-LTS Ubuntu or Debian version.

To install kvm and virt-manager, follow these brief notes. However, please refer to an up-to-date guide for your specific DaDesktop OS. One such 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 and launch Virt Manager from the Applications menu.

 

Configuration

  1. How do I import or convert virtual machines ? While creating VMs tailored to your operating system and specification requirements is straightforward, importing an existing VM setup for a specific server or appliance is often preferred for complex scenarios. These are frequently provided as VMDK images, which can theoretically be added directly to Virt Manager, though this may not be fully supported in the current version. VirtualBox server images cannot be imported directly but can be exported into other virtualisation formats, such as Open Virtualisation Format (.OVF), which Virt Manager handles easily. Alternatively, you can use VMware Converter if available, 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, 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 machine to your DaDesktop machine.

    Otherwise, consider using a cloud file tool such as Google Drive or Microsoft 365. These can be accessed by logging in to the tool from within the DaDesktop machine.

  3. When importing other virtual machines, especially from other formats, you will often need to adjust graphics and/or disk types.  One of Virt Manager's strengths is its robust support for VirtIO drivers. These open-source, fully virtualised drivers offer significantly better performance than native disk, network, or graphic drivers and are available for nearly all operating systems, including excellent support for guest Windows 10 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 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. While VirtIO is generally the best driver choice, you may need to use other types in certain cases. NAT is sufficient for most networking scenarios unless you require a more complex setup where Bridged Host networking is necessary, though the latter can be more difficult to configure.
    https://wiki.archlinux.org/title/Virt-manager is an excellent starting guide. Running Windows requires additional steps, specifically slipstreaming VirtIO drivers to allow the Windows 10 ISO to boot. When selecting the hard disk format, .raw files offer the best speed unless snapshots are required; if snapshots are needed, use the qcow2 format, albeit with slightly reduced performance.
  5. Although Wayland works well as a display manager in most cases, we advise continuing to use X11 for the time being. That said, it may be worth experimenting with Wayland in your specific setup, as distributions are improving their support for it continually.
  6. Do not bother using KSM, as although it works in nested environments and within Virt Manager, it offers little practical difference.
  7. Tech Support is available if you need assistance 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, although this is configurable to other preferred locations.

    /var/lib/libvirt/images