My system contains 2 Nvidia cards. What i'm trying to achieve is one card driven by nouveau driver while the other by the official nvidia blob driver.Both drivers successfully cohabit if the nvidia one is launched automatically on boot, using a specific nvidia driver option nvidia_340.NVreg_AssignGpus=0:02:00. that make the driver to probe only a specific device, and the nouveau driver is launched manually with modprobe, probing the other unused device. I would like to automate things by making both modules to load on boot but i have not managed to tell nouveau driver to probe only one of the two graphic cards. Loading order of modules seems nondeterministic and when nouveau module is loaded before nvidia module it probes both and prevents the official nvidia to access to the other.I know i could do a systemd service task to execute modprobe nouveau during boot phase (that is executed well after the load of nvidia module) but i guess there is a better way to do that. I think of udev but as i don't know it much i'm not sure it is the way to go.What is the proper way to handle this ?
How to prevent a kernel module video driver to probe a specific graphic card device
linux;kernel;kernel modules;udev;nouveau
So, the path to the solution was not easy, but the solution in itself issurprisingly straightfoward:The idea is to use the install directive in a /etc/modprobe.d/ configuration file that redefine the way the nvidia driver is run through modprobe. I set the following inside a file /etc/modprobe.d/nvidia-with-nouveau.conf:install nvidia_340 /sbin/modprobe --ignore-install nvidia_340; /sbin/modprobe nouveauwhich instructs the kernel how to start the module nvidia (mine is version340). Through this instruction i tell it to start nvidia first, thennouveau. --ignore-install is needed to prevent the kernel to reuse theinstall directive to launch the nvidia module that could result in somekind of infinite loop i presume. install and others available directives in /etc/modprobe.d configuration files is well explained in man modprode.d.It is important to stay the nouveau driver blacklisted to prevent it to bestarted by its own. On Ubuntu, Nvidia drivers, when installed through debpackages from official Ubuntu repositories, blacklist the nouveau module by installing the file /etc/modprobe.d/nvidia-340_hybrid.conf(it applies for me , it can be different on other OS and driver version).This file contains the following:blacklist nouveaublacklist lbm-nouveaualias nouveau offalias lbm-nouveau offThe following lines create an alias for nouveau to off and must becommented:#alias nouveau off#alias lbm-nouveau offFinally, i guess, updating the initramfs is required for theses changes tobe taken in account: sudo update-initramfs -uI can now enjoy a Multi-seat config with one seat on nouveau and the otheron nvidia-driver.