You are not logged in.

#1 2017-08-09 01:59:10

oblixion
Member
Registered: 2017-03-19
Posts: 4

[SOLVED] pci-passthrough stopped working since kernel update to 4.12.4

Hello Everyone,
I have been using my PCI-passthrough with libvirt, virt-manager, and qemu smoothly for a while.
But since I updated to kernel version 4.12.4 last week, my arch linux became unable to boot.
I re-installed arch linux using 20170801 iso, and my computer is back to a good shape now, except PCI-passthrough

Before, I was following this guide when I was setting up PCI-passthrough the first time: https://wiki.archlinux.org/index.php/PC … h_via_OVMF
And I did not do anything different this time.
I successfully made to the point where having the vfio-pci holds onto my GPU after boot.
After installing qemu, virt-manager, ovmf, and libvirt, things start to get wierd.

In virt-manager, when I get to the point to "Customize configuration before install", in the "Overview" panel, there was no drop-down menu to choose between BIOS or UEFI firmware.
I double-confirmed my /etc/libvirt/qemu.conf, and made sure it contains the following lines:

#if using ovmf
nvram = [
    "/usr/share/ovmf/ovmf_code_x64.bin:/usr/share/ovmf/ovmf_vars_x64.bin"
]
# if using yaourt edk2-ovmf
nvram = [
    "/usr/share/edk2/ovmf/OVMF_CODE.fd:/usr/share/edk2/ovmf/OVMF_VARS.fd"
]

In addition, whether installing windows from iso or importing my previous qemu img, I always get error prompt from virt-manager:

Unable to complete install: 'internal error: process exited while connecting to monitor: Could not access KVM kernel module: Permission denied
failed to initialize KVM: Permission denied'

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 88, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/create.py", line 2288, in _do_async_install
    guest.start_install(meter=meter)
  File "/usr/share/virt-manager/virtinst/guest.py", line 477, in start_install
    doboot, transient)
  File "/usr/share/virt-manager/virtinst/guest.py", line 405, in _create_guest
    self.domain.create()
  File "/usr/lib/python2.7/site-packages/libvirt.py", line 1062, in create
    if ret == -1: raise libvirtError ('virDomainCreate() failed', dom=self)
libvirtError: internal error: process exited while connecting to monitor: Could not access KVM kernel module: Permission denied
failed to initialize KVM: Permission denied

I have already added my user to group kvm, and chown'd /dev/kvm

crw-rw----+ 1 root kvm 10, 232 Aug  8 20:29 /dev/kvm

here's an out put if I run systemctl status libvirtd

● libvirtd.service - Virtualization daemon
   Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2017-08-08 20:29:37 EDT; 32min ago
     Docs: man:libvirtd(8)
           http://libvirt.org
 Main PID: 509 (libvirtd)
    Tasks: 17 (limit: 32768)
   CGroup: /system.slice/libvirtd.service
           └─509 /usr/bin/libvirtd

Aug 08 20:29:37 my_host_name libvirtd[509]: 2017-08-09 00:29:37.855+0000: 533: error : virFirewallApply:916 : internal error: Failed to initialize a valid firewall backend
Aug 08 20:29:37 my_host_name libvirtd[509]: 2017-08-09 00:29:37.858+0000: 533: error : virSysinfoReadX86:1001 : internal error: Failed to find path for dmidecode binary
Aug 08 20:29:37 my_host_name libvirtd[509]: 2017-08-09 00:29:37.914+0000: 533: error : virSysinfoReadX86:1001 : internal error: Failed to find path for dmidecode binary
Aug 08 20:57:38 my_host_name libvirtd[509]: 2017-08-09 00:57:38.065+0000: 520: error : qemuConnectGetDomainCapabilities:19033 : invalid argument: KVM is not supported by '/usr/sbin/qemu-system-x86_64' on this host
Aug 08 20:59:49 my_host_name libvirtd[509]: 2017-08-09 00:59:49.713+0000: 518: warning : qemuDomainObjTaint:4545 : Domain id=1 name='win8.1' uuid=e64b503c-5667-40fe-8256-ce330aded178 is tainted: host-cpu
Aug 08 20:59:49 my_host_name libvirtd[509]: 2017-08-09 00:59:49.837+0000: 509: error : qemuMonitorIORead:595 : Unable to read from monitor: Connection reset by peer
Aug 08 20:59:49 my_host_name libvirtd[509]: 2017-08-09 00:59:49.838+0000: 509: error : qemuProcessReportLogError:1859 : internal error: qemu unexpectedly closed the monitor: Could not access KVM kernel module: Permission denied
Aug 08 20:59:49 my_host_name libvirtd[509]: failed to initialize KVM: Permission denied
Aug 08 20:59:49 my_host_name libvirtd[509]: 2017-08-09 00:59:49.838+0000: 518: error : qemuProcessReportLogError:1859 : internal error: process exited while connecting to monitor: Could not access KVM kernel module: Permission denied
Aug 08 20:59:49 my_host_name libvirtd[509]: failed to initialize KVM: Permission denied

