Sudden OpenGL Problems on Ubuntu 20 with P2D and P3D

I’m running Ubuntu 20.04 on a Dell T5500 with an NVIDIA Quadro K4000, and the nvidia-drivers-440 driver.

I’ve been toying with a lot of settings over the last few days, working on a few projects, and suddently I can’t run any processing sketches in an OpenGL rendering mode. I’m wondering if there’s a decent way to purge/clean/reset my driver scenario so that I can run code again.

As an example, the following code produces the following error message.

void setup()
{
  size(500,500,P2D);
}

void draw(){}
Caught handled GLException: EGLGLXDrawableFactory - Could not initialize shared resources for EGLGraphicsDevice[type .egl, v0.0.0, connection :1, unitID 0, handle 0x0, owner true, ResourceToolkitLock[obj 0x69ca2ae4, isOwner true, <6bbebd19, 1130efd7>[count 1, qsz 0, owner <main-SharedResourceRunner>]]] on thread main-SharedResourceRunner
    [0]: jogamp.opengl.egl.EGLDrawableFactory$SharedResourceImplementation.createSharedResource(EGLDrawableFactory.java:518)
    [1]: jogamp.opengl.SharedResourceRunner.run(SharedResourceRunner.java:353)
    [2]: java.lang.Thread.run(Thread.java:748)
Caused[0] by GLException: Failed to created/initialize EGL display incl. fallback default: native 0x0, error 0x3001/0x3002 on thread main-SharedResourceRunner
    [0]: jogamp.opengl.egl.EGLDisplayUtil.eglGetDisplayAndInitialize(EGLDisplayUtil.java:297)
    [1]: jogamp.opengl.egl.EGLDisplayUtil.access$300(EGLDisplayUtil.java:58)
    [2]: jogamp.opengl.egl.EGLDisplayUtil$1.eglGetAndInitDisplay(EGLDisplayUtil.java:320)
    [3]: com.jogamp.nativewindow.egl.EGLGraphicsDevice.open(EGLGraphicsDevice.java:125)
    [4]: jogamp.opengl.egl.EGLDrawableFactory$SharedResourceImplementation.createEGLSharedResourceImpl(EGLDrawableFactory.java:532)
    [5]: jogamp.opengl.egl.EGLDrawableFactory$SharedResourceImplementation.createSharedResource(EGLDrawableFactory.java:516)
    [6]: jogamp.opengl.SharedResourceRunner.run(SharedResourceRunner.java:353)
    [7]: java.lang.Thread.run(Thread.java:748)
Caught handled GLException: X11GLXDrawableFactory - Could not initialize shared resources for X11GraphicsDevice[type .x11, connection :1, unitID 0, handle 0x0, owner false, ResourceToolkitLock[obj 0x46e1f5c2, isOwner false, <52e2490f, 7c1407ce>[count 0, qsz 0, owner <NULL>]]] on thread main-SharedResourceRunner
    [0]: jogamp.opengl.x11.glx.X11GLXDrawableFactory$SharedResourceImplementation.createSharedResource(X11GLXDrawableFactory.java:306)
    [1]: jogamp.opengl.SharedResourceRunner.run(SharedResourceRunner.java:353)
    [2]: java.lang.Thread.run(Thread.java:748)
Caused[0] by GLException: main-SharedResourceRunner: Unable to create temp OpenGL context(1) on thread main-SharedResourceRunner
    [0]: jogamp.opengl.x11.glx.X11GLXContext.createImpl(X11GLXContext.java:390)
    [1]: jogamp.opengl.GLContextImpl.makeCurrentWithinLock(GLContextImpl.java:765)
    [2]: jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:648)
    [3]: jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:586)
    [4]: jogamp.opengl.x11.glx.X11GLXDrawableFactory$SharedResourceImplementation.createSharedResource(X11GLXDrawableFactory.java:277)
    [5]: jogamp.opengl.SharedResourceRunner.run(SharedResourceRunner.java:353)
    [6]: java.lang.Thread.run(Thread.java:748)
