Generating Virtual Machines within DaDesktop Using Virt Manager

Introduction

When preparing a course, it is frequently beneficial to virtualise a server within DaDesktop. Similarly, one or two client machines can often be virtualised in the same manner, whether using a consistent operating system or a combination of Windows and Linux.

'Nested VMs' can be achieved through the use of either Virt Manager or VirtualBox. When utilizing Linux, Vagrant can optionally be incorporated, whereas for Windows 10 environments acting as the DaDesktop machine, VirtualBox is the suitable option.

DD Machines Nested Virt

Following extensive testing, our recommended preference is to employ Virt Manager. This is due to several identified bugs associated with VirtualBox; consequently, we currently advise against using VirtualBox in this specific capacity.

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

Virt Manager integrates seamlessly with Vagrant, simply  :-            

apt install vagrant-libvirt

It is noteworthy that while fewer Vagrant boxes are available for libvirt/kvm compared to VirtualBox, these can be readily adapted to work with libvirt, as demonstrated here :-

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

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

For those unfamiliar with Virt Manager, it closely resembles VirtualBox, albeit with a few significant distinctions outlined below.

A comprehensive guide on utilizing virt-manager on Ubuntu Linux can be found here - 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, yielding considerably better results. Virtio drivers are KVM's paravirtualized device drivers, compatible with both Linux and Windows guest virtual machines operating on KVM hosts. The virtio package supports block (storage) devices, network interface controllers, and graphics. As VirtIO drivers are open source, they are easily installed if not pre-installed on your Linux distribution.
  2. Greater configurability options are available.
  3. Excellent compatibility with Vagrant.
  4. Certain components of VirtualBox are not fully open source.
  5. Virt Manager eliminates the need for module recompilation following new kernel upgrades, a requirement that applies to VirtualBox.
  6. VirtualBox is occasionally prone to instability following kernel upgrades.
Disadvantages
  1. VirtualBox is generally considered to have a slightly gentler learning curve.
  2. Configuring 'Host networking' rather than NAT is more straightforward in VirtualBox; however, NAT functions adequately for most networking use cases in both systems.
  3. While VirtualBox is available across multiple platforms, Virt Manager is exclusive to Linux.


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

 

Installation

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

The installation of kvm and virt-manager follows these brief instructions; however, please refer to an up-to-date guide for your preferred DaDesktop OS. One such guide is available here.

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 specifications is straightforward, importing an existing VM setup is often preferable for more complex configurations, particularly for specific servers or appliances. These are commonly provided as VMDK images. Although it is unclear if direct addition to Virt Manager is supported in the current version, VirtualBox server images cannot be imported directly. Instead, they can be easily exported to other virtualisation formats, such as Open Virtualisation Format (.OVF), which Virt Manager can import. Alternatively, you may use VMware Convertor or Virt-V2V https://www.redhat.com/en/blog/importing-vms-kvm-virt-v2v. Qemu-convert is another excellent open-source tool that facilitates easy conversion between various 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. The optimal method for importing large files into standalone environments. Recently, a feature has been introduced to easily upload files from your local machine into your DaDesktop machine.

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

  3. When importing virtual machines from other formats, adjustments to graphics and/or disk types are often necessary.  A notable benefit of Virt Manager is its robust support for VirtIO drivers. These open-source, fully virtualised drivers deliver significantly enhanced performance compared to original disk, network, or graphic drivers and are available for nearly all operating systems, including excellent support for Windows 10 guests. If your Guest OS supports them, VirtIO drivers are typically the preferred choice 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 now included in virtually all open-source server operating systems and can be easily installed in Windows. While virtio is generally the best option, other driver types may be required in specific instances. For networking, NAT is usually sufficient unless a more complex setup necessitates Bridged Host networking, which can be more challenging to configure successfully. 
    https://wiki.manjaro.org/index.php?title=Virt-manager serves as an excellent introductory guide.
    Running Windows requires additional steps, specifically the slipstreaming of 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 required. If snapshots are necessary, the qcow2 format should be used, albeit with slightly slower performance.
  5. Although Wayland functions well in most scenarios as a display manager, we recommend continuing to use X11 for the time being. That said, it may be worthwhile to experiment with Wayland in your specific setup, as distribution support for Wayland is improving steadily.
  6. There is little point in using KSM, as although it operates in nested environments and within Virt Manager, it yields minimal practical difference.
  7. Tech Support is available if required for 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 stored within the filesystem? Virt Manager uses the following location for image files, though this is configurable, and alternative locations may be used if preferred.

    /var/lib/libvirt/images