Introduction
Check out EnvyControl! a much better alternative to this guide
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
nouveau
andnvidia
kernel modules- Create a file called
/etc/modprobe.d/block-nvidia.conf
with the following content:
/etc/modprobe.d/block-nvidia.conf blacklist i2c_nvidia_gpu blacklist nouveau blacklist nvidia blacklist nvidia-drm blacklist nvidia-modeset
- Create a file called
-
Add the Udev rules for disabling Nvidia GPU on boot
- Create a file called
/lib/udev/rules.d/50-disable-nvidia.rules
with the following content:
/lib/udev/rules.d/50-disable-nvidia.rules # 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"
- Create a file called
-
Now reboot!
Re-enable your Nvidia GPU
- Remove the
/etc/modprobe.d/block-nvidia.conf
file - Remove the
/lib/udev/rules.d/50-disable-nvidia.rules
file - Reboot
Happy hacking!