Caught handled GLException: EGLGLXDrawableFactory - Could not initialize shared resources for X11GraphicsDevice[type .x11, connection :1, unitID 0, handle 0x0, owner false, ResourceToolkitLock[obj 0x46e1f5c2, isOwner true, <52e2490f, 7c1407ce>[count 1, qsz 0, owner <main-SharedResourceRunner>]]] on thread main-SharedResourceRunner
    [0]: jogamp.opengl.egl.EGLDrawableFactory$SharedResourceImplementation.createSharedResource(EGLDrawableFactory.java:518)
    [1]: jogamp.opengl.SharedResourceRunner.run(SharedResourceRunner.java:353)
    [2]: java.lang.Thread.run(Thread.java:748)
Caused[0] by GLException: Failed to created/initialize EGL display incl. fallback default: native 0x0, error 0x3001/0x3002 on thread main-SharedResourceRunner
    [0]: jogamp.opengl.egl.EGLDisplayUtil.eglGetDisplayAndInitialize(EGLDisplayUtil.java:297)
    [1]: jogamp.opengl.egl.EGLDisplayUtil.access$300(EGLDisplayUtil.java:58)
    [2]: jogamp.opengl.egl.EGLDisplayUtil$1.eglGetAndInitDisplay(EGLDisplayUtil.java:320)
    [3]: com.jogamp.nativewindow.egl.EGLGraphicsDevice.open(EGLGraphicsDevice.java:125)
    [4]: jogamp.opengl.egl.EGLDrawableFactory$SharedResourceImplementation.createEGLSharedResourceImpl(EGLDrawableFactory.java:532)
    [5]: jogamp.opengl.egl.EGLDrawableFactory$SharedResourceImplementation.createSharedResource(EGLDrawableFactory.java:516)
    [6]: jogamp.opengl.SharedResourceRunner.run(SharedResourceRunner.java:353)
    [7]: java.lang.Thread.run(Thread.java:748)
com.jogamp.opengl.GLException: Profiles [GL4bc, GL4, GL3bc, GL3, GLES3, GL2, GLES2] not available on device X11GraphicsDevice[type .x11, connection :1, unitID 0, handle 0x0, owner false, ResourceToolkitLock[obj 0x46e1f5c2, isOwner false, <52e2490f, 7c1407ce>[count 0, qsz 0, owner <NULL>]]]
	at com.jogamp.opengl.GLProfile.get(GLProfile.java:1039)
	at com.jogamp.opengl.GLProfile.get(GLProfile.java:1050)
	at com.jogamp.opengl.GLProfile.getMaxProgrammable(GLProfile.java:826)
	at processing.opengl.PSurfaceJOGL.initGL(PSurfaceJOGL.java:203)
	at processing.opengl.PSurfaceJOGL.initFrame(PSurfaceJOGL.java:136)
	at processing.core.PApplet.initSurface(PApplet.java:11035)
	at processing.core.PApplet.runSketch(PApplet.java:10922)
	at processing.core.PApplet.main(PApplet.java:10620)
GLException: Profiles [GL4bc, GL4, GL3bc, GL3, GLES3, GL2, GLES2] not available on device X11GraphicsDevice[type .x11, connection :1, unitID 0, handle 0x0, owner false, ResourceToolkitLock[obj 0x46e1f5c2, isOwner false, <52e2490f, 7c1407ce>[count 0, qsz 0, owner <NULL>]]]
2 Likes

Because I got PMs about this topic, I’ll post my steps that eventually solved my problem.

sudo apt-get purge nvidia*
sudo apt-get remove nvidia*
sudo apt autoremove
sudo ubuntu-drivers autoinstall

reboot got me to a tty0 that wouldn’t do anything but blink a cursor, so with CTRL+ALT+F2 I got to a new tty and performed this:
sudo update grub

Then rebooting I was able to actually see a X session and my old login.
After starting I kept adding to the following installers until I got my P3D sketches to run:
sudo apt install libnvidia-compute-440
sudo apt install libnvidia-common-440
sudo apt install libnvidia-gl-440
I’m not sure compute was necessary, but I’ve added it for the sake of completion.

Note: I’m not a Linux expert, and this is really a scorched earth method of wiping a system of drivers and starting fresh. I wasn’t certain I would be able to get an X session to start without a fresh install of Ubuntu, knowing my own abilities.

3 Likes