Can't switch anymore from Intel to NVIDIA GPU

80,926

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.

Solution 3

follow pre answers, this is the way how I get it right on my linux mint 17.2.

first I do:

sudo update-alternatives --config x86_64-linux-gnu_gl_conf

select the one with 'nvidia-prime':

sudo prime-select nvidia

then restart:

sudo init 6

Solution 4

what worked for me , I am still trying to find his post. I had so many i was viewing:

Here, this is what worked for me:

I tried:

sudo update-alternatives --config x86_64-linux-gnu_gl_conf
sudo ldconfig -n
sudo update-initramfs -u

And rebooted, with no changes. So I tried:

sudo apt-get purge libvdpau-va-gl1 bumblebee* nvidia*
sudo apt-get install linux-headers-generic
sudo apt-get install nvidia-331 nvidia-settings nvidia-prime

Reboot. Still, no changes, and the same blank error message in nvidia-settings when I try to switch to me nvidia card.

I tried switching manually, using sudo prime-switch nvidia, and configuration info was updated. I tried again, and nvidia-settings asked me to log out and log back in and...voilà! I've got it working!

In my case, it appeared that before being able to switch using nvidia-settings UI, I had to manually switch first as superuser, so as to generate the proper configuration!

Good thing I tried that, or I'd still be tinkering about, installing other drivers! Hope this proves useful to someone else!

Solution 5

I've had a problem that looked the same, and the answer was that I still had bumblebee-nvidia installed.

Notice that you're purging "everything NVIDIA" with sudo apt-get purge nvidia*, and the package above doesn't match that wildcard.

So, run command:

apt-get purge bumblebee-nvidia nvidia*

