Creating VMs in DaDesktop using Virt Manager

Introduction

When preparing educational content, it is frequently beneficial to virtualize a server within DaDesktop. Similarly, one or two client machines can be virtualized alongside it, whether they run the same operating system or utilize a Windows/Linux combination.

'Nested VMs' can be executed using Virt Manager or VirtualBox. If Linux is the host operating system, Vagrant can optionally be employed with either tool. For Windows 10 as the DaDesktop machine, VirtualBox remains the option.

DD Machines Nested Virt

After rigorous testing, our preferred method is to use Virt Manager. This is due to several bugs encountered with VirtualBox; consequently, we currently do not recommend VirtualBox for this specific use case.

The VirtManager application leverages the libvirt library to deliver 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 through the simple installation of the necessary plugin:-

apt install vagrant-libvirt

It is worth noting that while fewer Vagrant boxes are available for libvirt/kvm compared to VirtualBox, these can be readily converted 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, including their status, CPU usage, live performance graphs for active VMs, and resource utilization statistics.

If you are new to Virt Manager, it closely resembles VirtualBox but includes several significant differences detailed below.

A solid resource for using virt-manager on Ubuntu Linux is available at https://www.debugpoint.com/virt-manager/

Why should I use Virt Manager instead of Virtualbox?

Advantages
  1. Performance is significantly enhanced - Virt Manager utilizes VirtIO drivers for storage, networking, and graphics, which yields superior performance. Virtio drivers are paravirtualized device drivers for KVM, available for both Linux and Windows guest virtual machines on KVM hosts. The virtio package supports block (storage) devices, network interface controllers, and graphics. As these drivers are open source, they are easily installed if not pre-included in your Linux distribution.
  2. Offers a wider range of configurability options
  3. Integrates effectively with Vagrant
  4. Portions of VirtualBox are not fully open source
  5. Virt Manager does not require module recompilation after kernel upgrades, unlike VirtualBox.
  6. VirtualBox is occasionally known to break following new kernel upgrades.
Disadvantages
  1. VirtualBox may have a slightly gentler learning curve
  2. Configuring 'Host networking' instead of NAT is simpler in VirtualBox, although NAT functions adequately for most networking scenarios in both systems.
  3. VirtualBox is available on many platforms, whereas Virt Manager is exclusive to Linux


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

Installation

Since libvirt is constantly evolving, it is advisable to use the latest non-LTS Ubuntu or Debian version.

Installing kvm and virt-manager is straightforward. These are concise installation notes, but please consult a current guide for your specific DaDesktop OS. One such guide is 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 custom VMs tailored to your operating system and specification requirements is easy, importing an existing VM setup is often preferred for more complex configurations, such as specific servers or appliances. These are frequently supplied as VMDK images. Although it is unclear if the current version allows adding these directly to Virt Manager, Virtual Box server images cannot be imported directly. However, they can be easily exported to other virtualization formats, such as Open Virtualisation Format (.OVF), which Virt Manager imports without issue. Alternatively, you can use VmWare Convertor (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 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 method to easily upload files from your machine to your DaDesktop machine has been introduced.

    Alternatively, consider using cloud storage tools such as Google Drive or Microsoft 365. You can access these by logging into the service within the 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 robust support for VirtIO drivers. These open-source, fully virtualized drivers deliver much better performance than standard disk, network, or graphic drivers and are compatible with nearly all operating systems, including excellent support for guest Windows 10 machines. If your Guest OS supports them, VirtIO drivers are generally the preferred choice 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 most modern open-source server operating systems and can be easily installed on Windows. Generally, virtio drivers are the best choice, but other types may be necessary in specific cases. NAT is sufficient for most networking needs, unless a more complex setup requiring Bridged Host networking is desired, 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 allow the Windows 10 ISO to boot.
    When selecting the hard disk format, .raw files are best for speed unless snapshots are required; in that case, use the qcow2 format, which is slightly slower.
  5. Although Wayland works well in most scenarios as a display manager, we advise continuing to use X11 for now. However, it may be worth testing Wayland in your specific setup, as distributions are increasingly improving their support for it.
  6. There is no need to use ksm, as while it works in nested environments and within Virt Manager, it provides minimal practical benefit.
  7. Tech Support is available if needed 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 located within the filesystem? Virt Manager stores image files in the following location by default, though this is configurable and other locations can be used if preferred.

    /var/lib/libvirt/images