I can't enable nvidia-gpu with nvidia-prime

I have a Inspiron 7559 laptop, with Nvidia 960M gpu. I installed Ubuntu 16.04 LTS, then installed nvidia drivers and bumblebee and it ran fine. Recently, I upgraded to Ubuntu 18.04 ,installed nvidia 390 drivers,and bumblebee doesn’t work. After a bit of googling, I found out that bumblebee doesn’t play with nice with nvidia-390+ drivers. Here’s a link for reference- https://bugs.launchpad.net/ubuntu/+source/bumblebee/+bug/1758243

Anyway, I decided to follow the instructions listed here https://float-middle.com/ubuntu-18-04-steam-and-nvidia-390/ but I couldn’t get bumblebee to work. I decided to ditch the whole bumblebee thing and to go only with prime-select method of managing graphics. However, when I do prime-select nvidia and reboot, then I run glxspheres I see that it’s still using intel drivers rather than the nvidia one.

I tried a number of things. I purged and reinstalled nvidia and bumblebee several times. I switched back and forth between intel and nvidia several times. I messed around with the grub file but to no avail. No matter what I do, I can’t get the computer to use nvidia graphics.

Currently, my computer doesn’t have any bumblebee. It only has nvidia-415 drivers. Also commands like nvidia-smi shows gpu information, lspci -vnn | grep ‘’’[030[02]]’ lists the GPU, modinfo | nvidia lists a bunch of things, prime-select query lists nvidia.
nvidia-bug-report.log.gz (1.03 MB)

Please run nvidia-bug-report.sh as root and attach the resulting .gz file to your post. Hovering the mouse over an existing post of yours will reveal a paperclip icon.
https://devtalk.nvidia.com/default/topic/1043347/announcements/attaching-files-to-forum-topics-posts/

I have added the bug report to the original post.

Looks like everything is in place, it just doesn’t work.
How did you install the 415 driver, from ppa? Did you uninstall the .run installer using the --uninstall option before?

  • Don’t use the .run installers, use --uninstall to uninstall them
  • purge anthing nvidia/cuda
  • add the ubuntu graphics ppa https://launchpad.net/~graphics-drivers/+archive/ubuntu/ppa
  • install the driver from that (sudo apt install nvidia-driver-415)
  • reinstall nvidia-prime and ubuntu-drivers-common

I installed from the graphics ppa. The run installer doesn’t even work for me.

I followed the instructions but nothing changed. I can’t get any software to use the discrete card.

Things to try:

  • Switch to intel, reboot, switch back to nvidia, reboot
  • Add
Option   "PrimaryGPU" "true"

inside the outputclass of /usr/share/X11/xorg.conf.d/10-nvidia.conf

  • Try with the v390 driver
  • check if the file /lib/modprobe.d/nvidia-kms.conf exists and change
    modeset=1 to modeset=0
    then run sudo update-initramfs -u

If all fails, try with the xorg.conf from here:
https://devtalk.nvidia.com/default/topic/1022670/linux/official-driver-384-59-with-geforce-1050m-doesn-t-work-on-opensuse-tumbleweed-kde/post/5203910/#5203910

Adding

Option   "PrimaryGPU" "true"

to the the 10-nvidia.conf file did the trick! The only problem I have is that for certain animations(like the loading animation of the Plasma desktop), it runs too fast with no sort of framelimiting. But as far as I’m concerned, the gpu works as it should. So thank you.

Try with kernel parameter
nvidia-drm.modeset=1
to get vsync.

Oh yeah, enabling v-sync with nvidia-drm.modeset=1 fixed the animation issues. I dont have any problem now.