DaDesktop

Creating Virtual Machines Inside DaDesktop with Virt Manager

Introduction

When setting up a course, you'll often find it helpful to run a server as a virtual machine inside DaDesktop. You might also want to virtualize a couple of client machines alongside it, using either the same operating system or a combination of Windows and Linux.

You can run Nested VMs either with Virt Manager or VirtualBox (with Vagrant as an option on Linux) – or simply VirtualBox if your DaDesktop machine is running Windows 10.

DD Machines Nested Virt

Based on thorough testing, we recommend Virt Manager over VirtualBox, since the latter currently has a few bugs when used this way. For now, we advise against using VirtualBox for this purpose.

Virt Manager relies on the libvirt library to offer virtual machine management. Its graphical desktop interface lets you create, remove, and manage several VMs at once. While it's mainly designed for KVM-based virtual machines, it also works with other hypervisors like Xen and LXC.

Virt Manager also integrates smoothly with Vagrant, simply  :-          

apt install vagrant-libvirt

Note that although Vagrant offers fewer boxes for libvirt/kvm than for VirtualBox, you can readily convert them to libvirt – as demonstrated here:
https://medium.com/@gamunu/use-vagrant-with-libvirt-unsupported-boxes-12e719d71e8e
 

The interface displays an overview of all your VMs, including their current status, CPU usage, real-time performance graphs for running VMs, and resource usage stats.

If you're new to Virt Manager, you'll find it much like VirtualBox, although there are several key differences – which we'll cover next.

For a solid introduction to virt-manager on Ubuntu Linux, check out this guide: https://www.debugpoint.com/virt-manager/

 

Why choose Virt Manager over VirtualBox?

Benefits
  1. Performance is significantly improved – Virt Manager takes advantage of VirtIO drivers for storage, networking, and graphics, delivering a noticeable speed boost. Virtio drivers are KVM's paravirtualized device drivers, available for Linux and Windows guests on KVM hosts. The virtio package handles block (storage) devices, network interface controllers, and graphics. Because these drivers are open source, they're easy to install even if your Linux distribution doesn't include them by default.
  2. A wider range of configuration options
  3. Integrates smoothly with Vagrant
  4. Certain components of VirtualBox are not entirely open source
  5. Unlike VirtualBox, Virt Manager doesn't require you to recompile modules after a kernel upgrade.
  6. VirtualBox is known to occasionally break after a kernel upgrade is needed.
Drawbacks
  1. VirtualBox arguably has a somewhat gentler learning curve
  2. Configuring host networking instead of NAT is simpler in VirtualBox; however, NAT meets most networking needs easily on both platforms.
  3. VirtualBox runs on many platforms, while Virt Manager is limited to Linux.


Overall, for hosting servers inside a DaDesktop environment, we find Virt Manager to be the better choice.

 

Setting Up

Since libvirt is constantly being developed, you should always use the most recent non-LTS Ubuntu or Debian release.

To install KVM and virt-manager, here are very brief notes – but you should follow a current guide tailored to your chosen DaDesktop OS. One such guide is available at https://www.debugpoint.com/virt-manager/

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

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

 

Configuration

  1. How do I import or convert virtual machines ? Importing or converting virtual machines can be simplified: though you can easily spin up VMs with your desired OS and specs, more complex setups often benefit from importing an existing server or appliance VM. These are frequently distributed as VMDK images, which can be added straight into Virt Manager (though it's not always obvious with the current version). VirtualBox server images can't be directly imported into Virt Manager, but they can be exported to a format like open Virtualisation Format (.OVF) that Virt Manager handles easily. Alternatively, you could use VMware Converter if available, or the Virt-V2V tool (https://www.redhat.com/en/blog/importing-vms-kvm-virt-v2v). Qemu-convert is another excellent open source utility for converting between 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. A new method has been introduced to copy files directly from your local machine into your DaDesktop instance. If that isn't suitable, you could use a cloud storage service like Google Drive or Microsoft 365, then log into the service from within the DaDesktop machine to access your files.

    Otherwise, consider using a Cloud files 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, often you will need to change graphics and / or disk types.  One standout feature of Virt Manager is its excellent VirtIO driver support. These fully virtualized, open-source drivers significantly outperform the default disk, network, or graphics drivers, and they work with almost every operating system, including solid support for Windows 10 guests. Whenever your guest OS is compatible, VirtIO drivers are generally the top choice for both compatibility and speed in Virt Manager (KVM). https://wiki.archlinux.org/title/Libvirt
  4. Optimal settings for virtual machines using Virt Manager Most open source server operating systems ship with VirtIO drivers out of the box, and they're simple to install on Windows. In the majority of cases, virtio drivers give the best results, though other types may work better in specific scenarios. For networking, NAT suffices for most use cases; bridged host networking is only needed for more complex setups and is generally trickier to configure.  
    https://wiki.manjaro.org/index.php?title=Virt-manager offers an excellent starting guide.
    Running Windows requires a few extra steps, including slipstreaming VirtIO drivers so the Windows 10 ISO can boot.
    When picking a disk format, raw files deliver the best speed unless you need snapshots; if snapshots are essential, go with qcow2, though it's marginally slower.
  5. While Wayland performs well as a display manager in many scenarios, we recommend sticking with X11 for the moment. That said, you could experiment with Wayland in your own setup, as distribution support for Wayland keeps improving.
  6. There's little point in enabling KSM – even though it functions in a nested environment and within Virt Manager, it rarely makes a noticeable difference.
  7. If you need assistance converting disk images for Virt Manager or setting up VMs for DaDesktop courses, Tech Support is on hand.
  8. Wondering where disk images are stored on the filesystem? By default, Virt Manager keeps image files in the following directory, though you can configure it to use a different location if you wish.

    /var/lib/libvirt/images