Can't switch anymore from Intel to NVIDIA GPU
Solution 1:
As you get the following error:
Error: alternatives are not set up properly
You may try to set the alternatives yourself.
When I switch to Intel I see:
update-alternatives: using /usr/lib/nvidia-331-prime/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-331-prime/alt_ld.so.conf to provide /etc/ld.so.conf.d/i386-linux-gnu_GL.conf (i386-linux-gnu_gl_conf) in manual mode
When I switch to NVIDIA I see:
update-alternatives: using /usr/lib/nvidia-331/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-331/alt_ld.so.conf to provide /etc/ld.so.conf.d/i386-linux-gnu_GL.conf (i386-linux-gnu_gl_conf) in manual mode
So you could try this to switch to Intel:
sudo update-alternatives --set x86_64-linux-gnu_gl_conf /usr/lib/nvidia-331-prime/ld.so.conf
sudo update-alternatives --set i386-linux-gnu_gl_conf /usr/lib/nvidia-331-prime/alt_ld.so.conf
Obviously you should replace 331 by your own version.
Now you could try a few things to trigger the switch:
-
Log out and log in again
to restart the X server as you normally would do
-
Reboot your whole PC
for the same purpose of the above
-
Execute
sudo prime-select nvidia
as your alternatives are now set for Intel, I hope this will also fix any other settings so that everything is as it should be again (obviously you should still restart the X server)
I hope that I've interpreted the error right.
Also, you could use prime-select query
to check which card is currently selected, and fix the alternatives for that card (for example NVIDIA) as you may somehow have set alternatives for the other card (for example Intel), but the tool is still thinking that you're using the other card (for example NVIDIA), thus giving an error saying that the alternatives are not set up properly.
Solution 2:
I think I've found a workaround at least.
It's all about update-alternatives
.
I've noticed that both
sudo update-alternatives --config i386-linux-gnu_gl_conf
and
sudo update-alternatives --config x86_64-linux-gnu_gl_conf
returns list containing /usr/lib/i386-linux-gnu/mesa/ld.so.conf
or similar.
Somehow after every reboot /usr/lib/i386-linux-gnu/mesa/ld.so.conf
was set as choosen even if I've changed it before manually.
I tried changing the order on that list, but finally the solution was to remove it by
sudo update-alternatives --remove x86_64-linux-gnu_gl_conf /usr/lib/x86_64-linux-gnu/mesa/ld.so.conf
and
sudo update-alternatives --remove i386-linux-gnu_gl_conf /usr/lib/i386-linux-gnu/mesa/ld.so.conf
That should be enough.
If not, set both 'i386' and 'x86_64' to the same option by
sudo update-alternatives --config x86_64-linux-gnu_gl_conf
and
sudo update-alternatives --config x86_64-linux-gnu_gl_conf
Reboot afterwards.
You can always restore it to original state by
sudo update-alternatives --install /etc/ld.so.conf.d/i386-linux-gnu_GL.conf i386-linux-gnu_gl_conf /usr/lib/i386-linux-gnu/mesa/ld.so.conf 500
and
sudo update-alternatives --install /etc/ld.so.conf.d/x86_64-linux-gnu_GL.conf x86_64-linux-gnu_gl_conf /usr/lib/x86_64-linux-gnu/mesa/ld.so.conf 500
Hope that it will also work for You.