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  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
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
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.
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
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 🙂