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/showthre...strously/page2).

0. I install OpenSUSE LEAP 42.3/15.0/15.1+ with a bootmode: nomodeset. This means the laptop should have in
Code:
/etc/default/grub
Code:
GRUB_CMDLINE_LINUX_DEFAULT="splash=silent quiet mitigations=auto nomodeset"
with no update applied whatsoever. Just fresh install with nomodeset in default boot mode.

1. I add default Nvidia repository from the community packages.
Code:
zypper addrepo --refresh 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.

2. 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.
Code:
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.

3. Now make sure all of the packages are loaded and refreshed.
Code:
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.
Code:
sudo zypper in cuda-tools-10-1 cuda-toolkit-10-1 cuda
Do not reboot yet.

5.Remove nomodeset from
Code:
/etc/default/grub
Code:
GRUB_CMDLINE_LINUX_DEFAULT="splash=silent quiet mitigations=auto nomodeset"
Make sure that grub is updated with
Code:
sudo mkinitrd
6.Reboot.

7. Update
Code:
sudo zypper up
8.Set up codecs
Code:
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.
Code:
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.
Code:
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.

12. Install bumblebee.
Code:
sudo zypper in bumblebee bbswitch
Code:
sudo usermod -aG bumblebee $USER
sudo usermod -aG video $USER
turn it on
Code:
sudo systemctl enable bumblebeed
sudo systemctl start bumblebeed
Install 32 bit libraries:
Code:
sudo zypper in Mesa-libGL1-32bit libX11-6-32bit primus-32bit
Install Mesa-demo for testing.
Code:
sudo zypper in Mesa-demo-x Mesa-demo
configure
Code:
/etc/bumblebee/bumblebee.conf
Change the following lines under [bumblebeed]:
Code:
TurnCardOffAtExit=true
Driver=nvidia
Change the following lines under [driver-nvidia]:
Code:
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:
Code:
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.
Code:
mkinitrd
At least all of my laptops needed the following. You need to change a line in:
Code:
/etc/modprobe.d/50-bbswitch.conf
Code:
options bbswitch load_state=-1 unload_state=1
source: (https://en.opensuse.org/SDB:NVIDIA_Bumblebee)
13. reboot, update, reboot, and test. First with:
Code:
optirun --status
Bumblebee status: Ready (3.2.1). X inactive. Discrete video card is off.
Then test with mesa demo package
Code:
optirun glxgears 
optirun glxspheres
If everything works, now set up your application launcher to change its instance of nvidia-settings to

Code:
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