Creating VMs within DaDesktop using Virt Manager
Introduction
Often when preparing a course, it's useful to virtualize a server within DaDesktop, and perhaps virtualize one or two client machines too in the same way, either using the same OS or a Windows/Linux mix.
Running 'Nested VMs' can be done either using Virt Manager or VirtualBox with vagrant optionally when using Linux, or VirtualBox if using Windows 10 as the DaDesktop machine.
After extensive testing, our suggested preference is to use Virt Manager, as there are a couple of bugs if using VirtualBox; therefore, currently, we do not recommend using VirtualBox in this manner.
The VirtManager application uses the libvirt library to provide virtual machine management services. It has a desktop interface that helps to create, delete, and manage multiple virtual machines. It is primarily used for KVM VMs but can support other hypervisors as well, 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 compared to VirtualBox, but these 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 provides a summary view of all VMs, their status, CPU usage, 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 decent guide concerning using virt-manager on Ubuntu Linux - https://www.debugpoint.com/virt-manager/
Why should I use Virt Manager instead of VirtualBox?
Advantages
- Performance is much better — Virt Manager uses VirtIO drivers for storage, networking, and graphics, providing much better performance. Virtio drivers are KVM's paravirtualized device drivers, available for Linux and Windows guest virtual machines running on KVM hosts. The virtio package supports block (storage) devices and network interface controllers, and graphics. VirtIO drivers are open source so easily installed if not already pre-installed on your Linux distro.
- More configurability options available
- Works well with Vagrant
- Some parts of VirtualBox are not fully open source
- Virt Manager does not require module recompiles whenever a new kernel upgrade is made, as is the case for VirtualBox.
- VirtualBox is sometimes known to break when a new kernel upgrade is required.
Disadvantages
- VirtualBox may be said to have a slightly shorter learning curve
- Setting up 'Host networking' rather than NAT is easier on VirtualBox; however, NAT works for most networking use cases quite easily on both systems.
- VirtualBox is available on many platforms; however, Virt Manager is only available on Linux
All in all, we find that for running servers within a DaDesktop machine, Virt Manager is preferred.
Installation
Because libvirt is improving all the time, always use the latest non LTS Ubuntu or Debian version.
Installation of KVM and virt-manager. These are very brief installation notes; however, please follow an up-to-date guide for your preferred 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
-
How do I import or convert virtual machines? Although it's easy to create VMs tailored to your operating system and specification needs, for more complicated setups it's often preferable to import an existing VM setup of a particular server or appliance. These are often supplied as VMDK images, which can be added directly to Virt Manager, although it's not clear that this is indeed possible with the current version. VirtualBox server images cannot be imported (added) directly to Virt Manager, but can be easily exported into other virtualization formats such as Open Virtualization Format (.OVF), which Virt Manager can import easily. Otherwise you could use VMware Converter if you have it, or Virt-V2V instead https://www.redhat.com/en/blog/importing-vms-kvm-virt-v2v. Qemu-convert is also a great open source tool that allows easy conversion between different 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/ -
Best way to import large files into a standalone instance. Recently, a method to easily upload files from your machine into your DaDesktop machine has been added.
Otherwise, consider using a cloud file storage tool such as Google Drive, Microsoft 365, etc. These can then be accessed by logging into the tool inside the DaDesktop machine.
- When importing other virtual machines, especially from other formats, you will often need to change the graphics and/or disk types. One of the best things about Virt Manager is that it includes really great support for VirtIO drivers. These are open source fully virtualized drivers that provide much better performance compared to original disk, network or graphic drivers, and are available for nearly all operating systems, including excellent support for Windows 10 guest machines. If your guest OS supports them, these are usually the best option for compatibility and performance when using Virt Manager (KVM). https://wiki.archlinux.org/title/Libvirt
-
Optimal settings for virtual machines using Virt Manager VirtIO drivers are included in almost all open-source server operating systems these days, and can be easily installed in Windows. In general, the best drivers are virtio, but in some cases you may need to use one of the many other types. NAT is generally sufficient for most networking scenarios unless you require a more complicated setup where bridged host networking may be needed; however, this is generally more tricky to get working easily.
https://wiki.manjaro.org/index.php?title=Virt-manager is a great starter guide.
Running Windows requires some extra steps and will require slipstreaming VirtIO drivers to allow the Windows 10 ISO to boot.
When choosing the hard disk format, for speed, .raw files are best unless snapshots are required; if so, use qcow2 format, though it is a little slower. - Although Wayland works well as a display manager in most cases, we advise you to continue using X11 for now. That said, it may be worth trying Wayland in your own particular setup, as distros are getting better support for Wayland all the time.
- Don’t bother using KSM, as although it works nested and in Virt Manager, it makes little difference in practice.
- Tech Support is available if required when converting disk images to work with Virt Manager, and additionally setting up using Virt Manager for DaDesktop courses.
-
Where are disk image files located within the filesystem? Virt Manager stores image files in the following location; however, this is configurable, and other locations can be used if preferred.
/var/lib/libvirt/images
