Page 1 of 1

To KVM or not to KVM

Posted: Fri Dec 20, 2019 1:56 pm
by alamahant
Virtual machines are really cool.
But VirtualBox isnt so much...
Firstly it is proprietary and secondly it is really horribly slow.
But let us not fret because we do have Qemu/KVM available in Linux.
I love KVM because it is blazing fast(almost @bare-metal speeds) but needs a little bit of effort to get it going.
Here's how:
Open a terminal and install the following:

Code: Select all

apt install qemu-kvm libvirt-daemon libvirt-daemon-system virtinst libosinfo-bin bridge-utils virt-manager qemu-system gir1.2-spiceclientgtk-3.0 ovmf ebtables dnsmasq
Then add your user to the libvirt group:

Code: Select all

usermod -aG libvirt <user>
Edit the /etc/libvirt/qemu.conf file and append the following:

Code: Select all

nvram = [
   "/usr/share/OVMF/OVMF_CODE.fd:/usr/share/OVMF/OVMF_VARS.fd"
]
...to enable uefi boot.
Make sure the appropriate module is loaded @boot:

Code: Select all

echo vhost_net >> /etc/modules
If you need nat networking please start the default network:

Code: Select all

virsh net-start default ###and 
virsh net-autostart default ###if you need it enabled @boot
You will need to create a bridge interface to use with
vms if you need them to share your host network.
It is easy to create one via the network-manager cli or nmcli thus:

Code: Select all

echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.d/99-sysctl.conf ###Enable -ip forwarding needed for bridging
sysctl -p /etc/sysctl.d/99-sysctl.conf ###apply it immediately
nmcli con add type bridge con-name br0 ifname br0 ip4  <your-desired-ip/your-network-netmask> gw4 <your-router-ip>
nmcli con mod br0 ipv4.dns <your-dns-server-ip> ipv4.method manual
nmcli con add type bridge-slave con-name br0-slave1 ifname <your-primary-eth-interface(eth0 or eth1)> master br0
nmcli con del "Wired connection 1"###and if needed 2 to delegate the network only to the bridge
WARNING:Do the above only if you have an ethernet(wired) interface,but NOT if you only have wifi, as wifi is not an ideal candidate for bridging
Start and enable libvirt service

Code: Select all

systemctl enable --now libvirtd ###OR if in sysvinit
update-rc.d libvirtd enable && service libvirtd start
Then reboot and the bridge should be up and running.
You can assign the bridge interface to guests in Virtual Manager UI by:
Pressing the "NIC xxxx" tab of the VM-->
"Specify shared device name"-->
and choosing "br0"
instead of the "default NAT" interface.

Thats it!!!
Now you can use Virtual Manager and have fun with VM-ing around.
Here is a link to Virtual Manager page https://virt-manager.org


ADDENDUM: THINLY-PROVISIONED DISKS
One drawback of kvm is that it assigns all disk space at once to the VM disks that it creates whether your VM will be using it or not.
Thus it is heavy on disk space consumption.
Fortunately there is a workaround.
Create a directory where you wish to store your KVM disks ---for example ~/kvm-disks:

Code: Select all

mkdir ~/kvm-disks && cd ~/kvm-disks
Open a terminal and install the following:

Code: Select all

 sudo apt install libguestfs-tools
Then enter the following:

Code: Select all

sudo qemu-img create -f qcow2 10g-template.qcow2 10G ###Create a 10G disk template
 sudo virt-sparsify -q  10g-template.qcow2 10g-template.thin.qcow2 ###Create the thinly-provisioned disk..Please wait for the command to complete--it might take some time.
sudo rm 10g-template.qcow2 ###Delete the original disk, keeping only the thinly-provisioned disk.
Likewise you might wish to create 10G 20G 60G etc disk templates to have them ready to use when creating VMs.
Take care to assign the correct sizes and names to the above commands accordingly.
Then before creating a new VM just go to ~/kvm-disks and COPY and PASTE the desired size disk, renaming it to the VM name you wish to create.(Take care not to delete the ".qcow2" extension) .
And in Virtual Manager do NOT create a NEW disk but IMPORT the one you already created.
Then after you finished creating disk templates according to your needs you might wish to remove the "libguestfs-tools".Its up to you.
Thats it!

