To KVM or not to KVM

Here is where you can post tips and tricks to share with other users of MX. Do not ask for help in this Forum.
Message
Author
grelos
Posts: 76
Joined: Wed Mar 28, 2018 3:12 pm

Re: To KVM or not to KVM

#21 Post 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.
MX-19 on Lenovo 520-15IKB

anothernqs

Re: To KVM or not to KVM

#22 Post 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

anothernqs

Re: To KVM or not to KVM

#23 Post 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!

grelos
Posts: 76
Joined: Wed Mar 28, 2018 3:12 pm

Re: To KVM or not to KVM

#24 Post 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.
MX-19 on Lenovo 520-15IKB

alamahant
Posts: 42
Joined: Thu Dec 19, 2019 9:48 pm

Re: To KVM or not to KVM

#25 Post 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.
:)

snowcrash333
Posts: 31
Joined: Sat Jul 25, 2020 10:10 am

Re: To KVM or not to KVM

#26 Post 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
MX-19.4 AHS
Intel Core i5-7500 (Kaby Lake) | Asus H270-Plus | 16gb DDR4 HyperX Fury
Samsung 960 EVO 500GB NVME SSD | 2TB HDD

User avatar
Moltke
Posts: 229
Joined: Tue Dec 19, 2017 5:07 pm

Re: To KVM or not to KVM

#27 Post 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
Without each other's help there ain't no hope for us :happy:

User avatar
srq2625
Posts: 188
Joined: Mon Jan 21, 2019 9:40 am

Re: To KVM or not to KVM

#28 Post 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.
AsusTek PRIME B450-Plus
AMD Ryzen 7 2700 (8-Core, 16 threads)
Radeon HD 6570/7570/8550 / R5 230
Realtek RTL8111/8168/8411 - driver: r8169
Samsung SSD 860 EVO 500GB
DDR4 3200MHz CL16 2x8GB

Post Reply

Return to “Tips & Tricks by users”