Setting Up Virtual Machines in DaDesktop Using Virt Manager
Introduction
When planning a course, you'll often find it helpful to run a virtualized server inside DaDesktop, and perhaps a couple of client machines too, whether they use the same operating system or a mix of Windows and Linux.
Setting up Nested VMs is possible with either Virt Manager or VirtualBox (with Vagrant as an option on Linux), or just VirtualBox if your DaDesktop machine runs Windows 10.
After thorough testing, we recommend using Virt Manager because VirtualBox has a few bugs in this scenario; so, at present, we advise against using VirtualBox for this purpose.
The VirtManager application leverages the libvirt library for virtual machine management. It offers a graphical interface for creating, removing, and administering multiple VMs. Although it's mainly intended for KVM virtual machines, it also supports other hypervisors like Xen and LXC.
Virt Manager also integrates seamlessly with Vagrant, simply :-
apt install vagrant-libvirt
Keep in mind that there are fewer Vagrant boxes available for libvirt/kvm than for VirtualBox, but they can be easily converted to work with libvirt, as demonstrated here:
https://medium.com/@gamunu/use-vagrant-with-libvirt-unsupported-boxes-12e719d71e8e
The interface shows a summary of all VMs, including their status, CPU usage, a live performance graph for running machines, and resource utilization stats.
If you're new to Virt Manager, it's much like VirtualBox but with a few key differences outlined below.
Here's a good guide for using virt-manager on Ubuntu Linux: https://www.debugpoint.com/virt-manager/
Why Choose Virt Manager over VirtualBox?
Advantages
- Performance is significantly improved because Virt Manager employs VirtIO drivers for storage, networking, and graphics, leading to better speed. Virtio drivers are KVM's paravirtualized device drivers, available for both Linux and Windows guest VMs on KVM hosts. The virtio package supports block (storage) devices, network interface controllers, and graphics. VirtIO drivers are open source, so they're easy to install if not already included with your Linux distribution.
- A wider range of configuration options
- Integrates smoothly with Vagrant
- Certain components of VirtualBox are not completely open source
- Unlike VirtualBox, Virt Manager doesn't require module recompiles after each kernel upgrade.
- VirtualBox occasionally breaks when a new kernel upgrade is necessary.
Disadvantages
- VirtualBox arguably has a somewhat gentler learning curve
- Setting up 'Host networking' (as opposed to NAT) is simpler on VirtualBox, though NAT suffices for most networking scenarios on both systems.
- VirtualBox runs on many platforms, whereas Virt Manager is Linux-only.
Overall, for running servers inside a DaDesktop environment, we find Virt Manager to be the better choice.
Installation
Since libvirt is constantly improving, always opt for the latest non-LTS Ubuntu or Debian version.
Installing KVM and virt-manager: Here are quick notes, but always refer to an up-to-date guide for your chosen DaDesktop OS. One such guide is 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
-
How do I import or convert virtual machines ? Although building VMs to your exact OS and spec is straightforward, for more complex setups it's often easier to import an existing VM configuration for a specific server or appliance. These are frequently provided as VMDK images, which can be attached directly to Virt Manager (though current versions may not make this obvious). VirtualBox server images can't be imported straight into Virt Manager, but they can be exported to other virtualization formats like Open Virtualization Format (.OVF), which Virt Manager handles easily. Alternatively, you can use VmWare Converter if available, or Virt-V2V (https://www.redhat.com/en/blog/importing-vms-kvm-virt-v2v). Qemu-convert is another excellent open source tool for converting between various 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/ -
Best way to import large files inside standalone. Recently, a method for easily uploading files from your local machine into your DaDesktop machine has been introduced.
Otherwise, think about using a cloud storage service like Google Drive or Microsoft 365. You can then log into that service from within the DaDesktop environment to access your files.
- 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 superb support for VirtIO drivers. These open-source, fully virtualized drivers deliver far better performance than standard disk, network, or graphics drivers, and they're available for almost all operating systems, including solid support for Windows 10 guests. If your guest OS supports them, VirtIO drivers are usually the preferred choice for both compatibility and speed with Virt Manager (KVM). https://wiki.archlinux.org/title/Libvirt
-
Optimal settings for virtual machines using Virt Manager VirtIO drivers now ship with nearly all open-source server operating systems and can be quickly installed on Windows. In most cases, virtio drivers are preferable, though sometimes you might need one of the other types. NAT is sufficient for the majority of networking scenarios, unless you need a more complex arrangement like Bridged Host networking—though that can be trickier to set up smoothly.
https://wiki.manjaro.org/index.php?title=Virt-manager is a great starter guide here.
For Windows, you'll need to take a few extra steps, including slipstreaming VirtIO drivers to make the Windows 10 ISO bootable.
When selecting a hard disk format, .raw files offer the best speed unless snapshots are required; in that case, use qcow2, which is a bit slower. - While Wayland serves well as a display manager in most situations, we recommend sticking with X11 for the time being. Still, it could be worth experimenting with Wayland in your specific setup, since distributions are steadily improving Wayland support.
- You can skip using KSM—although it does work in nested environments and within Virt Manager, it hardly makes a practical difference.
- Tech Support is on hand if you need help converting disk images for Virt Manager or setting up Virt Manager for DaDesktop courses.
-
Where are disk image files stored on the filesystem? By default, Virt Manager keeps image files here, but this is configurable and you can use other locations if you wish.
/var/lib/libvirt/images