ADDENDUM: GPU-PASSTHROUGH
Sometimes it is useful to "pass" a video graphics card for example nvidia from the host to the guest.This is particularly useful if one needs to run graphics-demanding apps and games on the guest.It is easy to do so in KVM.
This is HOW:
NOTE:Although I have tested and used this in my own MX and it seems to be functioning normally I BEAR NO RESPONSIBILITY in case of unstable or unresponsive system after applying these steps.PLEASE PROCEED AT YOUR OWN RISK!!!
YOU NEED TO HAVE AN EXTRA GRAPHICS CARD YOU CAN AFFORD TO PASS TO THE GUEST.
As an extra layer of caution we enable the REISUB functionality:

Code: Select all

echo "kernel.sysrq = 1" >> /etc/sysctl.d/99-sysctl.conf
sysctl -p /etc/sysctl.d/99-sysctl.conf
In this way if our machine freezes or becomes unstable while applying these steps we simply PRESS and HOLD Right-ALT+PRT SC and type "reisub".This will unfreeze and reboot the system.
First EDIT your "/etc/default/grub" file and in the line GRUB_CMDLINE_LINUX="" append:

Code: Select all

GRUB_CMDLINE_LINUX="..... intel_iommu=on" ###For Intel processors OR
GRUB_CMDLINE_LINUX="..... amd_iommu=on" ###For AMD processors 
Then run "sudo update-grub" to apply the changes.
Now run
lspci -nn | grep -i nvidia
to get your nvidia card's id,something like the following:

Code: Select all

root@mx:~# lspci -nn | grep -i nvidia
01:00.0 3D controller [0302]: NVIDIA Corporation GM107M [GeForce 845M] [10de:1398] (rev a2)
In my case the nvidia card id will be "10de:1398"
Now create a file
/etc/modprobe.d/vfio.conf
with the lines:

Code: Select all

options vfio-pci ids=10de:1398 ###SUBSTITUTE your own id.In case your nvidia card has an audio capability you might get an additional id and in that case seperate them with comma.
Make sure to load the appropriate kernel module @boot:

Code: Select all

echo 'vfio-pci' > /etc/modules-load.d/vfio-pci.conf#####IN CASE OF SYSTEMD
echo 'vfio-pci' >> /etc/modules#####IN CASE OF SYSVINIT
Now REBOOT your machine.
If everything went smoothly you will have now a functioning IOMMU.
Verify this:

Code: Select all

dmesg | grep -E "DMAR|IOMMU"
dmesg | grep -i vfio
IF YOU DONT SEE ANY ERRORS please continue with Virtual Manager
IMPORTANT THIS ONLY WORKS WITH VMs SET TO BOOT WITH UEFI.
Open your Virtual Manager and press the "Add Harware"--> "PCI Host Device"
Choose your graphics card.APPLY the changes and start your VM.
HOPEFULLY your guest will boot with no problem.
Once in the guest open a terminal and verify that everything worked as expected:

Code: Select all

lspci | grep -i nvidia
You should now be able to see your host NVIDIA card appearing in your guest.
NOTE:Not only can you pass your graphics card this way but also USB devices,disks and maybe even your wireless network card.


Thats it !!!
Congrats
;) ;) ;)

Re: To KVM or not to KVM

Posted: Sat Dec 21, 2019 4:30 am
by JayM
Off-topic: I'm old so I always think of KVM as meaning the switch, Keyboard/Video/Mouse, so you can use the same keyboard, monitor and mouse to control several different computers. Likewise PS2 to me means the old IBM 286 and 386 PCs with an MCA bus.

(I know, I know. "OK, boomer.") :happy:

Re: To KVM or not to KVM

Posted: Sat Dec 21, 2019 5:17 am
by jeffreyC
JayM wrote: Sat Dec 21, 2019 4:30 am Off-topic: I'm old so I always think of KVM as meaning the switch, Keyboard/Video/Mouse, so you can use the same keyboard, monitor and mouse to control several different computers.

(I know, I know. "OK, boomer.") :happy:
Don't feel so bad JayM, that was my first thought too. :bagoverhead:

Re: To KVM or not to KVM

Posted: Sat Dec 21, 2019 6:31 am
by gosia
This is a great manual, I have been looking for something like this for a long time. Thank you very much. But I have a problem, I cannot find the gir1.2-spiceclientgtk package. Why? Is a repo missing?

Code: Select all

System:    Host: mexiko.fritz.lokal Kernel: 4.19.0-1-amd64 x86_64 (64 bit gcc: 6.3.0)
           Desktop: Openbox 3.6.1
           Distro: MX-18.3_x64 Continuum March 14, 2018
Machine:   Device: laptop System: Packard Bell product: EasyNote TE11HC v: V1.07
           Mobo: Packard Bell model: EG50_HC_CR v: Type2 - Board Version
           UEFI [Legacy]: Packard Bell v: V1.07 date: 05/11/2012
Repos:     Active apt sources in file: /etc/apt/sources.list.d/antix.list
           deb http://mirror.plusserver.com/mxlinux/mxlinux/antix/stretch/ stretch main
           Active apt sources in file: /etc/apt/sources.list.d/debian-stable-updates.list
           deb http://ftp.de.debian.org/debian/ stretch-updates main contrib non-free
           Active apt sources in file: /etc/apt/sources.list.d/debian.list
           deb http://ftp.de.debian.org/debian/ stretch main contrib non-free
           deb http://security.debian.org/ stretch/updates main contrib non-free
           Active apt sources in file: /etc/apt/sources.list.d/mx.list

Re: To KVM or not to KVM

Posted: Sat Dec 21, 2019 7:15 am
by Head_on_a_Stick
gosia wrote: Sat Dec 21, 2019 6:31 am I cannot find the gir1.2-spiceclientgtk package. Why?
I think the package is actually called gir1.2-spiceclientgtk-3.0, try that instead. EDIT: no, sorry, that's for MX-19.

@OP: great guide, thanks! I like to use gnome-boxes as a VB replacement, that supports KVM & SPICE OOTB.

Re: To KVM or not to KVM

Posted: Sat Dec 21, 2019 7:53 am
by alamahant
@gosia @all
You are right mate.
the package name is actually

Code: Select all

gir1.2-spiceclientgtk-3.0
Mea culpa.Please forgive me.I have rectified the error.
Now this package name is in MX-19.
I suppose it will be the same in other versions also.
But just to err on the side of caution please run:

Code: Select all

apt search spiceclientgtk
and install the package according to the output....
;) ;)

Re: To KVM or not to KVM

Posted: Sat Dec 21, 2019 7:58 am
by Head_on_a_Stick
alamahant wrote: Sat Dec 21, 2019 7:53 am Now this package name is in MX-19.
I suppose it will be the same in other versions also.
No, there is no gir1.2-spiceclientgtk package in Debian stretch.[1] The Debian wiki page about KVM suggests that it may not be needed: https://wiki.debian.org/KVM

Re: To KVM or not to KVM

Posted: Sat Dec 21, 2019 9:04 am
by Buck Fankers
@alamahant forgive me for this hijack question, you made a good tutorial, but gnome-boxes got me intrigued...

OT - Quick hijack question, hope it is OK
Head_on_a_Stick wrote: Sat Dec 21, 2019 7:15 am gnome-boxes as a VB replacement, that supports KVM & SPICE OOTB.
@HoaS I checked few videos about gnome-boxes, and got really interested, I like simplicity and it's speed.

To install it in MX19 is this bellow all I need? Any other library? Such as: gir1.2-libvirt-sanbox-1.0? ...
  • gnome-boxes
    qemu-kvm

Then I need to add user to kvm, correct?

Code: Select all

sudo usermod -a -G kvm $USER
Inside gnome-boxes vm I need to install spice tools (for guest additions), correct? These two bellow or anything else?
  • spice-vdagent
    spice-webdavd

Re: To KVM or not to KVM

Posted: Sat Dec 21, 2019 9:10 am
by Head_on_a_Stick
@{Buck Fankers}: yes, that's right. Just gnome-boxes and the spice packages should do it. MX-19 already has the spice-vdagent package (and I recently requested that they add spice-webdavd).

Re: To KVM or not to KVM

Posted: Sat Dec 21, 2019 9:13 am
by Paul..
Overall, what is the compatibility with .vbox files? Can KVM or gnome-boxes read them, or is there a significant conversion process required?

Re: To KVM or not to KVM

Posted: Sat Dec 21, 2019 9:20 am
by Head_on_a_Stick
Paul.. wrote: Sat Dec 21, 2019 9:13 am Overall, what is the compatibility with .vbox files? Can KVM or gnome-boxes read them, or is there a significant conversion process required?
The qemu-img command should be able to convert disk images between various formats:

https://docs.openstack.org/image-guide/ ... mages.html

Re: To KVM or not to KVM

Posted: Sat Dec 21, 2019 9:28 am
by alamahant
Buck Fankers
Yes that is correct.
""usermod -aG libvirt $USER"
This I think allows the non root user to use Virtual Manager from the desktop icon and connect to libvirt.
BUT you can also run it from a terminal like this
"sudo virt-manager"
In KVM you do NOT need to explicitly add any packages on the guests.It works out of the box.
I am unaware if this is the case also in gnome-boxes.

Re: To KVM or not to KVM

Posted: Sat Dec 21, 2019 9:34 am
by Head_on_a_Stick
alamahant wrote: Sat Dec 21, 2019 9:28 am In KVM you do NOT need to explicitly add any packages on the guests.It works out of the box.
I am unaware if this is the case also in gnome-boxes.
For gnome-boxes guests the spice-vdagent package is needed for shared clipboards and automatic resizing of the guest desktop to fit the display window and spice-webdavd is needed for shared folders.

Re: To KVM or not to KVM

Posted: Sat Dec 21, 2019 9:35 am
by alamahant
Buck Fankers
Yes that is correct.
""usermod -aG libvirt $USER"
This I think allows the non root user to use Virtual Manager from the desktop icon and connect to libvirt.
BUT you can also run it from a terminal like this
"sudo virt-manager"
In Virtual Manager you do NOT need to explicitly add any packages on the guests.It works out of the box.
I am unaware if this is the case also in gnome-boxes.

Re: To KVM or not to KVM

Posted: Sat Dec 21, 2019 9:42 am
by Buck Fankers
Head_on_a_Stick wrote: Sat Dec 21, 2019 9:10 am @{Buck Fankers}: yes, that's right. Just gnome-boxes and the spice packages should do it. MX-19 already has the spice-vdagent package (and I recently requested that they add spice-webdavd).
Thanks, will give it a try!

Re: To KVM or not to KVM

Posted: Sat Dec 21, 2019 9:44 am
by Buck Fankers
alamahant wrote: Sat Dec 21, 2019 9:35 am Buck Fankers
Yes that is correct.
""usermod -aG libvirt $USER"
This I think allows the non root user to use Virtual Manager from the desktop icon and connect to libvirt.
BUT you can also run it from a terminal like this
"sudo virt-manager"
In Virtual Manager you do NOT need to explicitly add any packages on the guests.It works out of the box.
I am unaware if this is the case also in gnome-boxes.
Thank you for all the info!

Re: To KVM or not to KVM

Posted: Sat Dec 21, 2019 9:48 am
by alamahant
Paul..
You need to transform VirtualBox disks to KVM format.
I think you have to use the "vboxmanage" command..

Re: To KVM or not to KVM

Posted: Sat Dec 21, 2019 10:07 am
by gosia
Head_on_a_Stick wrote: Sat Dec 21, 2019 7:15 am I think the package is actually called gir1.2-spiceclientgtk-3.0
Ah, now I've found a package gir1.2-spice-client-gtk-3.0

Re: To KVM or not to KVM

Posted: Mon Jan 20, 2020 3:57 am
by grelos
I'd like to ditch Virtualbox and start enjoying KVM but I am facing some issues even for creating my first VM.

I get this error:

Code: Select all

