Building Virtual Machines Inside DaDesktop with Virt Manager

Introduction

When putting together a course, it's often handy to virtualize a server right inside DaDesktop, and possibly spin up one or two client machines similarly, whether they run the same OS or a mix of Windows and Linux.

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

DD Machines Nested Virt

After thorough testing, we recommend going with Virt Manager; we've encountered a few bugs with VirtualBox, so at the moment we advise against using it for this purpose.

The Virt Manager application relies on the libvirt library to deliver virtual machine management. Its desktop interface lets you create, remove, and juggle multiple VMs. It's mainly designed for KVM virtual machines, but it can handle other hypervisors like Xen and LXC as well.

Virt Manager also plays nicely with Vagrant, simply  :-          

apt install vagrant-libvirt

Keep in mind that there are fewer Vagrant boxes that work with libvirt/kvm compared to VirtualBox, but you can easily convert them to be libvirt-compatible, as detailed here :-

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

The interface offers a helpful summary of all VMs—showing their status, CPU usage, a live performance chart for running instances, and resource utilization stats.

If Virt Manager is new to you, think of it as very much like VirtualBox, but with a few key distinctions that we'll go over below.

Here's a solid guide for using virt-manager on Ubuntu Linux - https://www.debugpoint.com/virt-manager/

 

Why should I use Virt Manager instead of Virtualbox?

Advantages
  1. Performance sees a significant boost. Virt Manager employs VirtIO drivers for storage, networking, and graphics, delivering far better speed. Virtio drivers are KVM's paravirtualized device drivers, available for both Linux and Windows guest VMs running on KVM hosts. The virtio package covers block (storage) devices, network interface controllers, and graphics. Because these drivers are open source, they're a breeze to install if your Linux distribution doesn't already include them.
  2. You get a wider range of configuration options.
  3. It integrates smoothly with Vagrant.
  4. Some components of VirtualBox aren't fully open source.
  5. Unlike VirtualBox, Virt Manager doesn't require you to recompile modules each time a new kernel update comes along.
  6. VirtualBox has a history of occasionally breaking after a kernel upgrade.
Disadvantages
  1. Some might say VirtualBox has a slightly gentler learning curve.
  2. Configuring 'Host networking' rather than NAT is simpler in VirtualBox, though NAT handles most networking needs quite easily in both environments.
  3. VirtualBox runs on many platforms, but Virt Manager is Linux-only.


Taking everything into account, for running servers within a DaDesktop machine, Virt Manager is our go-to choice.

 

Installation

Since libvirt is continuously evolving, always opt for the newest non-LTS Ubuntu or Debian release.

Installing kvm and virt-manager is straightforward, but these notes are brief—make sure to follow a current guide tailored to your DaDesktop OS. One good resource is https://www.debugpoint.com/virt-manager/

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

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

 

Configuration

  1. How do I import or convert virtual machines ? While building VMs to your exact OS and spec needs is straightforward, more elaborate setups often call for importing an existing VM configuration—maybe a specific server or appliance. These frequently come as VMDK images, which you can add directly to Virt Manager (though it's not always obvious whether the current version supports this). VirtualBox server images can't be imported straight into Virt Manager, but you can export them to other virtualization formats like Open Virtualization Format (.OVF), which Virt Manager imports without a hitch. Alternatively, you could use VMware Converter if you have access to it, or turn to Virt-V2V instead https://www.redhat.com/en/blog/importing-vms-kvm-virt-v2v. Qemu-convert is another excellent open-source tool for converting between various 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. We recently introduced a way to easily upload files from your machine to within your DaDesktop instance.

    If you prefer, you can use a cloud storage service like Google Drive, Microsoft 365, or similar—just log into that service inside your DaDesktop machine to grab the files.

  3. When importing other virtual machines especially from other formats, often you will need to change graphics and / or disk types.  A standout feature of Virt Manager is its excellent support for VirtIO drivers. These open-source, fully virtualized drivers dramatically outperform traditional disk, network, or graphics drivers and work with virtually every operating system, including top-notch support for Windows 10 guests. Whenever your guest OS allows it, VirtIO drivers are generally the way to go for both compatibility and speed on Virt Manager (KVM). https://wiki.archlinux.org/title/Libvirt
  4. Optimal settings for virtual machines using Virt Manager VirtIO drivers now come built into almost all open-source server OSes, and Windows installs them easily. As a rule, virtio offers the best performance, though you might occasionally need to use one of the many alternative driver types. For networking, NAT gets the job done in most cases unless your setup demands a Bridged Host connection, which tends to be a bit more fiddly to configure. 
    https://wiki.manjaro.org/index.php?title=Virt-manager is a great starter guide here.
    Running Windows  involves a few extra steps: you'll need to slipstream the VirtIO drivers so the Windows 10 ISO can boot.
    When picking a hard disk format, raw files deliver top speed unless you need snapshots—then go with qcow2, though it's a tad slower.
  5. While Wayland performs well as a display manager in many situations, we recommend sticking with X11 for now. Still, feel free to experiment with Wayland in your own setup; distro support for it keeps improving steadily.
  6. You can skip ksm. Although it functions in nested setups and within Virt Manager, it doesn't make much real-world difference.
  7. Tech Support is on hand if you need help converting disk images for Virt Manager or configuring Virt Manager for your DaDesktop courses.
  8. Wondering where disk image files are stored on the filesystem? By default, Virt Manager places them here, though you can change this and use other locations if you like:

    /var/lib/libvirt/images