I’ve been on Arch Linux for years now and if there’s one thing I miss from the old Windows days, it’s got to be gaming. I’m not a professional gamer by any stretch of the imagination, or a gamer period, for that matter. I just like to check out some titles here and there, mainly for immersive experiences, and the occasional intellectual puzzle. If I were to guess, I’d put my average play time around the 2-to-3h-per-month ballpark. So, “sacrificing” gaming for the benefit of a better operating system was a no-brainer. I took the plunge the moment I could - no regrets there. That being said, gaming was always at the back of my mind. I’d see new games come out, or gameplay recordings of old favorite games of mine, and just wish I could whip out my Fortnite costume and sink one or two hours in an adrenaline-spiking FPS game. And no, I don’t actually have a gaming costume - it’s just an expression. I don’t even remember ever playing Fortnite, come to think of it. Do you think I should give it a try?
Fast-forward to today, or more accurately few days ago, and I finally managed to get my NVIDIA card working on Arch Linux and Wayland with no hacky workarounds or precarious maintenance routines. It just works! It worked right after I sorted everything out, it works after reboots, it’s working right now as I type these words on my terminal that renders through the dedicated graphics card (yes, you can have your terminal run on the GPU - maybe it’s a topic for another post), and should continue working after driver updates that are managed by my package manager! Can you believe it? All right, I’m getting ahead of myself here - I got to tame my excitement, and tell you how I got here.
The Struggle
I’ve been using open-source graphic drivers that support NVIDIA, like Nouveau, for the bigger part of my time on Linux. The problem was… they all suck, if they work at all. As a matter of fact, I was inadvertently using the integrated GPU with the dedicated one completely off for so long without noticing. That’s how comparable NVIDIA’s performance with open-source drivers was to that of just plain simple integrated GPU. Watching my NVIDIA card sit there and collect dust never sat well with me however. At first, whenever I had some free time I would take another stab at making it work. I had some noticeable success when I was on X11 by using the official proprietary driver straight from NVIDIA’s website. It worked well with few caveats that I was ready to put up with for the sake of an improved graphic experience.
Sadly, when I switched to Wayland, all hell broke loose. Those two (NVIDIA and Wayland) did not like one another - they actively despised and energetically repelled each other. It was like trying to sit a magnet on top of another with similar poles facing each other. I remember once diving so deep in the rabbit hole that I found the line in Gnome’s source code where they explicitly ignore everything that has to do with NVIDIA when Wayland is loaded. Yeah, it was that bad! Shortly after this attempt, with a vivid memory of so many failures, black screens, frozen desktop environments, bricked systems, and geometrically paradoxical screen resolutions, I silently gave up. I felt like my hands were tied and that there wasn’t much I could do to marry NVIDIA and Wayland on my machine. This isn’t to say that it was impossible. I’d read multiple testimonials of people enjoying the full performance of their NVIDIA cards with Wayland, but there was something with my system that made reproducing a similar configuration challenging, to say the least. But, this all changed few days ago.
The Win
A short while ago, I randomly decided it was time I tried to sort out my NVIDIA+Wayland situation. I
don’t remember exactly what triggered it. The trauma from previous attempts had started to fade
away, I suppose, and I had some time on my hands so I thought “Why not?”. I headed over to the
trusty Arch Wiki, read through the NVIDIA section, and diligently followed
the steps that applied to my system and configuration. Surprisingly, all I ended up doing was
installing the official NVIDIA driver from the official Arch package repository (this wasn’t
available last time I tried by the way, so it gave me hope on the spot), and updating the
/etc/mkinitcpio.conf
file to remove kms
from the HOOKS
array. Et voila! I rebooted my system
and there it was - the NVIDIA card was working! I could see it in the nvidia-smi
output, and I
could feel it in the smoothness of the animations and the responsiveness of the system. I was
ecstatic! I couldn’t believe it was that easy. I was so used to the idea that getting NVIDIA to work
on Wayland was a monumental task that I had to prepare myself for, that I didn’t even consider the
possibility that it could be as simple as installing a package and updating a configuration file. I
was over the moon! But, I wasn’t done yet.
Now that I had the NVIDIA card properly configured, I wanted to make the most out of it. But I
didn’t want to use it all the time. I wanted to keep the hybrid setup I had going on with the
integrated GPU handling the day-to-day tasks and the NVIDIA card kicking in for the heavy lifting
when strenuous rendering was needed. The default hybrid mode was doing a pretty good job at this,
but I wanted to take it a step further. I wanted to force the NVIDIA card to render specific apps
that I knew would benefit from the extra power, like Firefox when watching videos. I spent quite a
bit of time on this and I’m happy to say that I managed to get it working. I used the prime-run
command to launch the apps I wanted to render with the NVIDIA card, and it worked like a charm. I
was hoping to accomplish this without manually updating the launch command of each app, but I
couldn’t find a way to do it. If you know of a different way to achieve this, please let me know via
email or on Mastodon.
What’s Next
I’m not done yet, unfortunately. Nothing needs a powerful GPU more than games, and I haven’t had the chance to test any games yet. I can finally satiate my envy of Linux gamers and see what all the fuss is about. I’m excited to see how games run on my system. I’m not expecting to be blown away by the performance, but I’m hoping to have a decent experience.
Also, I still want to move back to a window manager. I’ve been using Gnome for a while now because I really wanted to switch to Wayland, even if it meant forfeiting my beloved window manager. But now that I have successfully configured NVIDIA to function seamlessly on Wayland, I’m finally able to return to the refined simplicity of a window manager. I have my eyes set on Sway. Having heard numerous commendations, I’m eager to explore its merits and experience it firsthand. I’ll probably publish a post on the subject once I’ve had some time to play around with Sway. So, stay tuned1 for that.
Wrap Up
My goal with this post was to give you a glimpse into my journey with NVIDIA on Wayland. I wanted to share my struggles, my wins, and my plans for the future. I hope you found it interesting and maybe even helpful. If you’re in a similar situation, I hope this post gives you hope that you can get NVIDIA working on Wayland too. If you have any suggestions, tips, or questions, please don’t hesitate to reach out on Mastodon or via email. I’d love to hear from you. Until next time, take care and Happy New Year!