Creating VMs within DaDesktop using Virt Manager

Introduction

When preparing course materials, it is often beneficial to virtualise a server within DaDesktop. You may also wish to virtualise one or two client machines using the same method, whether they run the same operating system or a mix of Windows and Linux.

You can run 'Nested VMs' using either Virt Manager or VirtualBox. If you are using Linux, you may optionally employ Vagrant alongside these tools, or use VirtualBox if your DaDesktop machine is running Windows 10.

DD Machines Nested Virt

Based on our extensive testing, our recommended approach is to use Virt Manager, as VirtualBox has been found to have several bugs in this context. Consequently, we currently advise against using VirtualBox for this specific purpose.

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 it is primarily designed for KVM VMs, it also supports other hypervisors, including Xen and LXC.

Virt Manager also integrates seamlessly with Vagrant, simply by running the following command:          

apt install vagrant-libvirt

It is worth noting that there are fewer Vagrant boxes available for libvirt/kvm compared to VirtualBox. However, 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 provides a comprehensive overview of all VMs, including their status, CPU usage, a live performance graph for running instances, and resource utilisation statistics.

If you are new to Virt Manager, you will find it very similar to VirtualBox, though there are several important differences detailed below.

For a detailed guide on using virt-manager on Ubuntu Linux, refer to 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 utilises VirtIO drivers for storage, networking, and graphics, resulting in much better performance. Virtio drivers are KVM's paravirtualised device drivers, available for Linux and Windows guest virtual machines running on KVM hosts. The virtio package supports block (storage) devices and network interface controllers, as well as graphics. Since VirtIO drivers are open source, they can be easily installed if not already pre-installed on your Linux distribution.
  2. Offers a greater range of configurability options.
  3. Integrates well with Vagrant.
  4. Some components of VirtualBox are not fully open source.
  5. Virt Manager does not require module recompilation after every new kernel upgrade, unlike VirtualBox.
  6. VirtualBox has a known tendency to break when new kernel upgrades are required.
Disadvantages
  1. VirtualBox is often considered to have a slightly shorter learning curve.
  2. Configuring 'Host networking' rather than NAT is somewhat easier in VirtualBox; however, NAT functions adequately for most networking use cases on both systems.
  3. While VirtualBox is available on multiple platforms, Virt Manager is exclusively available on Linux.


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

 

Installation

Given that libvirt is constantly evolving, it is advisable to always use the latest non-LTS version of Ubuntu or Debian.

Installing kvm and virt-manager is a straightforward process. These are brief installation notes; however, please refer to a current guide for your preferred DaDesktop OS. One such guide can be found here.

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

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

 

Configuration

  1. How do I import or convert virtual machines ? While creating VMs tailored to your specific operating system and specifications is straightforward, it is often preferable to import an existing VM setup for more complex configurations, such as specific servers or appliances. These are frequently supplied as VMDK images, which can be added directly to Virt Manager, although current versions may present some ambiguity regarding this process. VirtualBox server images cannot be imported directly into Virt Manager but can be easily exported into other virtualisation formats, such as Open Virtualisation Format (.OVF), which Virt Manager supports. Alternatively, you may use VMware Converter if available, or Virt-V2V instead: https://www.redhat.com/en/blog/importing-vms-kvm-virt-v2v. Qemu-convert is also a valuable open-source tool that facilitates easy conversion 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. Recently, a feature was added to allow you to easily upload files from your host machine to within your DaDesktop machine.

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

  3. When importing other virtual machines, especially from different formats, you will often need to adjust graphics and/or disk types.  A significant advantage of Virt Manager is its excellent support for VirtIO drivers. These open-source, fully virtualised drivers offer substantially better performance compared to original 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, these are generally the preferred option for both 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 drivers are generally the best choice, you may need to use other types in specific cases. For most networking needs, NAT is sufficient unless you require a more complex setup where Bridged Host networking is necessary; however, the latter is generally more complex to configure. 
    https://wiki.archlinux.org/title/Virt-manager is a great starter guide.
    Running Windows  requires additional steps and involves slipstreaming VirtIO drivers to allow the Windows 10 ISO to boot.
    When selecting a hard disk format, .raw files are best for speed unless snapshots are required; if snapshots are needed, use qcow2 format, though this is slightly slower.
  5. Although Wayland works well for most cases as a display manager, we advise continuing to use X11 for now. That said, it may be worth experimenting with Wayland in your own specific setup, as distributions are improving their Wayland support continuously.
  6. There is no need to use ksm, as although it works nested and within Virt Manager, it makes little practical difference.
  7. Tech Support is available if required when converting disk images to work with Virt Manager, as well as for 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, though this is configurable and other locations can be used if preferred.

    /var/lib/libvirt/images