DaDesktop

Creating VMs within DaDesktop using Virt Manager

Introduction

Often when preparing a course it's helpful to virtualise a server within DaDesktop, and perhaps also virtualise one or two client machines in the same way, either using the same OS or a Windows/Linux mix.

You can run 'Nested VMs' either with Virt Manager or VirtualBox, optionally using Vagrant on Linux, or VirtualBox if your DaDesktop machine runs Windows 10.

DD Machines Nested Virt

After extensive testing we recommend using Virt Manager, as VirtualBox has a couple of bugs; for now we advise against using VirtualBox in this way.

The VirtManager application relies on the libvirt library to provide VM management. It offers a desktop interface for creating, deleting, and managing multiple virtual machines. Whilst primarily intended for KVM VMs, it also supports other hypervisors such as Xen and LXC.

Virt Manager also works very well with Vagrant, simply:

apt install vagrant-libvirt

It's worth noting that there are fewer Vagrant boxes available for libvirt/kvm than for VirtualBox, but they can be easily 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, including their status, CPU usage, a live performance graph of running VMs, and resource utilisation statistics.

If you haven't used Virt Manager before, it's very similar to VirtualBox but with a few important differences as described below.

This is a useful guide on 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 much better – Virt Manager uses VirtIO drivers for storage, networking, and graphics, delivering significantly better performance. Virtio drivers are KVM's paravirtualised device drivers, available for both Linux and Windows guest virtual machines on KVM hosts. The virtio package supports block (storage) devices, network interface controllers, and graphics. VirtIO drivers are open source, so they are easy to install if not already included with your Linux distribution.
  2. More configurability options available
  3. Works well with Vagrant
  4. Some parts of VirtualBox are not fully open source
  5. Virt Manager does not require module recompiles after a kernel upgrade, unlike VirtualBox.
  6. VirtualBox sometimes breaks after a kernel upgrade.
Disadvantages
  1. VirtualBox arguably has a slightly shorter learning curve
  2. Setting up 'Host networking' instead of NAT is easier on VirtualBox; however, NAT works quite well for most networking needs on both systems.
  3. VirtualBox is available on many platforms, whereas Virt Manager is only available on Linux


All in all, we find that Virt Manager is the preferred choice for running servers within a DaDesktop machine.

 

Installation

Since libvirt is constantly improving, always use the latest non-LTS Ubuntu or Debian version.

These are brief installation notes for KVM and virt-manager; however, please follow an up-to-date guide for your chosen 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 and run Virt Manager from the Applications menu

 

Configuration

  1. How do I import or convert virtual machines ? Although it's easy to create VMs tailored to your operating system and specification, for more complex setups it's often preferable to import an existing VM configuration of a particular server or appliance. Often these are supplied as VMDK images, which can be added directly to Virt Manager, although it's not immediately obvious that this is possible with the current version. VirtualBox server images cannot be imported (added) directly into Virt Manager, but can be easily exported to other virtualisation formats such as the Open Virtualisation Format (.OVF), which Virt Manager imports easily. Otherwise, you could 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 easy conversion between different VM 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 added.

    Otherwise, consider using a cloud file storage service such as Google Drive or Microsoft 365. You can then access your files by logging into the service inside the DaDesktop machine.

  3. When importing other virtual machines especially from other formats, often you will need to change graphics and / or disk types. One of the best aspects of Virt Manager is its excellent support for VirtIO drivers. These fully virtualised open-source drivers offer much better performance than traditional disk, network, or graphics drivers, and they are available for nearly all operating systems, with superb support for guest Windows 10 machines. If your guest OS supports them, they 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 now included in almost all open-source server operating systems and can be easily installed on Windows. Generally, the best drivers are VirtIO, but in some cases you may need to use one of the other types. NAT networking is sufficient for most scenarios unless you require a more complex setup where bridged host networking is needed, though this can be trickier to get working smoothly. 
    https://wiki.manjaro.org/index.php?title=Virt-manager is a great starter guide.
    Running Windows requires a few extra steps, including slipstreaming the VirtIO drivers so the Windows 10 ISO can boot.
    When choosing a hard disk format, .raw files offer the best speed unless snapshots are required; in that case, use qcow2 format, though it is slightly slower.
  5. Although Wayland works well in most situations as a display manager, we advise sticking with X11 for now. That said, it may be worth trying Wayland for your particular setup, as distributions are continually improving Wayland support.
  6. Don't bother with KSM; although it works nested and within Virt Manager, it makes little practical difference.
  7. Tech Support is available if you require help converting disk images to work with Virt Manager, or setting up Virt Manager for DaDesktop courses.
  8. Where are disk image files located on the filesystem? Virt Manager stores image files in the following location, though this is configurable and other locations can be used.

    /var/lib/libvirt/images