could not start virtual network 'default': internal error: Failed to initialize a valid firewall backend

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/netlist.py", line 361, in validate_network
    netobj.start()
  File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 83, in newfn
    ret = fn(self, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/network.py", line 81, in start
    self._backend.create()
  File "/usr/lib/python2.7/dist-packages/libvirt.py", line 2832, in create
    if ret == -1: raise libvirtError ('virNetworkCreate() failed', net=self)
libvirtError: internal error: Failed to initialize a valid firewall backend
I did a search on the web and found that some fixed it disabling ipv6 but I am not sure it is my case.
My pc is connected with wifi, not ethernet.

Re: To KVM or not to KVM

Posted: Mon Jan 20, 2020 4:09 am
by JayM

Re: To KVM or not to KVM

Posted: Mon Jan 20, 2020 6:02 am
by grelos
I was able to fix it installing additional packages which are in the repo,

Code: Select all

ebtables 
dnsmasq 
then enabling services with

Code: Select all

sudo service ebtables start
sudo service dnsmasq start
sudo service libvirtd restart
I found the solution here:

https://superuser.com/questions/1063240 ... ll-backend


Then I have got other errors vomited by Virt-Manager (basically I have got an error prompt at each step), but I was able to fix them all:

I had to install additional packages to display the VM:
https://www.linuxsecrets.com/discussion ... tk-missing

And also establish auto start of network after rebooting my computer:

https://blog.programster.org/kvm-missin ... lt-network

The only thing I could not fix is to use a different location (partition) for the VM storage, I guess it was a permission problem even if username was in kvm group: when changing storage location to the default one, the problem was gone.

Re: To KVM or not to KVM

Posted: Sun Feb 02, 2020 2:14 pm
by anothernqs
Great post, thank you so much!
I only found one small snag, and I managed to get around it:
alamahant wrote: Fri Dec 20, 2019 1:56 pm

Code: Select all

virsh net-start default ###and 
net-autostart default ###if you need it enabled @boot
Doesn't work for newbies like me who are copy-pasting this whole thing. Replace it with this:

Code: Select all

virsh net-start default ###and 
virsh net-autostart default ###if you need it enabled @boot

Re: To KVM or not to KVM

Posted: Sun Feb 02, 2020 3:29 pm
by anothernqs
And another thing:
The NAT bridge of your guide is the thing that made me finally choose MX for my main workstation. You see, I need to print to a network printer from the virtual machine and I couldn't set it up with some other distros/guides. With this, everything just works. Thank you!

Re: To KVM or not to KVM

Posted: Thu Feb 13, 2020 9:15 am
by grelos
Now I have a problem with the size of the guest screen. It is basically smaller than the available space on host system display.
The problem is that the option "Auto resize VM with window" is greyed out.
I thought was a SPICE problem so I followed this documentation:

https://www.linux-kvm.org/page/SPICE

but still I have this problem.

Re: To KVM or not to KVM

Posted: Wed Mar 04, 2020 2:10 pm
by alamahant
Hi Guys,
Sorry for the belated response but I was away.
@ anothernqs Tthanks mate for pointing out the error.I have corrected it.
@ grelos You should try to change the screen resolution from the DE settings.
Yes you are right about dnsmasq.You need it installed but not necessarily running(the presence of the binary is sufficient).I think same goes for ebtables.Its about bridges.I am adding the dnsmask to the list of the requirements.Thanks for the advice.As for ebtables and spiceclient I had them already included in the list of required packages.Using wifi will NOT affect kvm NAT networking.However if you want to create a bridge you WILL need ethernet unless you do some kind of super duper configuration the same way VirtualBox and Vmware allow you to use bridge networking even if your primary iface is wifi.
:)

Re: To KVM or not to KVM

Posted: Fri Aug 07, 2020 5:43 am
by snowcrash333
Hi

I was planning to dual boot MX Linux with Win 10, but this solution would be far better.

Dumb question: my pc (intel i5 kaby lake) has integrated graphics. Would I add just one GPU card and run Win OS off that? And MX Linux continues to use the integrated graphics?

Thanks

Re: To KVM or not to KVM

Posted: Thu Aug 27, 2020 6:27 pm
by Moltke
One drawback of kvm is that it assigns all disk space at once to the VM disks that it creates whether your VM will be using it or not.
Thus it is heavy on disk space consumption.
Not entirely true. QEMU/KVM disk images will use the space as needed not before. So, if you create a 10G qcow2 disk and after install an OS it only uses 5G that will be the physical size not the whole 10G, you can confirm that by using the qemu-img command

Code: Select all

qemu-img info /path/to/VM_name.qcow2

For example Image
grelos wrote: Thu Feb 13, 2020 9:15 am Now I have a problem with the size of the guest screen. It is basically smaller than the available space on host system display.
The problem is that the option "Auto resize VM with window" is greyed out.
I thought was a SPICE problem so I followed this documentation:

https://www.linux-kvm.org/page/SPICE

but still I have this problem.
I haven't used virt-manager in a while and not sure but I think the virtio driver must be used so resize VM window works. Also, managing VMs from the command line at a basic level is easier, I think. You can install qemu-kvm, cd to the dir you keep your iso files, create a qcow2 disk, e,g

