Removing NVIDIA X drivers to solve the GLX error

Recently, I was encountering this error “Could not initialize GLX”. Now, I had no clue whatsoever as to what it meant ! It was the first time I was encountering this error and I was puzzled. All I tried to do was run the plasma-mediacenter application on my Kubuntu 13.10 and I would get this strange error. Later on, I realized that this wasn’t limited just to plasma-mediacenter, but even the IDE Qt Creator was not working because of the same. Here is the output that I was getting on running that command.

➜  bin  ./qtcreator
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Xlib:  extension "GLX" missing on display ":0".
Could not initialize GLX
[1]    5937 abort (core dumped)  ./qtcreator

The error when I ran “plasma-mediacenter” was also somewhere along the same lines. I had to query about this in the IRC channels and in the mailing list where finally one Shantanu Tushar Jha(who also happens to be my mentor, perhaps unofficially) explained me that this actually meant that OpenGL wouldn’t work for me.  While this was indeed an issue, as far as running plasma-mediacenter was concerned, I could still do the same by using the command

 plasma-mediacenter --disable-opengl 

So, that issue was solved and Shantanu explained that it wouldn’t affect me greatly to run plasma-mediacenter if ran without OpenGL.  So I moved on and for a few days, I was running all applications that required and others that didn’t require OpenGL.

What was also interesting was just on the eve of the first occurence of this issue, my login screen (lightdm) on Kubuntu 13.10 was stuck in a login loop. That was perhaps the most annoying thing that I’ve ever encountered on linux. I was puzzled, I’d previously faced this issue before and that was on a VirtualBox and I didn’t bother fixing it as it didn’t have much data either. So on that occasion I just reinstalled Kubuntu 13.10 on my VirtualBox 🙂 . But that approach wouldn’t work this time, I had to get this fixed as I couldn’t afford losing precious data.

So, all I was able to do was login to a “TTY” screen pressing [ctrl+alt+F1] and logging in via terminal. There was no GUI, so start an X-session, I had to type the command

 sudo startx 

and there I was with my OS working fine as before. But wait, remember the command that brought me here ? “sudo” !!!
I was running an X-session as root and things can go horribly wrong when working as root if one is not careful enough. Moreover, I was unable to run my favorite browser — google-chrome (sorry Mozilla Firefox :P) as root. Infact you can try this if you have even chromium installed.

 sudo chromium-browser 

and it will tell you that “chromium-browser” can’t be run as root 😦 .

So, I searched for a few solutions and here is one of the best that I could find. I however, didn’t try that as my problem was solved by installing the “Kdm”

 sudo apt-get install kdm 

and it automatically configured the login display manager. This was suggested to me by a friend of mine who also happens to be a Kubuntu user and fair enough, it did work !

But I don’t quite think it solved the problem, moreover I don’t even know what had caused this problem in the first place 😀
It was only after this that I started encountering the “GLX error”. Now while I was able to login as earlier and even use plasma-mediacenter, I still hadn’t figured out the OpenGL (GLX error) and it was when I started using the Qt Creator 3.0.1 (which I build using an offline installer) that I new that I had to get the error fixed.

So, I was back at the IRC’s and I was shooting questions at various channels and finally I had reply, asking me to post the output log of /var/log/Xorg.0.log and this is when the root of the problem was found 🙂 Here it was

➜  ~  cat /var/log/Xorg.0.log
[    19.797]
X.Org X Server 1.14.5
Release Date: 2013-12-12
[    19.797] X Protocol Version 11, Revision 0
[    19.797] Build Operating System: Linux 3.2.0-37-generic x86_64 Ubuntu
[    19.797] Current Operating System: Linux ENVY 3.11.0-17-generic #31-Ubuntu SMP Mon Feb 3 21:52:43 UTC 2014 x86_64
[    19.798] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-3.11.0-17-generic.efi.signed root=UUID=f6f878ff-0773-469d-8f3b-1ff5d4212759 ro quiet splash vt.handoff=7
[    19.936] (EE) Failed to initialize GLX extension (Compatible NVIDIA X driver not found)
[  6041.766] (II) intel(0): Modeline "1366x768"x0.0   50.87  1366 1414 1446 1610  768 771 776 790 -hsync -vsync (31.6 kHz e)

