Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
No `modules.alias` on system with monolithic kernel
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
leyvi
Tux's lil' helper
Tux's lil' helper


Joined: 08 Sep 2023
Posts: 103

PostPosted: Sun Jan 05, 2025 8:17 pm    Post subject: No `modules.alias` on system with monolithic kernel Reply with quote

Hello all.
I'm trying to run a Windows 10 VM with QEMU/KVM, using Virtual Machine Manager as a graphical frontend. I wanted to use PCIe passthrough, so I configured IOMMU in my kernel, and checked all the relevant log files, and verified that everything was working. Problem is, when I try to start a VM passing my iGPU over to it (using the dGPU on the host), it gives me this error message:
Code:
libvirt.libvirtError: Failed to open file '/lib/modules/6.12.8-gentoo/modules.alias': No such file or directory
I have a purely monolithic kernel, with loadable modules disabled, so I don't think I should have that file there. I've tried making a dummy file called `modules.alias`, but that logs me out of my KDE session when I try to start the VM. I've also tried making a symbolic link to `modules.builtin` called `modules.alias`, but then starting the VM crashes KDE altogether. I also can't find anything of interest in syslog, except maybe this:
Code:
Jan  5 21:34:24 fast-penguin kernel: QSGRenderThread[30227]: segfault at 8 ip 00007fde17eb9031 sp 00007fddd176b830 error 4 in libQt6Core.so.6.8.1[2b9031,7fde17c91000+388000] likely on CPU 9 (core 11, socket 0)
I don't think it's really relevant though.

Anyone know how I can fix this?
Back to top
View user's profile Send private message
rab0171610
Guru
Guru


Joined: 24 Dec 2022
Posts: 450

PostPosted: Mon Jan 06, 2025 9:37 am    Post subject: Reply with quote

With regards to libvirt looking for modules.alias when using PCI passthrough:

https://libvirt.org/news.html#v10-0-0-2024-01-15

Code:
qemu: automatic selection/binding of VFIO variant drivers

When a device is assigned to a guest using VFIO with <hostdev managed='yes'>, libvirt will now search the running kernel's modules.alias file for the most specific match to that device for a VFIO driver, and bind that driver to the device rather than vfio-pci. A specific driver can also be forced, using the <driver model='plugh'/> attribute.


It may be that when hostdev is set to managed, libvirt may require dynamically loadable modules for use in hotplugging -- stopping and then passing attached PCI devices back and forth between the host and the guest:
Code:

<hostdev>
Passes host-attached devices to a virtual server.

Ensure that the device that is passed through to the virtual server is not in use by the host. The virtualization of the pass-through device can be SCSI-based or it can be based on the VFIO framework.

Code:
<hostdev managed='yes'>

managed=yes | no
    For managed="yes", automatically handles the host setup of the PCI device. When the virtual server is started or the device is hotplugged to a running virtual server, the device is detached from the host and assigned to the virtual server. When the virtual server is stopped or detaches the device, it is returned to the host.


You can refer to the PCI Passthrough section (Libvirt Domain XML format):
https://libvirt.org/formatdomain.html#pci-passthrough

I don't know if any of the configuration parameters would be beneficial for you, i.e. driver sub-element with a name attribute set to traditional 'kvm' rather than 'vfio'', changing <interface type='hostdev' managed='yes'> to <interface type='hostdev' managed='no''> in your Domain Configuration-XML, etc.
Note:
Code:
 If managed is omitted or "no", the user is responsible to call virNodeDeviceDettach (or virsh nodedev-detach) before starting the guest or hot-plugging the device, and virNodeDeviceReAttach (or virsh nodedev-reattach) after hot-unplug or stopping the guest.



Rather than experimenting with any of that, it might be easier to install gentoo-kernel-bin. I can confirm that the file modules.alias exists on my system with sys-kernel/gentoo-kernel-bin in the kernel modules directory.


Last edited by rab0171610 on Tue Jan 07, 2025 8:45 am; edited 2 times in total
Back to top
View user's profile Send private message
leyvi
Tux's lil' helper
Tux's lil' helper


Joined: 08 Sep 2023
Posts: 103

PostPosted: Mon Jan 06, 2025 6:31 pm    Post subject: Reply with quote

OK, thanks!
I'll give it a shot.
Back to top
View user's profile Send private message
leyvi
Tux's lil' helper
Tux's lil' helper


Joined: 08 Sep 2023
Posts: 103

PostPosted: Tue Jan 07, 2025 5:37 pm    Post subject: Reply with quote

:( It didn't work.
I tried these things:
  1. I installed gentoo-kernel-bin, and tried symbolically-linking modules.alias from that directory over to the directory of the kernel I'm currently using (I confirmed that they were the same version), but the results were the same.
  2. I tried symbolically-linking modules.alias.bin to modules.alias, again: logged me out of my KDE session.
Not sure what to do now...
Back to top
View user's profile Send private message
rab0171610
Guru
Guru


Joined: 24 Dec 2022
Posts: 450

PostPosted: Tue Jan 07, 2025 7:05 pm    Post subject: Reply with quote

When I suggested installing gentoo-kernel-bin, I meant to boot the host Linux system with the gentoo-kernel-bin and not the monolithic kernel.
It would be important to determine, when booting with gentoo-kernel-bin as opposed to your monolithic kernel, if the modules.alias file for gentoo-kernel-bin was found by libvirt when using PCI pass-through. Do you get the same error when booting with the binary kernel, i.e. modules.alias not found?

I use systemd as the init system and the file on my system is located at:
/usr/lib/modules/6.12.8-gentoo-dist/modules.alias


Since you would be booting the host system with the binary kernel, gentoo-kernel-bin, it would be helpful to know what the error message is in that case. What is the full path of modules.alias that libvirt reports cannot be found? Determine where the file actually resides on your system. It would be helpful to know if the file in the error message and where the file actually resides are the same path and location, for example: /lib/modules/6.12.8-gentoo-dist/modules.alias . Verify the file in the error message actually exists at that location and then report back.


Please post the exact error message in quotes that you receive, even if it is the same as before.

Also, If you create symlinks as a workaround, please post the command you used to create those symlinks or the output of ls command, for example, showing which files are symlinked for clarity:

Code:
root:/usr/src# ls -al

lrwxrwxrwx  1 root root     24 Jan  3 16:13 linux -> linux-6.12.8-gentoo-dist
drwxr-xr-x 26 root root   4096 Jan  3 16:12 linux-6.12.8-gentoo-dist
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum