[systemd-devel] Preventing automatic driver loading on live boot disk

Vadim Lebedev vadiml1024 at gmail.com
Wed Nov 16 09:24:47 UTC 2022


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.

I've tried too create a service file:
[Unit]
Description=Disable Nouveau driver
DefaultDependencies=no
Before=kmod.service


[Service]
Type=oneshot
ExecStart=/usr/bin/ocd-blacklist-nouveau.sh

========================
and the shell script
#!/bin/bash
set -x
if /usr/bin/lspci | /usr/bin/grep Quadro >/dev/null; then
   /usr/bin/logger Found Nvidia Quadro device. Disabling Nouveau driver
   echo blacklist nouveau >/etc/modprobe.d/blacklist-nouveau.conf
else
   rm -f /etc/modprobe.d/blacklist-nouveau.conf
fi

But it seems that the service is not executed...

Any ideas, please?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20221116/6e5bdee6/attachment.htm>


More information about the systemd-devel mailing list