[systemd-devel] Preventing automatic driver loading on live boot disk
Lennart Poettering
lennart at poettering.net
Thu Nov 17 14:22:41 UTC 2022
On Mi, 16.11.22 10:24, Vadim Lebedev (vadiml1024 at gmail.com) wrote:
> I'm preparing ubuntu-based live boot disk. It works fine mostly, but on
> some machines equipped with Nvidia Quadro cards the default nouveau driver
> causes problems (temporary freezes). I've determined that buy blacklisting
> nouveau driver (in /etc/modprobe.d/blacklist.conf) I can fix the problem.
> However this approach inhibits nouveau driver for every nvidia equipped
> machine which is an overkill. Of course, i can detect the presence of the
> Quadro card after the boot, blacklist it, do update-initramfs -u and reboot
> but this approach modifies live boot disk and I would like to avoid that. I
> wonder if there is a way to detect the presence of nvidia Quadro somewhere
> very early in the boot sequence and prevent loading of the offending driver
> and fall back to standard VESA driver.
PCI drivers are loaded via a "modalias" string, which is synthesized
from the PCI and USB vendor and product IDs (and other PCI
info). Drivers declare in their kmod metadata which of these modalias
strings they want to be responsible for.
Do "modinfo nouveau" for example, which will show you this
information:
<snip>
…
alias: pci:v000012D2d*sv*sd*bc03sc*i*
alias: pci:v000010DEd*sv*sd*bc03sc*i*
…
</snip>
The "*" are wildcard expressions.
Now, the kernel will never ask userspace for the "nouveau" driver but
only for a driver for such a modalias string.
You can denylist that string for your hw and thus disable the
autoloading.
Use "grep . /sys/bus/*/*/*/modalias" to get a list of the actual
modalias strings requested on your system. The one nuveau.ko matched
against will be among them. Find the right one and denylist it.
Lennart
--
Lennart Poettering, Berlin
More information about the systemd-devel
mailing list