Introduction
Nvidia GPUs on Linux have always been a headache due to their propietary drivers, but this problem gets worse on Optimus laptops due to inexistent dynamic power management technologies on pre-Turing cards paired with Intel processors older than Coffee Lake. Read the official Nvidia documentation on dynamic PM for Turing and newer cards.
Turning off your Nvidia GPU will result in lower battery consumption when you don’t need it (eg programming, watching videos, etc).
Disable your Nvidia GPU
First blacklist the
nouveauandnvidiakernel modulesCreate a file called
/etc/modprobe.d/block-nvidia.confwith the following content:
blacklist i2c_nvidia_gpu blacklist nouveau blacklist nvidia blacklist nvidia-drm blacklist nvidia-modesetAdd the Udev rules for disabling Nvidia GPU on boot
Create a file called
/lib/udev/rules.d/50-disable-nvidia.ruleswith the following content:
# Remove NVIDIA USB xHCI Host Controller devices, if present ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c0330", ATTR{remove}="1" # Remove NVIDIA USB Type-C UCSI devices, if present ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c8000", ATTR{remove}="1" # Remove NVIDIA Audio devices, if present ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x040300", ATTR{remove}="1" # Remove NVIDIA VGA/3D controller ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x03[0-9]*", ATTR{remove}="1"Now reboot!
Re-enable your Nvidia GPU
Remove the
/etc/modprobe.d/block-nvidia.conffileRemove the
/lib/udev/rules.d/50-disable-nvidia.rulesfileReboot
Happy hacking!