Nouveau blacklisted but loaded

I found a way to disable nouveau and get my battery life back when using prime with intel graphic card :

2 bugs in Ubuntu 18 are concerned :

1. Prime fails to turn off discrete GPU (known issue).

Make sure that your discrete GPU is connected to PCI port 0000:01:00.0 (using lspci -vnn | grep '\''[030[02]\]' for instance)

Change /etc/systemd/system/display-manager.service.wants/nvidia-prime-boot.service and replace the current execstart (referencing vgaswitcheroo which is not usually available by ExecStart=/bin/sh -c "echo 'auto' > '/sys/bus/pci/devices/0000:01:00.0/power/control'")

2. nvidia-fallback loads nouveau when nvidia is not loaded

Even if we are willing not to use the discrete gpu !

Disable the following service which loads nouveau driver when nvidia driver is not loaded : sudo systemctl disable nvidia-fallback.service


For anyone suffering with this: I was just about to try Antonin's solution but didn't need to after installing prime 0.8.8.1 from bionic-proposed. I had the nouveau issue with nvidia-390/restricted, nvidia-prime/main, nvidia-settings/main. Currently using nvidia-396 from graphics-drivers/ppa/ubuntu.

system: Dell Precision 7730 on 18.04 w/ Intel i915 and Quadro P4200

Assuming bionic-proposed and graphics-drivers/ppa/ubuntu are enabled:

sudo apt purge nvidia* && sudo apt autoremove --purge  
sudo apt install nvidia-driver-396 nvidia-prime/bionic-proposed nvidia-settings  

*reboot

Now prime-select no longer triggers a grub update or loads nouveau. And nvidia-fallback.service seems to have vanished.

gpu-manager | grep nouveau  

returns

/etc/modprobe.d is not a file
/etc/modprobe.d is not a file
/etc/modprobe.d is not a file
/etc/modprobe.d is not a file
Is nouveau loaded? no
Is nouveau blacklisted? no

and lspci -nnk | grep -iA2 VGA

00:02.0 VGA compatible controller [0300]: Intel Corporation Device [8086:3e94]
Subsystem: Dell Device [1028:0832]
Kernel driver in use: i915

01:00.0 VGA compatible controller [0300]: NVIDIA Corporation Device [10de:1bb9] (rev a1)
Subsystem: Dell Device [1028:0832]
Kernel driver in use: nvidia

Previously nouveau was loaded for 01:00.0

nvidia-prime 0.8.8.1