Forewords
Installing the nvidia driver on Fedora has been a painful experience for me. If I don’t get it wrong, I have been trying since F26!
I will not touch on bumblebee. I will instead use nvidia-xrun to utilize the driver.
This article serves as a reminder for myself on what did I do to make things work for my Intel/nvidia hybrid laptop. It might hopefully help other people as well.
Confirm what graphics cards I have
$ lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 530 (rev 06)
$ lspci | grep 3D
01:00.0 3D controller: NVIDIA Corporation GM107M [GeForce GTX 950M] (rev a2)
Backup /etc/X11/xorg.conf
# cp /etc/X11/xorg.conf /etc/X11/xorg.conf.bak
(But my /etc/X11/xorg.conf doesn’t exsit in the first place so I just ignore it.)
Install nvidia drivers from rpmfusion
It might be useful to read this first. It could also be possible to use negativo17.org’s repo to successully make nvidia driver run for you. Nevertheless, I will focus on the rpmfusion way.
It is as simple as the two or three commands to install the driver:
# dnf install xorg-x11-drv-nvidia akmod-nvidia
# dnf install xorg-x11-drv-nvidia-cuda # optional for cuda/nvdec/nvenc support
# dnf update -y # don't reboot at this moment...
xorg.conf
Before you ever reboot your machine, take a look at /etc/X11/xorg.conf. Pay special attention to what Device does it assign to Screen. In section Screen xorg.conf might read:
Section "Screen"
Identifier "Default Screen"
Device "nvidia"
DefaultDepth 24
Option "AllowEmptyInitialConfiguration"
SubSection "Display"
Depth 24
Modes "nvidia-auto-select"
EndSubSection
EndSection
It looks OK but caused me huge trouble: when I rebooted my laptop and waited for SDDM (I use KDE), the entire screen just turned blank black. I turned to tty2 using ctrl + alt + F2, checked /var/log/Xorg.0.log and even nvidia-smi and lsmod | grep nvidia. I could confirm the nvidia driver was working and X was on it. What’s up?
This is where nvidia-xrun kicks in
My Intel driver has always been working so I decided to switch to back to the Intel one. In /etc/X11/xorg.conf, I modifed the Screen section to make X choose the intel driver:
Identifier "Intel Graphics"
Driver "intel"
BusID "PCI:0:2:0"
EndSection
Section "Screen"
Identifier "Default Screen"
Device "Intel Graphics"
EndSection
The numbers in BusID is what you have seen in lspci | VGA. On next reboot the laptop would use the Intel driver as the “default” driver.
Install nvidia-xrun
According to their github README.md, I installed nvidia-xrun through
# dnf config-manager --add-repo https://download.opensuse.org/repositories/home:AxelSilverdew/Fedora_27/home:AxelSilverdew.repo
# dnf install nvidia-xrun
/etc/X11/nvidia-xorg.conf
Confirm X will correctly locate the BusID of the nvidia card. Either create /etc/X11/xorg.conf.d/30-nvidia.conf containing the following or insert it into /etc/X11/nvidia-xorg.conf.
Section "Device"
Identifier "nvidia"
Driver "nvidia"
BusID "PCI:1:0:0" # replace this to yours
EndSection
Replace BusID entity with what corresponds to your machine. Consult lspci.
Now switch to another tty (i.e. ctrl + alt + F2), try nvidia-xrun openbox-session. This has worked for me:
