Creating Virtual Machines inside DaDesktop via Virt Manager

Introduction

When preparing a course, it's often practical to run a server as a virtual machine inside DaDesktop. You might also spin up one or two client machines the same way, whether using the same OS or a blend of Windows and Linux.

Running 'Nested VMs' can be done via either Virt Manager, or VirtualBox (optionally with Vagrant) on Linux. If your DaDesktop machine runs Windows 10, VirtualBox is the way to go.

DD Machines Nested Virt

Based on thorough testing, we recommend Virt Manager over VirtualBox for this purpose, since we've encountered a few bugs with VirtualBox. For that reason, we don't currently advise using VirtualBox in this setup.

Virt Manager relies on the libvirt library to deliver VM management features. Its graphical desktop interface lets you effortlessly create, remove, and oversee multiple virtual machines. While it's mainly aimed at KVM VMs, it can also work with other hypervisors like Xen and LXC.

Virt Manager also works very well with Vagrant — simply:

apt install vagrant-libvirt

Do keep in mind that there are fewer Vagrant boxes built for libvirt/kvm than for VirtualBox. However, those boxes can be converted to run on libvirt without much trouble, as demonstrated here:

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

The interface shows you an overview of all VMs—their current status, CPU usage, live performance graphs for running machines, and resource utilization data.

If you're new to Virt Manager, you'll find it quite similar to VirtualBox, though there are a few key distinctions we'll cover next.

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

 

Why use Virt Manager instead of VirtualBox?

Advantages
  1. Performance is significantly better—Virt Manager taps into VirtIO drivers for storage, networking, and graphics, which translates to a much faster experience. These virtio drivers are KVM's paravirtualized device drivers, built for both Linux and Windows guest VMs on KVM hosts. The virtio package covers block (storage) devices, network controllers, and graphics. Since VirtIO drivers are open source, they're a breeze to install if they aren't already included with your Linux distribution.
  2. A wider range of configuration options is available.
  3. Works seamlessly with Vagrant.
  4. Certain components of VirtualBox are not completely open source.
  5. Virt Manager doesn't require recompiling kernel modules after a kernel upgrade, unlike VirtualBox.
  6. VirtualBox is known to occasionally break after a kernel update.
Disadvantages
  1. VirtualBox arguably has a slightly gentler learning curve.
  2. Configuring host networking (as opposed to NAT) is simpler in VirtualBox; however, NAT handles most networking scenarios smoothly on both platforms.
  3. VirtualBox runs on many platforms, while Virt Manager is Linux-only.


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

 

Installation

Since libvirt is constantly evolving, stick to the most recent non-LTS Ubuntu or Debian release.

To install KVM and virt-manager, the steps below are a quick summary; however, please refer to an up-to-date guide for your chosen DaDesktop operating system. Here's one such guide: https://www.debugpoint.com/virt-manager/

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

After rebooting the DaDesktop machine, launch Virt Manager from the Applications menu.

 

Configuration

  1. How do I import or convert virtual machines ? While creating fresh VMs tailored to your OS and specs is quite straightforward, more complex setups often call for importing an existing virtual machine—maybe a specific server or appliance. These are frequently supplied as VMDK disks, which can be attached directly to Virt Manager, though it's not entirely obvious whether this is supported in the current version. VirtualBox server images can't be imported directly, but they can be exported to other formats like the Open Virtualization Format (.OVF), which Virt Manager handles easily. Alternatively, you can use VMware Converter if you have it, or Virt-V2V (https://www.redhat.com/en/blog/importing-vms-kvm-virt-v2v). Qemu-convert is another excellent open-source utility for converting 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. We've recently added a feature that lets you upload files straight from your local machine into DaDesktop.

    Otherwise, you can use a cloud storage service like Google Drive or Microsoft 365, and then access it by logging into that service from within 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 Virt Manager's standout features is its excellent support for VirtIO drivers. These open-source, fully virtualized drivers deliver far better performance than the default disk, network, or graphics drivers, and they work with nearly every operating system—including great support for Windows 10 guests. If your guest OS supports VirtIO drivers, they're usually the best choice for both compatibility and speed with Virt Manager (KVM). See: https://wiki.archlinux.org/title/Libvirt
  4. Optimal settings for virtual machines using Virt Manager VirtIO drivers are now built into nearly all open-source server operating systems, and they can be installed on Windows with minimal effort. Typically, virtio is the top driver choice, though other driver types are available for specific situations. For networking, NAT works fine in most setups; if you need something more advanced, you might explore bridged host networking, but it's generally a bit trickier to configure. 
    https://wiki.manjaro.org/index.php?title=Virt-manager is a helpful starting point.
    Running Windows involves a couple of extra steps, including slipstreaming the VirtIO drivers into the Windows 10 ISO so it can boot.
    When selecting a disk format, raw files are fastest unless you need snapshots, in which case qcow2 is the way to go—though it's slightly slower.
  5. While Wayland works well as a display manager in many situations, we currently recommend sticking with X11. Still, it's worth experimenting with Wayland in your own environment, as Linux distributions are steadily improving Wayland support.
  6. You can skip enabling KSM—even though it functions in nested setups and within Virt Manager, it rarely makes a noticeable difference.
  7. Tech Support is available should you need help converting disk images for Virt Manager or setting up Virt Manager for your DaDesktop courses.
  8. Where are the disk image files stored? By default, Virt Manager keeps images in the following directory, but you can change this to any location you like.

    /var/lib/libvirt/images