<div dir="ltr">an udev specific rule may be...<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le mer. 16 nov. 2022 à 10:41, Andrei Borzenkov <<a href="mailto:arvidjaar@gmail.com">arvidjaar@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Wed, Nov 16, 2022 at 12:25 PM Vadim Lebedev <<a href="mailto:vadiml1024@gmail.com" target="_blank">vadiml1024@gmail.com</a>> wrote:<br>
><br>
> 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.<br>
><br>
> I've tried too create a service file:<br>
> [Unit]<br>
> Description=Disable Nouveau driver<br>
> DefaultDependencies=no<br>
> Before=kmod.service<br>
><br>
<br>
Drivers for devices are usually loaded dynamically by udev. What does<br>
kmod.service do? I would guess you rather want<br>
Before=systemd-udevd.service.<br>
<br>
><br>
> [Service]<br>
> Type=oneshot<br>
> ExecStart=/usr/bin/ocd-blacklist-nouveau.sh<br>
><br>
> ========================<br>
> and the shell script<br>
> #!/bin/bash<br>
> set -x<br>
> if /usr/bin/lspci | /usr/bin/grep Quadro >/dev/null; then<br>
> /usr/bin/logger Found Nvidia Quadro device. Disabling Nouveau driver<br>
> echo blacklist nouveau >/etc/modprobe.d/blacklist-nouveau.conf<br>
> else<br>
> rm -f /etc/modprobe.d/blacklist-nouveau.conf<br>
> fi<br>
><br>
> But it seems that the service is not executed...<br>
><br>
<br>
For service to be executed something needs to cause this service to be<br>
executed - other unit dependency or explicit request to start. The<br>
mere presence of unit definition on disk does not mean systemd will<br>
try to activate it. You can manually create links of use usual install<br>
section<br>
<br>
[Install]<br>
WantedBy=default.target<br>
<br>
followed by "systemctl enable your.service".<br>
<br>
Or you could create a generator that runs before systemd begins<br>
activating any service.<br>
</blockquote></div>