swh
#1
hello, i have a problem adding an image in qemu
I have installed everything according to this instructions.
as soon as i want to add an image in qemu, i get the following error message
Warning. KVM is not available. The KVM package may not be installed or the KVM kernel modules may not be loaded.
it looks like this

systemctl status libvirtd.service
$ systemctl status libvirtd.service
● libvirtd.service - Virtualization daemon
Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2022-06-24 15:18:07 CEST; 58s ago
TriggeredBy: ● libvirtd-ro.socket
● libvirtd-admin.socket
● libvirtd.socket
Docs: man:libvirtd(8)
https://libvirt.org
Main PID: 629 (libvirtd)
Tasks: 21 (limit: 32768)
Memory: 33.2M
CPU: 194ms
CGroup: /system.slice/libvirtd.service
├─629 /usr/bin/libvirtd --timeout 120
├─815 /usr/bin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-s>
└─816 /usr/bin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-s>
Jun 24 15:18:08 ryzen dnsmasq[815]: reading /etc/resolv.conf
Jun 24 15:18:08 ryzen dnsmasq[815]: using nameserver 192.168.2.1#53
Jun 24 15:18:08 ryzen dnsmasq[815]: read /etc/hosts - 5 addresses
Jun 24 15:18:08 ryzen dnsmasq[815]: read /var/lib/libvirt/dnsmasq/default.addnhosts - 0 addresses
Jun 24 15:18:08 ryzen dnsmasq-dhcp[815]: read /var/lib/libvirt/dnsmasq/default.hostsfile
Jun 24 15:18:08 ryzen libvirtd[629]: libvirt version: 8.4.0
Jun 24 15:18:08 ryzen libvirtd[629]: hostname: ryzen
Jun 24 15:18:08 ryzen libvirtd[629]: Kann /dev/kvm nicht öffnen: Datei oder Verzeichnis nicht gefunden
Jun 24 15:18:10 ryzen dnsmasq[815]: reading /etc/resolv.conf
Jun 24 15:18:10 ryzen dnsmasq[815]: using nameserver 192.168.2.1#53
i do not understand this error.
Cannot open /dev/kvm: File or directory not found
how can i solve this?
Thanks in advance!
I0F
#2
Did you check if your CPU supports KVM (see the arch wiki)?
If yes, you may need to activate it inside the bios.
1 Like
swh
#3
yes it does
LC_ALL=C.UTF-8 lscpu | grep Virtualization
Virtualization: AMD-V
I0F
#4
Is it activated inside the BIOS?
If yes, see the next chapter on the arch wiki and check if the modules are loaded. If not, load them yourself via modprobe.
edit:
should be
sudo modprobe kvm_amd
swh
#5
yes it is.
which module do i have to load? I’m sorry for stupid questions. I don’t do this every day. So to speak the first time that I handle qemu
uname -r
5.18.6-zen1-1-zen
zgrep CONFIG_KVM /proc/config.gz
CONFIG_KVM_GUEST=y
CONFIG_KVM_MMIO=y
CONFIG_KVM_ASYNC_PF=y
CONFIG_KVM_VFIO=y
CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT=y
CONFIG_KVM_COMPAT=y
CONFIG_KVM_XFER_TO_GUEST_WORK=y
CONFIG_KVM=m
CONFIG_KVM_INTEL=m
CONFIG_KVM_AMD=m
CONFIG_KVM_AMD_SEV=y
CONFIG_KVM_XEN=y
CONFIG_KVM_EXTERNAL_WRITE_TRACKING=y
I0F
#6
Use this command
lsmod | grep kvm
There should be some entry saying kvm_amd. If it returns nothing the module isn’t loaded. Then do this:
sudo modprobe kvm_amd
I0F
#7
I’m not sure if it’s necessary, but also check if libvirt is installed. If not try installing it.
swh
#8
this command outputs nothing
sudo modprobe kvm_amd
[sudo] Passwort für swh:
modprobe: ERROR: could not insert 'kvm_amd': Operation not supported
hmm…
I0F
#9
what happens if you just do
sudo modprobe kvm?
I’m not sure what other things to try. Maybe someone else has another idea.
swh
#10
this
$ lsmod | grep kvm
kvm 1200128 0
irqbypass 16384 1 kvm
thanks for your help anyway
swh
#11
silly me…checked again, it wasnt 
sudo modprobe kvm_amd
lsmod | grep kvm
kvm_amd 176128 0
kvm 1200128 1 kvm_amd
irqbypass 16384 1 kvm
ccp 143360 1 kvm_amd
everything works fine…

3 Likes
system
closed
#12
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.