And there it was ! Look at line number 12 in the above code snippet. What were the NVIDIA packages doing in a system that doesn’t even have the NVIDIA drivers installed ? My HP-Envy 4 Sleekbook/Ultrabook doesn’t come with a dedicated graphics card like those manufactured by NVIDIA. How did these packages even get there ? This was the question that I was asked on the IRC and I was clueless. I never knew how these packages got in but it was obvious that these packages had to removed. But, again I had no clue about locating thise packages, let alone removing them.

Ofcourse, you can always learn new things and the “grep” command came to my aid. I typed in

 dpkg -l | grep "nvidia" 

This gives you all the NVIDIA packages that are installed on your system and you’ll probably have to remove all of them but the “nvidia-commons” package. It by default has as a dependency, the “ubuntu-desktop” pacakge. The NVIDIA packages can be removed by using the command

 sudo apt-get remove --purge nvidia-*
(This command will remove all the NVIDIA packages installed on your system, including "nvidia-commons")

So even if you do remove the “nvidia-commons” package, you can run the installation for the “ubuntu-desktop” package by typing in

 sudo apt-get install ubuntu-desktop 

Moreover, it is also possible that the “nouveau” driver might not load in boot. To make sure that it loads in boot, type in the command as well,

 echo 'nouveau' | sudo tee -a /etc/modules 

and finally remove the xorg.conf file. You can locate it using

 locate xorg.conf 

followed by

 sudo rm /etc/X11/xorg.conf
 sudo reboot

Once your system reboots, look for the OpenGL settings and if everything has worked fine, you would have fixed the irritating “GLX” error 🙂

Cheers !

References :


12 thoughts on “Removing NVIDIA X drivers to solve the GLX error

  1. This is nonsense!

    You can make work the Nvidia drivers with GLX if you tell X11 to use the Nvidia glx libraries

    /usr/lib64/xorg/modules/extensions/libglx.. to

    if you have a 32 bit sistem replace lib64 with lib

    Good luck

      1. First of all you don’t specify what card you have, but if you had to install nouveau it means that you have an nvidia chip and that’s why you had the nvidia driver in the first place.

        I explained that you just found a work around your problem instead fixing it. I noticed that many people blame the nvidia driver because they don’t know how to use it.

        To figure out what card you have d this

        /sbin/lspci -vnn | grep VGA -A 12

        And to respond to your question, yes you should not have removed it since you replaced the driver with another open spurce driver but also for nvidia chips. Even if you do not have a dedicated card you have a card and that can be nvidia. Just check

      2. Cool, here’s what lscpi tells me :

        So, I have a hypothesis. This post was done a long time ago. Back then I was a Linux user and I’d install multiple desktop environments on a single boot(KDE, LXDE, GNOME etc). It could be remotely possible that in doing so, I happened to install some unwanted package, that probably bought in these drivers.
        The other possibility is, and I know this is stupid, I must’ve installed the package on purpose thinking it’d enhance the performance. Or was it meant to be there ?
        Now, I’ve installed my OS multiple times again. It’s cleaner, I use Kubuntu 14.10(Plasma5) and there’s no NVIDIA package AFAIK.

        What do you think ?

    1. this sounds about the perfect approach but… how to make this happen? what files do i need to modify in order to tell X11 server to use nvidia glx libs?

      1. I explained above and I’ll do it again more detailed below: Make a symbolic link fot the xorg glx lib to where the nvidia libraries are. On my system looks like this:

        ln -fs /usr/lib64/xorg/modules/extensions/$1.$2 /usr/lib64/xorg/modules/extensions/

        where $1 and $2 are the major and minor version of the nvidia library.

  2. in this case you don’t nead nuveau either since you have Intel graphics. It is possible to load all sorts of junk when you install the system, some distros install miultiple drivers so that one will be used. Since you know what yo have you should remove the others including nouveau.

    1. Yes, I think my workspace is pretty clean these days. I’m more careful while installing new packages. Right now, I don’t have nouveau either. Everything seems to be working just fine.

      Can you point us to any source(blog/forum) where one can find the proper fix to this issue ? This, like you said, was just a workaround.

      Thanks for dropping by 🙂

  3. I have had a problem with OpenGL for genymotion and it was not working. I had tried a lot of solutions over internet but nothing worked. This is the only solution which worked from me.

    Thanks for the detailed procedure.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s