KVM stops working when updating to kernel 5.18.11-1.1

The kernel update to 5.18.11-1.1 cause KVM to stop working. I have rolled back to a snapshot from 5.18.9-2-default and everything works.

I rebooted my machine after installing the update through software updates in the gui and I went to launch a vm and got a warning saying either virtualization wasnt enabled on the cpu or the modules werent loaded properly. I rebooted and verified that virtualization was still enabled in the bios and still same message when trying to launch a vm. Once in the os I ran lsmod |grep kvm and saw that the modules werent listed. I think went into yast and tried to force a reinstall of kvm and still no luck. Opening up the install hypervisor and tools had KVM greyed out but XEN could be clicked to be installed (can be seen in screenshot). I snapped back to 5.18.9-2 and everything works as expected. I once again tried to install the updates and ran into the same problem with KVM not being loaded. Has anyone else experienced this? Is there a way to get KVM working with 5.18.11-1.1. CPU is an AMD Ryzen 5950x.

https://i.imgur.com/nM4qisK.png

https://i.imgur.com/LSnwmay.pnghttps://imgur.com/LSnwmay

Hi
As indicated in the GUI output, if greyed out, then already installed.

Are you sure libvirtd is running?

I’m on intel here and kvm/libvirtd is working fine with 5.18.11.


lsmod | grep "kvm"

kvm_intel             380928  4
kvm                  1085440  1 kvm_intel
irqbypass              16384  17 kvm

virsh list

 Id   Name      State
-------------------------
 1    ALP-WG1   running
 2    ALP-WG2   running




Tried again, this time using zypper dup same results.

libvirt is running but have an error

user@generichostname:~> sudo systemctl status libvirtd.service 
● libvirtd.service - Virtualization daemon
     Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: disabled)
     Active: active (running) since Wed 2022-07-20 17:55:49 EDT; 2min 16s ago
TriggeredBy: ● libvirtd-admin.socket
             ● libvirtd-ro.socket
             ● libvirtd.socket
       Docs: man:libvirtd(8)
             https://libvirt.org
   Main PID: 2245 (libvirtd)
      Tasks: 19 (limit: 32768)
        CPU: 210ms
     CGroup: /system.slice/libvirtd.service
             └─2245 /usr/sbin/libvirtd --timeout 120


Jul 20 17:55:48 generichostname systemd[1]: Starting Virtualization daemon...
Jul 20 17:55:48 generichostname libvirtd[2245]: libvirt version: 8.5.0
Jul 20 17:55:48 generichostname libvirtd[2245]: hostname: generichostname
Jul 20 17:55:48 generichostname libvirtd[2245]: Failed to initialize libnetcontrol.  Management of interface devices is disabled
Jul 20 17:55:49 generichostname systemd[1]: Started Virtualization daemon.
Jul 20 17:55:49 generichostname libvirtd[2245]: Unable to open /dev/kvm: No such file or directory
Jul 20 17:55:49 generichostname libvirtd[2245]: Unable to open /dev/kvm: No such file or directory
Jul 20 17:57:20 generichostname libvirtd[2245]: authentication failed: access denied by policy
Jul 20 17:57:20 generichostname libvirtd[2245]: End of file while reading data: Input/output error
user@generichostname:~> lsmod|grep kvm
user@generichostname:~> 
user@generichostname:~> sudo journalctl -b -u libvirtd
Jul 20 17:55:48 generichostname systemd[1]: Starting Virtualization daemon...
Jul 20 17:55:48 generichostname libvirtd[2245]: libvirt version: 8.5.0
Jul 20 17:55:48 generichostname libvirtd[2245]: hostname: generichostname
Jul 20 17:55:48 generichostname libvirtd[2245]: Failed to initialize libnetcontrol.  Management of interface devices is disabled
Jul 20 17:55:49 generichostname systemd[1]: Started Virtualization daemon.
Jul 20 17:55:49 generichostname libvirtd[2245]: Unable to open /dev/kvm: No such file or directory
Jul 20 17:55:49 generichostname libvirtd[2245]: Unable to open /dev/kvm: No such file or directory
Jul 20 17:57:20 generichostname libvirtd[2245]: authentication failed: access denied by policy
Jul 20 17:57:20 generichostname libvirtd[2245]: End of file while reading data: Input/output error
Jul 20 17:59:20 generichostname systemd[1]: libvirtd.service: Deactivated successfully.
user@generichostname:~> 


Hi
Is your user a member of libvirtd? Apparmor tweaks been made or Selinux running?

Can you show the output from cat /proc/cmdline

Nothing in /etc/modprobe.d or /etc/dractuct.conf.d that might block the modules loading?

I can manually load the kvm modules but they are not getting loaded on boot as part of the update. Sorry I thought I had tried that earlier and was still having issues but I think I only tried to load kvm and forgot to load kvm-amd when I first tried it.


user@generichostname:~> groups
user libvirt bumblebee video
user@generichostname:~> 
user@generichostname:~> cat /proc/cmdline 
BOOT_IMAGE=/boot/vmlinuz-5.18.11-1-default root=UUID=e9a79f6d-fbb2-4e52-91c2-a8459e4b7a69 splash=silent quiet security=apparmor nosimplefb=1 mitigations=auto
user@generichostname:~> cat /etc/modprobe.d/* | egrep -v "^$|^#"
blacklist nouveau
blacklist nouveau
options nouveau modeset=0
user@generichostname:~> cat /etc/dracut.conf.d/* | egrep -v "^$|^#"
add_dracutmodules+=" ostree systemd "
reproducible=yes
user@generichostname:~>
user@generichostname:~> sudo systemctl status libvirtd.service 
● libvirtd.service - Virtualization daemon
     Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: disabled)
     Active: active (running) since Wed 2022-07-20 21:00:27 EDT; 9s ago
TriggeredBy: ● libvirtd.socket
             ● libvirtd-ro.socket
             ● libvirtd-admin.socket
       Docs: man:libvirtd(8)
             https://libvirt.org
   Main PID: 4627 (libvirtd)
      Tasks: 19 (limit: 32768)
        CPU: 134ms
     CGroup: /system.slice/libvirtd.service
             └─4627 /usr/sbin/libvirtd --timeout 120


Jul 20 21:00:27 generichostname systemd[1]: Starting Virtualization daemon...
Jul 20 21:00:27 generichostname libvirtd[4627]: libvirt version: 8.5.0
Jul 20 21:00:27 generichostname libvirtd[4627]: hostname: generichostname
Jul 20 21:00:27 generichostname libvirtd[4627]: Failed to initialize libnetcontrol.  Management of interface devices is disabled
Jul 20 21:00:27 generichostname systemd[1]: Started Virtualization daemon.
Jul 20 21:00:27 generichostname libvirtd[4627]: Unable to open /dev/kvm: No such file or directory
user@generichostname:~> lsmod |grep kvm
user@generichostname:~> sudo modprobe kvm
user@generichostname:~> sudo modprobe kvm-amd
user@generichostname:~> lsmod |grep kvm
kvm_amd               167936  0
kvm                  1085440  1 kvm_amd
irqbypass              16384  1 kvm
ccp                   122880  1 kvm_amd
user@generichostname:~> sudo systemctl status libvirtd.service 
● libvirtd.service - Virtualization daemon
     Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: disabled)
     Active: active (running) since Wed 2022-07-20 21:00:27 EDT; 1min 4s ago
TriggeredBy: ● libvirtd.socket
             ● libvirtd-ro.socket
             ● libvirtd-admin.socket
       Docs: man:libvirtd(8)
             https://libvirt.org
   Main PID: 4627 (libvirtd)
      Tasks: 19 (limit: 32768)
        CPU: 134ms
     CGroup: /system.slice/libvirtd.service
             └─4627 /usr/sbin/libvirtd --timeout 120


Jul 20 21:00:27 generichostname systemd[1]: Starting Virtualization daemon...
Jul 20 21:00:27 generichostname libvirtd[4627]: libvirt version: 8.5.0
Jul 20 21:00:27 generichostname libvirtd[4627]: hostname: generichostname
Jul 20 21:00:27 generichostname libvirtd[4627]: Failed to initialize libnetcontrol.  Management of interface devices is disabled
Jul 20 21:00:27 generichostname systemd[1]: Started Virtualization daemon.
Jul 20 21:00:27 generichostname libvirtd[4627]: Unable to open /dev/kvm: No such file or directory
user@generichostname:~> sudo systemctl restart libvirtd.service 
user@generichostname:~> sudo systemctl status libvirtd.service 
● libvirtd.service - Virtualization daemon
     Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: disabled)
     Active: active (running) since Wed 2022-07-20 21:01:37 EDT; 5s ago
TriggeredBy: ● libvirtd.socket
             ● libvirtd-ro.socket
             ● libvirtd-admin.socket
       Docs: man:libvirtd(8)
             https://libvirt.org
   Main PID: 4834 (libvirtd)
      Tasks: 19 (limit: 32768)
        CPU: 277ms
     CGroup: /system.slice/libvirtd.service
             └─4834 /usr/sbin/libvirtd --timeout 120


Jul 20 21:01:37 generichostname systemd[1]: Starting Virtualization daemon...
Jul 20 21:01:37 generichostname libvirtd[4834]: libvirt version: 8.5.0
Jul 20 21:01:37 generichostname libvirtd[4834]: hostname: generichostname
Jul 20 21:01:37 generichostname libvirtd[4834]: Failed to initialize libnetcontrol.  Management of interface devices is disabled
Jul 20 21:01:37 generichostname systemd[1]: Started Virtualization daemon.
user@generichostname:~> 



Hi
This is the issue, you need to look at the policies in place for security=apparmor. If you temporarily remove, as in edit grub at boot and see if it all starts working.

Removing apparmor from the boot command doesnt change anything. Also if it were an apparmor issue then wouldnt manually loading the modules itself fail as well?

For now I have simply created my own modules-load.d script and it resolves loading it and having everything work on boot.


#Load KVM at boot
kvm
kvm-amd

However I would still like to understand why the automatic loading of these modules disappeared after installing the kernel update.

Hi
That is very strange, I do believe it’s worth a bug report, did you check any dracut configuration may have omitted those modules?

openSUSE:Submitting bug reports - openSUSE

There is a bugreport. Not 100% sure if it fits the TO’s description completely:
https://bugzilla.opensuse.org/show_bug.cgi?id=1201766

Yes that appears to be the issue, will add a note to that bug.


generichostname:~ # modinfo kvm_amd |grep alias
alias:          cpu:type:x86,ven*fam*mod*:feature:*00C2*
generichostname:~ # cat /sys/devices/system/cpu/modalias|grep 00C2
cpu:type:x86,ven0002fam0019mod0021:feature:,0000,0001,0002,0003,0004,0005,0006,0007,0008,0009,000B,000C,000D,000E,000F,0010,0011,0013,0017,0018,0019,001A,001C,0020,0021,0022,0023,0024,0025,0026,0027,0028,0029,002B,002C,002D,002E,002F,0030,0031,0034,0036,0037,0038,0039,003A,003B,003D,0064,0068,006E,0070,0072,0074,0075,0078,0079,007A,007C,007D,0080,0081,0083,0089,008C,008D,0093,0094,0095,0096,0097,0099,009A,009B,009C,009D,009E,00C0,00C1,00C2,00C3,00C4,00C5,00C6,00C7,00C8,00C9,00CA,00CC,00CD,00D1,00D6,00D7,00D8,00DA,00DC,00DD,00DE,00E2,00E4,00E6,00E8,00ED,00F0,00F1,00F2,00F3,00F5,00F6,00F9,00FA,00FB,00FC,010F,0120,0123,0125,0127,0128,0129,012A,012C,012F,0132,0133,0134,0137,0138,013D,0140,0141,0142,0143,0160,0161,0162,0163,0165,016C,01A0,01A1,01A2,01A4,01A6,01A9,01AA,01AC,01AD,01AE,01AF,01B1,01B2,01B3,01B4,01B8,01BC,01BD,01C2,01E0,01E1,01E2,01E3,01E4,01E5,01E6,01E7,01EA,01EB,01EC,01ED,01EF,01F0,01F1,01F3,01F4,01FC,0202,0203,0204,0207,0209,020A,0216,0220,0221,0223,0224,0225,0244,0262,026B,026C,026D,026E,0270
generichostname:~ #
generichostname:~ # journalctl -b | grep truncated
Jul 22 07:44:09 generichostname systemd-udevd[569]: cpu0: /usr/lib/udev/rules.d/80-drivers.rules:5 The command 'kmod load 'cpu:type:x86,ven0002fam0019mod0021:feature:,0000,0001,0002,0003,0004,0005,0006,0007,0008,0009,000B,000C,000D,000E,000F,0010,0011,0013,0017,0018,0019,001A,001C,0020,0021,0022,0023,0024,0025,0026,0027,0028,0029,002B,002C,002D,002E,002F,0030,0031,0034,0036,0037,0038,0039,003A,003B,003D,0064,0068,006E,0070,0072,0074,0075,0078,0079,007A,007C,007D,0080,0081,0083,0089,008C,008D,0093,0094,0095,0096,0097,0099,009A,009B,009C,009D,009E,00C0,00C1,00C2,00C3,00C4,00C5,00C6,00C7,00C8,00C9,00CA,00CC,00CD,00D1,00D6,00D7,00D8,00DA,00DC,00DD,00DE,00E2,00E4,00E6,00E8,00ED,00F0,00F1,00F2,00F3,00F5,00F6,00F9,00FA,00FB,00FC,010F,0120,0123,0125,0127,0128,0129,012A,012C,012F,0132,0133,0134,0137,0138,013D,0140,0141,0142,0143,0160,0161,0162,0163,0165,016C,01A0,01A1,01A2,01A4,01A6,01A9,01AA,01AC,01AD,01AE,01AF,01B1,01B2,01B3,01B4,01B8,01BC,01BD,01C2,01E0,01E1,01E2,01E3,01E4,01E5,01E6,01E7,01EA,01EB,01EC,01ED,01EF,01F0,01F1,01F3,01F4,01FC,0202,0203,0204,0207,0209,020A,0216,0220,0221,0223,0224,0225,0244,0262,026B,026C,026D,026' is truncated while substituting into 'kmod load '$env{MODALIAS}'', refusing to invoke the command.
Jul 22 07:44:09 generichostname systemd-udevd[566]: cpu1: /usr/lib/udev/rules.d/80-drivers.rules:5 The command 'kmod load 'cpu:type:x86,ven0002fam0019mod0021:feature:,0000,0001,0002,0003,0004,0005,0006,0007,0008,0009,000B,000C,000D,000E,000F,0010,0011,0013,0017,0018,0019,001A,001C,0020,0021,0022,0023,0024,0025,0026,0027,0028,0029,002B,002C,002D,002E,002F,0030,0031,0034,0036,0037,0038,0039,003A,003B,003D,0064,0068,006E,0070,0072,0074,0075,0078,0079,007A,007C,007D,0080,0081,0083,0089,008C,008D,0093,0094,0095,0096,0097,0099,009A,009B,009C,009D,009E,00C0,00C1,00C2,00C3,00C4,00C5,00C6,00C7,00C8,00C9,00CA,00CC,00CD,00D1,00D6,00D7,00D8,00DA,00DC,00DD,00DE,00E2,00E4,00E6,00E8,00ED,00F0,00F1,00F2,00F3,00F5,00F6,00F9,00FA,00FB,00FC,010F,0120,0123,0125,0127,0128,0129,012A,012C,012F,0132,0133,0134,0137,0138,013D,0140,0141,0142,0143,0160,0161,0162,0163,0165,016C,01A0,01A1,01A2,01A4,01A6,01A9,01AA,01AC,01AD,01AE,01AF,01B1,01B2,01B3,01B4,01B8,01BC,01BD,01C2,01E0,01E1,01E2,01E3,01E4,01E5,01E6,01E7,01EA,01EB,01EC,01ED,01EF,01F0,01F1,01F3,01F4,01FC,0202,0203,0204,0207,0209,020A,0216,0220,0221,0223,0224,0225,0244,0262,026B,026C,026D,026' is truncated while substituting into 'kmod load '$env{MODALIAS}'', refusing to invoke the command.
####Repeates for each core#####

Same issue. Loading manually does the job.