Code: Select all

qemu-img create VM_name.qcow2 10G
then start the VM

Code: Select all

kvm -machine pc -cdrom some_file.iso -boot d -hda VM_name.qcow2 -m RAM_SIZE -vga virtio -soundhw hda
there are a lot of more options but these will create and start a VM quite easily. This is a very nice, complete and instructional reading for learning more about virtualization not only on qemu-kvm but others like LXC and XEN too https://doc.opensuse.org/documentation/ ... lor_en.pdf

EDIT: I found this on resizing VM window https://html.developreference.com/artic ... ot+working

Re: To KVM or not to KVM

Posted: Tue Sep 01, 2020 9:22 am
by srq2625
alamahant wrote: Fri Dec 20, 2019 1:56 pm Virtual machines are really cool.
But VirtualBox isnt so much...
Firstly it is proprietary and secondly it is really horribly slow.
But let us not fret because we do have Qemu/KVM available in Linux.
I love KVM because it is blazing fast(almost @bare-metal speeds) but needs a little bit of effort to get it going.
I've been seeing references to KVM here and there for a while. I looked into it a couple of times, but could not get it working so was stuck using VirtualBox and thinking it was good enough.

Then I saw this post with a quick step-by-step and thought, "Well, why not give it a go?" So I did.

Be warned - the following is anecdotal.

First, this is the host:

Code: Select all

System:    Host: <filter> Kernel: 5.6.0-2-amd64 x86_64 bits: 64 compiler: gcc v: 8.3.0 
           parameters: BOOT_IMAGE=/boot/vmlinuz-5.6.0-2-amd64 root=UUID=<filter> ro quiet 
           splash 
           Desktop: KDE Plasma 5.14.5 wm: kwin_x11 dm: SDDM Distro: MX-19.2_KDE_x64 patito feo August 16  2020 
           base: Debian GNU/Linux 10 (buster) 
Machine:   Type: Desktop Mobo: ASUSTeK model: PRIME B450-PLUS v: Rev X.0x serial: <filter> UEFI: American Megatrends 
           v: 2008 date: 12/06/2019 
Battery:   Device-1: hidpp_battery_0 model: Logitech Marathon Mouse/Performance Plus M705 serial: <filter> 
           charge: 55% (should be ignored) rechargeable: yes status: Discharging 
CPU:       Topology: 8-Core model: AMD Ryzen 7 2700 bits: 64 type: MT MCP arch: Zen+ family: 17 (23) model-id: 8 
           stepping: 2 microcode: 800820D L2 cache: 4096 KiB 
           flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm bogomips: 108794 
           Speed: 1373 MHz min/max: 1550/3400 MHz boost: disabled Core speeds (MHz): 1: 1373 2: 1380 3: 1368 4: 1362 
           5: 2247 6: 1364 7: 1363 8: 1368 9: 1376 10: 1369 11: 2223 12: 1373 13: 1371 14: 1367 15: 1377 16: 1464 
           Vulnerabilities: Type: itlb_multihit status: Not affected 
           Type: l1tf status: Not affected 
           Type: mds status: Not affected 
           Type: meltdown status: Not affected 
           Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via prctl and seccomp 
           Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer sanitization 
           Type: spectre_v2 mitigation: Full AMD retpoline, IBPB: conditional, STIBP: disabled, RSB filling 
           Type: srbds status: Not affected 
           Type: tsx_async_abort status: Not affected 
Graphics:  Device-1: NVIDIA GF106 [GeForce GTS 450] driver: nvidia v: 390.138 bus ID: 08:00.0 chip ID: 10de:0dc4 
           Display: x11 server: X.Org 1.20.4 driver: nvidia unloaded: fbdev,modesetting,nouveau,vesa alternate: nv 
           compositor: kwin_x11 resolution: 1600x1200~60Hz, 1600x1200~60Hz 
           OpenGL: renderer: GeForce GTS 450/PCIe/SSE2 v: 4.6.0 NVIDIA 390.138 direct render: Yes 
Audio:     Device-1: NVIDIA GF106 High Definition Audio driver: snd_hda_intel v: kernel bus ID: 08:00.1 
           chip ID: 10de:0be9 
           Device-2: Advanced Micro Devices [AMD] Family 17h HD Audio vendor: ASUSTeK driver: snd_hda_intel v: kernel 
           bus ID: 0a:00.3 chip ID: 1022:1457 
           Sound Server: ALSA v: k5.6.0-2-amd64 
