Oh, the trials and tribulations of setting up an NVIDIA GPU the right way.

Technically, you could quickly skim through this post, copy-paste the commands in the syntax highlighted boxes onto a terminal, and still be okay. At least in theory.
But in any case, I recommend reading through the whole post so that you at least know “why?????“s too.

FYI, my setup is -

  • Arch Linux
  • CoffeeLake CPU
  • Turing series GPU

BTW, I use Arch.

Linux, Intel, and NVIDIA. Sigh

Trust me. It can get frustrating. Fast.
A power-hungry demon of a GPU, unrelenting vendor, outdated links and tutorials, and shoddy packages. The dream team.

If there’s a ray of hope and light in all this, it’s the Arch Wiki. Oh, what a wonderful, precious place. Seriously, the amount of respect I’ve for the Wiki is immense after hours of poring through its pages, trying to find a fix.

But, as glorious as the Arch Wiki is, in the end, it only took me so far. Nonetheless, hope, my laptop’s battery, and my retinas persevered, and I found a solution. I’m writing the blog I wish I had when I first started down this rabbit hole.

There are no tricks, fancy configurations, or hacks here. These steps down below will let you hit the ground running and get your GPU set up to what I believe is the basic setup required to make the best out of your hardware configuration.

If you want to configure, go figure.

Anyways, let’s get to it.

The Solution

NVIDIA Drivers

I highly recommend using the nvidia-dkms package and checking the Arch wiki on how to set that up properly.
If you’re hesitant to do that, or if that seems too intimidating, please consider using an Arch Linux flavour that makes it easier to get started with a minimal configuration, like EndeavourOS, ArcoLinux, etc, which would take care of this for you.

GPU Modes

Next, we need to control the mode on which the GPU operates.

If left unchecked, your GPU will become drunk on power. Without controlling it, it’ll have no problem whatsoever making an absolute mockery out of your battery life and devouring it whole while doing practically nothing. I mean, if not for controlling the GPU mode, why are we even doing this, right?

Again, as with everything on the Wiki, there’s a good selection of options for doing this too, but my personal favorite (and the best option in my opinion) is system76-power.

System76 does a fantastic job at what they do and system76-power truly delivers. Let’s get this set up.
The reason why I like it so much, is because of the incredibly pleasant experience I’ve had with it previously on Pop!_OS and also because it completely powers off the GPU when in integrated mode, as opposed to other options.

yay -S system76-power # install system76-power
sudo systemctl enable --now system76-power # enable system76-power
sudo gpasswd -a $USER adm # make `system76-power graphics` a sudo-less command

The modes that you can have are -

  • integrated - integrated GPU only
  • hybrid - best of both worlds
  • nvidia - UNLIMITED POWER!!!
  • compute - use GPU as a compute node

P.S. You’ll need to reboot after installing system76-power.

Multi-monitor Configuration

I like running my system on hybrid mode. I like having a second monitor sometimes. In my experience, the easiest way to get this set up, is using xlayoutdisplay.

yay -S xlayoutdisplay

Simply running xlayoutdisplay will auto-configure everything and your monitors will come to life.
I suggest adding this as a script in /etc/profile.d.

Let there be Light - ACPILight

Done …right? Not quite yet, no. While the GPU switching worked like a charm, what didn’t quite work anymore, was the brightness control.

All this ended up bricking the brightness control (at least for it did for me) to the point where you could practically feel your retinas begging for mercy from the brightness of the display in all its 500 nits glory burning onto them. It didn’t care if the GPU was running on integrated, hybrid or nvidia mode. It just wanted to shine like the brightest star in the galaxy.

But, I managed to find a clean fix for this issue too.

yay -S acpilight
# acpilight needs to be normally run as sudo because it edits the contents of `sys/class/backlight/<your backlight>
sudo usermod -a -G video $USER # make `acpilight` a sudo-less command

acpilight is a drop-in replacement for xbacklight, that almost magically fixes the brightness issues.

With this last cherry on the cake, all my woes caused by the GPU were no more. Well, almost all.

Fin

Et voila. You have tamed the beast. With great power comes great responsibility. Use your GPU power responsibly, please.

P.S. - Livin’ La nVIDiA Loca is a play on the popular song Livin’ La Vida Loca. Geddit?