Ubuntu – Cannot switch from Intel to Nvidia in Ubuntu 16.04 (Nvidia Prime)

graphicshybrid-graphicsnvidianvidia-primenvidia-settings

I cannot switch from my Intel GPU to my Nvidia GPU on Ubuntu 16.04.
I get no error messages or other problems, it just doesn't switch. Other similar questions here have not solved my problem. Here are the details:

  • HP Envy dv7 7390eb laptop with hybrid graphics (Nvidia and Intel), Ubuntu 16.04.

  • Ubuntu's Additional Drivers shows me I'm using Nvidia binary driver 367.57 (proprietary) and Processor microcode firmware for Intel CPUs from intel-microcode (proprietary).

  • I have package nvidia-367, nvidia-prime, nvidia-opencl-icd-367 and nvidia-settings installed. No bumblebee or other related packages.

  • I can start Nvidia-settings app, and select Nvidia. It tells me to logout. When I log back in, Intel is still the active card. (I use this method to know which card is active, namely sudo lshw -c video | grep configuration and then modinfo i915).

When I do sudo prime-select nvidia, I get

Info: the current GL alternatives in use are: ['mesa', 'nvidia-367']
Info: the current EGL alternatives in use are: ['mesa-egl', 'nvidia-367'] 
Info: selecting nvidia-367 for the nvidia profile
update-alternatives: using /usr/lib/nvidia-367/ld.so.conf to provide /etc/ld.so.conf.d/x86_64-linux-gnu_GL.conf (x86_64-linux-gnu_gl_conf) in manual mode 
update-alternatives: using /usr/lib/nvidia-367/ld.so.conf to provide /etc/ld.so.conf.d/x86_64-linux-gnu_EGL.conf (x86_64-linux-gnu_egl_conf) in manual mode

prime-select query then gives me: nvidia

But the above method to check which GPU is active, still tells me Intel is active. And after logout and login, it is also still Intel (the Nvidia-settings app tells me so, and so does the lshw method. prime-select query however tells me: unknown.) So basically there seems to be no way to activate my Nvidia GPU.

EDIT:
My problem is exactly the same as described here, when I launch nvidia-settings in a terminal, I also get the error

ERROR: nvidia-settings could not find the registry key file. 
This file should have been installed along with this driver at
/usr/share/nvidia/nvidia-application-profiles-key-documentation. 
The application profiles will continue to work, but values cannot be
prepopulated or validated, and will not be listed in the help text. 
Please see the README for possible values and descriptions.

However the solutions proposed there, namely

cd /usr/share/nvidia
mv nvidia-application-profiles-340.76-key-documentation
nvidia-application-profiles-key-documentation
mv nvidia-application-profiles-340.76-rc nvidia-application-profiles-rc

(changing 340.76 in the number corresponding to the actual driver on my system of course)

refers to Ubuntu 15.04 (I'm on 16.04) and does not work.

Best Answer

I had the same problem. then i did the following:

software & updates > additional drivers: select nvidia 381.09> reboot the machine

then use nvidia x settings, and then select nvidia prime.

after rebooting, everything is ok.

I hope this will help :-)