Then reboot, then install the relevant nvidia-xxx, nvidia-settings and nvidia-prime packages (I'm currently using the version 340.24 from xorg-edgers).

Now during this installation you should see the relevant update-alternatives messages about the *gnu_gl_conf files.

Share:
80,926

Related videos on Youtube

Raffael
Author by

Raffael

Updated on September 18, 2022

Comments

  • Raffael
    Raffael over 1 year

    [Ubuntu 14.04 64bit]

    After switching between Intel / NVIDIA graphics and the different NVIDIA drivers I am now suddenly stuck with the Intel GPU. It used to be no problem at all switching between the two - I cannot say for sure what is suddenly causing the issue. I think the last thing I did was switching to the "X.Org X server" driver - then something broke. The switching was part of me trying to troubleshoot issues with setting up a secondary screen.

    enter image description here

    Every time I try to switch to NVIDIA I get this very expressive error message and then it switches back to Intel :/

    I could use some assistance with troubleshooting or suggestions on what to try.

    So far I (un/re)installed the various packages "nvidia-settings" / "nvidia-current" / "nvidia-current-updates" / "nvidia-331" / "nvidia-331-updates". To no avail.

    > lspci | grep VGA
    00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)
    01:00.0 VGA compatible controller: NVIDIA Corporation GK107GLM [Quadro K2000M] (rev a1)
    

    /etc/apt/sources.list: may be found at pastebin.com


    Regarding suggestion by Qasim:

    raffael@raffael-GT60~> sudo prime-select nvidia
    [sudo] password for raffael: 
    Error: alternatives are not set up properly
    Error: nvidia mode can't be enabled
    raffael@raffael-GT60~> sudo prime-select intel
    Error: alternatives are not set up properly
    Error: intel mode can't be enabled
    

    Regarding 2nd suggestion by Qasim:

    sudo apt-get purge nvidia*
    [reboot]
    sudo apt-get install nvidia-319-updates nvidia-settings-319-updates nvidia-prime
    [reboot]
    [tried to switch to NVIDIA]
    

    Weird thing is - this actually worked the first time !? Then I switched back to Intel - log off/on - Switched back to NVIDIA - log off/on -> system crashed - error as described above.


    Regarding suggestion by Louis Matthijssen:

    raffael@raffael-GT60:~$ sudo update-alternatives --set /etc/ld.so.conf.d/x86_64-linux-gnu_GL.conf /usr/lib/nvidia-331-updates-prime/ld.so.conf
    update-alternatives: error: alternative name (/etc/ld.so.conf.d/x86_64-linux-gnu_GL.conf) must not contain '/' and spaces
    raffael@raffael-GT60:~$ ls -la /usr/lib/nvidia-331-updates-prime
    total 44
    drwxr-xr-x   2 root root  4096 Mai  2 22:45 .
    drwxr-xr-x 196 root root 32768 Mai  3 10:57 ..
    -rw-r--r--   1 root root     0 Apr  4 11:50 alt_ld.so.conf
    -rw-r--r--   1 root root    60 Apr  4 11:50 ld.so.conf
    

    Repeated algo twice - didn't work again :/

    Now it seems to work:

    raffael@raffael-GT60:~$ sudo update-alternatives --set x86_64-linux-gnu_gl_conf /usr/lib/nvidia-331-updates-prime/ld.so.conf 
    update-alternatives: using /usr/lib/nvidia-331-updates-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
    
    raffael@raffael-GT60:~$ sudo update-alternatives --set i386-linux-gnu_gl_conf /usr/lib/nvidia-331-updates-prime/alt_ld.so.conf
    update-alternatives: using /usr/lib/nvidia-331-updates-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
    

    Afterwards I could switch to NVIDIA - but wasn't offered the extended "NVIDIA X Server Settings" - will reboot now and see what happens. Follow up: It switched back to Intel after reboot and cannot switch to NVIDIA as usual. To me it seems that your method, Louis, tricks the OS into believing it uses NVIDIA while this is actually not the case.

  • Raffael
    Raffael about 10 years
    Not sure why you suggest how I should switch to Intel - but invoking the first command ends up as added to my question.
  • Louis Matthijssen
    Louis Matthijssen about 10 years
    I'm sorry, those were the wrong commands. I mean you could try to set the alternatives to the current card (Intel) as prime-select says the alternatives are broken. Then, you can try if switching to NVIDIA is working again. I don't know if this will work and you should check what the alternatives are currently pointing to, so you can restore the alternatives if this doesn't work.
  • Louis Matthijssen
    Louis Matthijssen about 10 years
    I just got exactly the same problem as you have when I tried to switch to NVIDIA. The commands I provided here worked for me. See my full output.
  • Raffael
    Raffael about 10 years
    +10 +50 for the effort ;) I guess I'll just reinstall Ubuntu when I find the time
  • Louis Matthijssen
    Louis Matthijssen about 10 years
    Okay, could you let me know if that's working? As soon as I try to switch to NVIDIA I get the same problem every time. I'm on 337 now and I'll check if it's working there.
  • Louis Matthijssen
    Louis Matthijssen about 10 years
    Doesn't work with 337 too, it's saying "unknown" again. I'm getting really tired of this because I thought this would be far more stable & easier to use than Bumblebee.
  • Arda
    Arda about 10 years
    The key was sudo prime-select nvidia for me. After I've switched from nvidia to intel, I could not switch back to nvidia, the settings app always crashed. Thanks for the command!
  • Raffael
    Raffael almost 10 years
    :-/ ... nothing bumblebish left to purge since my last attempt
  • Fern Moss
    Fern Moss over 9 years
    I didn't have this problem at all till recently, and while your fix works (input commands, reboot, can switch between NVIDIA and Intel just fine), when I reboot again the fix is somehow lost and I can't switch until I repeat the commands and, once again, reboot. Is there a way to make this permanent?
  • SnakE
    SnakE about 9 years
    For me the problem was that alternatives pointed to the Mesa driver therefore confusing the prime-select. All I had to do was reset alternatives to defaults: update-alternatives --auto i386-linux-gnu_gl_conf, update-alternatives --auto x86_64-linux-gnu_gl_conf. After that the nVidia panel started working again.
  • Goddard
    Goddard over 8 years
    I found even if I updated this I had to do it over and over again if I made any change.
  • Rakshith Ravi
    Rakshith Ravi about 8 years
    Forgive me for bringing up an old answer but I was facing the exact same issue
  • BourbonCreams
    BourbonCreams almost 7 years
    After following your instructions and after rebooting I couldn't login anymore. The login page showed up and after entering my password and hitting Enter it would show a black screen and then the login screen again. I used CTRL+Alt+F1 and used your last two commands to set it back to its previous settings. I can now login but I still can't use my NVidia card.
  • kcpr
    kcpr almost 7 years
    @BourbonCreams , sorry to hear that. I would recommend trying sudo apt-get purge nvidia-*, rebooting, adding this ppa: ppa:graphics-drivers/ppa(from webupd8.org/2016/06/… ) and installing selected driver using build-in GUI application or running sudo apt-get install nvidia-<choosen driver version> nvidia-prime - it should also work. Sometimes I got to do it twice for some reason (or at least reboot twice). To be honest, I feel that the workaround from this answer isn't perfect.
  • Scott
    Scott over 6 years
    This update didn't fix it for me, but for me it turned out that the nvidia module wasn't loading due to a bug in some symlinking, as described (and fixed) with this answer here: askubuntu.com/questions/900285/…