Network:   Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: ASUSTeK driver: r8169 v: kernel 
           port: f000 bus ID: 03:00.0 chip ID: 10ec:8168 
           IF: eth0 state: up speed: 100 Mbps duplex: full mac: <filter> 
           IF-ID-1: br0 state: up speed: 100 Mbps duplex: unknown mac: <filter> 
           IF-ID-2: virbr0 state: down mac: <filter> 
           IF-ID-3: virbr0-nic state: down mac: <filter> 
Drives:    Local Storage: total: 447.13 GiB used: 32.46 GiB (7.3%) 
           ID-1: /dev/sda vendor: PNY model: CS900 480GB SSD size: 447.13 GiB block size: physical: 512 B 
           logical: 512 B speed: 6.0 Gb/s serial: <filter> rev: 06B3 scheme: GPT 
Partition: ID-1: / raw size: 30.00 GiB size: 29.40 GiB (98.01%) used: 8.75 GiB (29.8%) fs: ext4 dev: /dev/sda3 
           ID-2: /home raw size: 412.88 GiB size: 405.40 GiB (98.19%) used: 23.30 GiB (5.7%) fs: ext4 dev: /dev/sda4 
           ID-3: swap-1 size: 4.00 GiB used: 0 KiB (0.0%) fs: swap swappiness: 15 (default 60) 
           cache pressure: 100 (default) dev: /dev/sda2 
Sensors:   System Temperatures: cpu: 30.8 C mobo: N/A gpu: nvidia temp: 41 C 
           Fan Speeds (RPM): N/A gpu: nvidia fan: 30% 
Repos:     No active apt repos in: /etc/apt/sources.list 
           Active apt repos in: /etc/apt/sources.list.d/brave-browser-release.list 
           1: deb [arch=amd64] https://brave-browser-apt-release.s3.brave.com/ buster main
           Active apt repos in: /etc/apt/sources.list.d/debian-stable-updates.list 
           1: deb http://deb.debian.org/debian buster-updates main contrib non-free
           Active apt repos in: /etc/apt/sources.list.d/debian.list 
           1: deb http://deb.debian.org/debian buster main contrib non-free
           2: deb http://deb.debian.org/debian-security buster/updates main contrib non-free
           Active apt repos in: /etc/apt/sources.list.d/mx.list 
           1: deb https://mirror.vcu.edu/pub/gnu_linux/mxlinux/mx/repo/ buster main non-free
           2: deb https://mirror.vcu.edu/pub/gnu_linux/mxlinux/mx/repo/ buster ahs
           No active apt repos in: /etc/apt/sources.list.d/various.list 
Info:      Processes: 327 Uptime: 23m Memory: 15.64 GiB used: 1.51 GiB (9.7%) Init: SysVinit v: 2.93 runlevel: 5 
           default: 5 Compilers: gcc: 8.3.0 alt: 8 Shell: quick-system-in running in: quick-system-in inxi: 3.0.36 
As you can see, it's no slouch.

So, I go through the steps outlines in the OP and, wonder of wonders, I get it working. This is a testament to the fact that the OP was written such that I could understand it and says very little about my skills - of which there are few.

One thing that I did find missing from the guide was in the list of packages needed to be installed. Turns out I had to install qemu-utils. Don't know why, just that I got an error message when I attempted to boot a guest, the error message indicating that this was missing. Installed that package and things went much better after that.

TL;DR

I created a KVM guest using the latesteed SolydK .iso (wanting something similar to MX Linux KDE, but different) and did a few simple tests. The most telling of which was to load and play a YouTube video. All kinds of screen tearing, video and audio stutter - making it almost unwatchable.

Then, I installed the VirtualBox packages from the MX Package Installer (the Test repo) and created a VB guest using the same .iso. Then ran the same tests. The YouTub video ran well, very little stutter of either the video or the audio. Quite nice.

This, of course, doesn't address one of the OP's concerns - the fact that VirtualBox is no FOSS.

Finally - I understand that not every problem is a nail and that commonly one needs to acquire a different tool to handle a situation. Additionally, there's every good chance that I did something not quite right. In that spirit, I would love to learn how to make the KVM experience better.