Creating VMs within DaDesktop using Virt Manager

Introduction

Often when preparing a course, it is useful to virtualise a server within DaDesktop, and perhaps virtualise one or two client machines as well, either using the same OS or a Windows/Linux mix.

Running 'Nested VMs' can be carried out either with Virt Manager or VirtualBox (optionally with Vagrant when using Linux), or VirtualBox if Windows 10 is the DaDesktop machine.

DD Machines Nested Virt

After extensive testing, our recommended choice is to use Virt Manager, as there are a couple of bugs when using VirtualBox; therefore, we currently advise against using VirtualBox in this manner.

The VirtManager application uses the libvirt library to provide virtual machine management services. It has a desktop interface that helps to create, delete, and manage multiple virtual machines. It is primarily used for KVM VMs but can support other hypervisors as well, such as Xen, and LXC.

Virt Manager also integrates nicely with Vagrant – simply run the following command:

apt install vagrant-libvirt

It is worth noting that fewer Vagrant boxes are available using libvirt/kvm compared to VirtualBox, but these can be readily converted to work with libvirt as shown here:

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

The user interface gives a summary view of all VMs, their status, CPU usage, a live performance graph of running VMs, and resource utilisation statistics.

If you have not used Virt Manager before, it is very similar to VirtualBox but with a few important differences as described below.

This is a good guide regarding using virt-manager on Ubuntu Linux – https://www.debugpoint.com/virt-manager/

 

Why should I use Virt Manager instead of Virtualbox?

Advantages
  1. Performance is far superior – Virt Manager uses VirtIO drivers for storage, networking and graphics, which provides 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, network interface controllers, and graphics. VirtIO drivers are open source, so they are easily installed if not already pre-installed on your Linux distribution.
  2. More configuration options are available
  3. Works well with Vagrant
  4. Some parts of VirtualBox are not fully open source
  5. Virt Manager does not need module recompiles whenever a new kernel upgrade is made, as is the case for VirtualBox.
  6. VirtualBox sometimes breaks when a new kernel upgrade is required.
Disadvantages
  1. VirtualBox could be said to have a slightly shorter learning curve
  2. Setting up 'Host networking' rather than NAT is easier on VirtualBox; however, NAT works for most networking use cases quite easily on both systems.
  3. VirtualBox is available on many platforms, whereas Virt Manager is only available on Linux


On the whole, we find that for running servers within a DaDesktop machine, Virt Manager is the preferred option.

 

Installation

Because libvirt is improving all the time, always use the latest non LTS Ubuntu or Debian version available in the UK.

Installation of kvm, virt-manager. These are very concise installation notes; however, please follow an up-to-date guide for your preferred DaDesktop OS. This is one guide: https://www.debugpoint.com/virt-manager/

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

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

 

Configuration

  1. How do I import or convert virtual machines? Although it is easy to create VMs built to your required operating system and specification, for more complicated setups it is often better to import an existing VM set-up of a particular server or appliance. These are often supplied as VMDK images, which can be added directly to Virt Manager – though it is not obvious that this is possible with the current version. Virtual Box server images cannot be imported (added) directly to Virt Manager, but can be easily exported into other virtualisation formats such as Open Virtualisation Format (.OVF), which Virt Manager can import easily. Otherwise, you could use VmWare Converter if you have it, or Virt-V2V instead: https://www.redhat.com/en/blog/importing-vms-kvm-virt-v2v. Qemu-convert is also a great open source tool that allows 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 method to easily upload files from your machine to within your DaDesktop machine has been added.

    Otherwise, consider using a cloud file tool such as Google Drive, Microsoft 365, etc. These can then be accessed by logging into the tool inside the DaDesktop machine.

  3. When importing other virtual machines, especially from other formats, you will often need to change graphics and/or disk types. One of the best things about Virt Manager is that it includes really great support for VirtIO drivers. These are open source fully virtualised drivers that provide much 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 usually 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 open source server operating systems nowadays, and can be installed easily in Windows. Generally the best drivers are virtio, but in some cases you may need to use one of the many other types. NAT is usually sufficient for most networking cases unless you require a more complicated set-up where Bridged Host networking may be required; however, this is generally trickier to get working easily.
    https://wiki.manjaro.org/index.php?title=Virt-manager is a great starter guide here.
    Running Windows requires some extra steps, and will need slipstreaming of VirtIO drivers to allow the Windows 10 iso to boot.
    When choosing hard disk format, for speed .raw files are best unless snapshots are required; if so, use qcow2 format, but this is a little slower.
  5. Although Wayland works well for most cases as a display manager, we advise that you continue to use X11 for now. That said, it may be worth trying out Wayland in your own particular setup – and distros are getting better support for Wayland all the time.
  6. It is not worth using ksm: although it works nested and in Virt Manager, it makes little difference in practice.
  7. Tech Support is available if required when converting disk images to work with Virt Manager, and additionally 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; however, this is configurable, and other locations can be used if preferred.

    /var/lib/libvirt/images