Hello everyone,
In short, by default I work on a laptop with Nvidia dGPU and script cuda codes on it, and I also watch movies on the laptop. Therefore the following set of instructions are what I install in the beginning. I put together what I learned mostly from this thread (https://forums.opensuse.org/showthread.php/534832-Installing-NVIDIA-on-modern-machines-ending-disastrously/page2).
- I install OpenSUSE LEAP 42.3/15.0/15.1+ with a bootmode: nomodeset. This means the laptop should have in
/etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="splash=silent quiet mitigations=auto nomodeset"
with no update applied whatsoever. Just fresh install with nomodeset in default boot mode.
- I add default Nvidia repository from the community packages.
zypper addrepo --refresh [https://download.nvidia.com/opensuse/leap/15.1](https://download.nvidia.com/opensuse/leap/15.1) NVIDIA
Mind you that the version number such as 15.1 should be whichever version you are using or tumbleweed (for which case instead /leap/15.1).
source (https://en.opensuse.org/SDB:NVIDIA_drivers)
Remember do not update or install anything.
- Set up cuda repository from Nvidia’s website (https://developer.nvidia.com/cuda-downloads).
They typically provide an rpm package which adds necessary repos. You can do this from a terminal.
sudo zypper addrepo http://developer.download.nvidia.com/compute/cuda/repos/opensuse15/x86_64/cuda-opensuse15.repo
Please note that they don’t distinguish OpenSUSE 15.1 from 15.0, if you add their repo they will keep the necessary packages related to cuda up to date.
- Now make sure all of the packages are loaded and refreshed.
sudo zypper ref
trust always on everything.
4.Install cuda which then in turn will lock, and install nvidia driver that it considers most compatible and locks the kernel and also blacklists nouveau automatically.
sudo zypper in cuda-tools-10-1 cuda-toolkit-10-1 cuda
Do not reboot yet.
5.Remove nomodeset from
/etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="splash=silent quiet mitigations=auto nomodeset"
Make sure that grub is updated with
sudo mkinitrd
6.Reboot.
- Update
sudo zypper up
8.Set up codecs
sudo zypper addrepo -f http://packman.inode.at/suse/openSUSE_Leap_15.1/ packman
sudo zypper addrepo -f http://opensuse-guide.org/repo/openSUSE_Leap_15.1/ dvd
Be sure to use the right version then install.
sudo zypper install --allow-vendor-change ffmpeg lame gstreamer-plugins-bad gstreamer-plugins-ugly gstreamer-plugins-ugly-orig-addon gstreamer-plugins-libav libavdevice56 libavdevice58 libdvdcss2 vlc-codecs
Then make sure there are no stray packages clinging to other repos.
sudo zypper dup --allow-vendor-change --from http://packman.inode.at/suse/openSUSE_Leap_15.1/
Again careful with the repos.
source (https://opensuse-guide.org/codecs.php)
9.Reboot.
10. Update.
11. If updated, then reboot again.
- Install bumblebee.
sudo zypper in bumblebee bbswitch
sudo usermod -aG bumblebee $USER
sudo usermod -aG video $USER
turn it on
sudo systemctl enable bumblebeed
sudo systemctl start bumblebeed
Install 32 bit libraries:
sudo zypper in Mesa-libGL1-32bit libX11-6-32bit primus-32bit
Install Mesa-demo for testing.
sudo zypper in Mesa-demo-x Mesa-demo
configure
/etc/bumblebee/bumblebee.conf
Change the following lines under [bumblebeed]:
TurnCardOffAtExit=true
Driver=nvidia
Change the following lines under [driver-nvidia]:
LibraryPath=/usr/lib64/:/usr/lib/
XorgModulePath=/usr/lib64/nvidia/xorg/,/usr/lib64/xorg/modules
XorgConfFile=/etc/bumblebee/xorg.conf.nvidia
Setup xrog path and symbollic link:
sudo mkdir -p /usr/lib64/nvidia/xorg/modules/extensions
sudo ln -s /usr/lib64/xorg/modules/extensions/nvidia/nvidia-libglx.so /usr/lib64/nvidia/xorg/modules/extensions/libglx.so
reinitiate kernel.
mkinitrd
At least all of my laptops needed the following. You need to change a line in:
/etc/modprobe.d/50-bbswitch.conf
options bbswitch load_state=-1 unload_state=1
source: (https://en.opensuse.org/SDB:NVIDIA_Bumblebee)
13. reboot, update, reboot, and test. First with:
optirun --status
Bumblebee status: Ready (3.2.1). X inactive. Discrete video card is off.
Then test with mesa demo package
optirun glxgears
optirun glxspheres
If everything works, now set up your application launcher to change its instance of nvidia-settings to
optirun -b none nvidia-settings -c :8
Also within nvidia-settings or “NVIDIA X Server Settings”, NEVER touch “save to X Configuration File”, or touch anything for that matter in the “X Server Display Configuration” tab. This will most likely going result in not being able to boot to DE.
From my experience the above procedure had to be followed in the specified sequence. Any missing step or wrong sequence broke my system.
I also found a way to make steam to use optirun properly for most cases, but I will not cover there here.
-SJL