I found a post reporting kvm stopped working since the kernel update, but that seems to be limited to intel conroe CPU, and is irrelevant to my case (I am running an i7 6700K and GTX1080).
https://bbs.archlinux.org/viewtopic.php?id=228645

btw, I am trying to setup a arch linux host, and a windows 8.1 guest.

Any help and speculation is very much appreciated. :S

Last edited by oblixion (2017-08-10 03:46:13)

Offline

#2 2017-08-09 08:42:48

Omar007
Member
Registered: 2015-04-09
Posts: 368

Re: [SOLVED] pci-passthrough stopped working since kernel update to 4.12.4

oblixion wrote:

In virt-manager, when I get to the point to "Customize configuration before install", in the "Overview" panel, there was no drop-down menu to choose between BIOS or UEFI firmware.
I double-confirmed my /etc/libvirt/qemu.conf, and made sure it contains the following lines:

#if using ovmf
nvram = [
    "/usr/share/ovmf/ovmf_code_x64.bin:/usr/share/ovmf/ovmf_vars_x64.bin"
]
# if using yaourt edk2-ovmf
nvram = [
    "/usr/share/edk2/ovmf/OVMF_CODE.fd:/usr/share/edk2/ovmf/OVMF_VARS.fd"
]

There should only be one nvram array in your config, not two. Make sure you've got ovmf installed and have specified the correct paths.
Assuming you used the repo version and not an AUR version, the first entry should be the valid one. Remove or comment out the wrong one.

oblixion wrote:

In addition, whether installing windows from iso or importing my previous qemu img, I always get error prompt from virt-manager:

Unable to complete install: 'internal error: process exited while connecting to monitor: Could not access KVM kernel module: Permission denied
failed to initialize KVM: Permission denied'

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 88, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/create.py", line 2288, in _do_async_install
    guest.start_install(meter=meter)
  File "/usr/share/virt-manager/virtinst/guest.py", line 477, in start_install
    doboot, transient)
  File "/usr/share/virt-manager/virtinst/guest.py", line 405, in _create_guest
    self.domain.create()
  File "/usr/lib/python2.7/site-packages/libvirt.py", line 1062, in create
    if ret == -1: raise libvirtError ('virDomainCreate() failed', dom=self)
libvirtError: internal error: process exited while connecting to monitor: Could not access KVM kernel module: Permission denied
failed to initialize KVM: Permission denied

Are you connecting to qemu://session or qemu://system? qemu://system should be the default and root (the default user set in /etc/libvirt/qemu.conf) would have no problem accessing /dev/kvm.
To be able to assign the PCIe devices you need to be running through qemu://system.

oblixion wrote:

I have already added my user to group kvm, and chown'd /dev/kvm

crw-rw----+ 1 root kvm 10, 232 Aug  8 20:29 /dev/kvm

You should not be chowning anything here. The default is root:kvm. If it wasn't, what was it in your case before you chown'd it?
Further more, you only need to add your user to the kvm group if you're using qemu://session instead of qemu://system but then you can't assign the PCIe device anyway so there really isn't any point in adding the group if you only want to virtualize for passthrough use cases.

oblixion wrote:

btw, I am trying to setup a arch linux host, ...

If you weren't, you would kinda be in the wrong place tongue


Just to be sure, your kvm group's id is 78 right?
e.g.:

$ getent group kvm
kvm:x:78:

Last edited by Omar007 (2017-08-09 08:48:23)

Offline

#3 2017-08-09 13:12:09

Lone_Wolf
Forum Moderator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,925

Re: [SOLVED] pci-passthrough stopped working since kernel update to 4.12.4

libvirtError: internal error: process exited while connecting to monitor: Could not access KVM kernel module: Permission denied

Any chance you use a intel Conroe processor ?
https://bbs.archlinux.org/viewtopic.php?id=228645


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#4 2017-08-09 13:23:16

Omar007
Member
Registered: 2015-04-09
Posts: 368

Re: [SOLVED] pci-passthrough stopped working since kernel update to 4.12.4

@Lone_Wolf: He is not. Near the end of his post:

oblixion wrote:

I found a post reporting kvm stopped working since the kernel update, but that seems to be limited to intel conroe CPU, and is irrelevant to my case (I am running an i7 6700K and GTX1080).
https://bbs.archlinux.org/viewtopic.php?id=228645

Last edited by Omar007 (2017-08-09 13:25:06)

Offline

#5 2017-08-09 13:25:07

oblixion
Member
Registered: 2017-03-19
Posts: 4

Re: [SOLVED] pci-passthrough stopped working since kernel update to 4.12.4

You are correct, I did comment out one of the nvram settings depending on the ovmf package I am using.
And the default ownership of /dev/kvm was indeed root:kvm. I guess that's also why chowning didn't fix the problem.

I never paid attention to qemu://session and qemu://system before. I will study it tonight.

Interestingly,

Omar007 wrote:

Just to be sure, your kvm group's id is 78 right?
e.g.:
$ getent group kvm
kvm:x:78:

I found that my kvm was in group id 999, aka kvm:x:999:my_user_name
I will test changing the group id tonight and provide feedback later. How should I do it? By editing /etc/group?

Offline

#6 2017-08-09 13:29:51

Omar007
Member
Registered: 2015-04-09
Posts: 368

Re: [SOLVED] pci-passthrough stopped working since kernel update to 4.12.4

That is most likely your problem then. The reason I asked for that was due to you doing a re-install recently and there is an open bug on systemd 234.
It assigns a dynamic id for the kvm group while it is expected to be 78. See: https://bugs.archlinux.org/task/54943

I'm not sure about changing the id of a group like that.. Someone else that knows more about that should probably give his/her view on that. Editing it like that does not seem like a good idea to me.
In my personal view, the quick way to fix this would be to replace the group permissions of all files currently on group 78 with kvm.

find / -gid 78

Last edited by Omar007 (2017-08-09 13:37:46)

Offline

#7 2017-08-09 13:38:36

oblixion
Member
Registered: 2017-03-19
Posts: 4

Re: [SOLVED] pci-passthrough stopped working since kernel update to 4.12.4

Omar007 wrote:

That is most likely your problem then. The reason I asked for that was due to you doing a re-install recently and there is an open bug on systemd 234.
It assigns a dynamic id for the kvm group while it is expected to be 78. See: https://bugs.archlinux.org/task/54943

I'm not sure about changing the id of a group like that.. Someone else that knows more about that should probably give his/her view on that. Editing it like that does not seem like a good idea to me.
In my personal view, the quick way to fix this would be to replace the group permissions of all files with group 78 for kvm.

I will try tonight

groupmod -g 78 kvm

Hope it works. Thank you very much for the help.

Offline

#8 2017-08-09 13:43:22

Omar007
Member
Registered: 2015-04-09
Posts: 368

Re: [SOLVED] pci-passthrough stopped working since kernel update to 4.12.4

oblixion wrote:
groupmod -g 78 kvm

Ah cool I did not know about groupmod smile (I've literally never needed to perform any group modifications ever xD )
Seems like a much better/saner idea than locating files on the system and changing group permissions tongue

EDIT: That is if nothing else has taken GID 78 yet ofc.

Last edited by Omar007 (2017-08-09 13:52:11)

Offline

Board footer

Powered by FluxBB