Matlab opengl software rendering after upgrading to ubuntu 20.4 - low-level graphic issue

Viewed 2301

After I upgraded my OS to ubuntu 20.04 I'm experiencing problems with matlab rendering. When I open the program I get this message:

MATLAB is selecting SOFTWARE OPENGL rendering.
Gtk-Message: 14:38:28.776: Failed to load module "canberra-gtk-module"

The program runs normally but crashes (when I say crash I mean everything just closes without giving me an error message) when plotting.

I read a lot about this issue and tried to follow other users suggestions but without success:

I tried to open matlab from the terminal with the flag:

 matlab -nosoftwareopengl

which gives me the following errors in the terminal

libGL error: MESA-LOADER: failed to open iris (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri)
libGL error: failed to load driver: iris
libGL error: MESA-LOADER: failed to open iris (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri)
libGL error: failed to load driver: iris
libGL error: MESA-LOADER: failed to open swrast (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri)
libGL error: failed to load driver: swrast

and in Matlab:

MATLAB has experienced a low-level graphics error, and may not have drawn correctly.
Read about what you can do to prevent this issue at Resolving Low-Level Graphics Issues then restart MATLAB.
To share details of this issue with MathWorks technical support,
please include this file with your service request.
Couldn't create JOGL canvas--using painters
Couldn't create JOGL canvas--using painters
Couldn't create JOGL canvas--using painters
Couldn't create JOGL canvas--using painters

The suggestions for resolving low-level graphic issues include setting opengl to 'software' which leads me back to the initial problem.

Another suggestion was to upgrade my Graphics Hardware Drivers, but since I've just upgraded my Ubuntu, shouldn't they have been upgraded in the process?

I can't believe how much time I've already spent on this, so any help is highly appreciated!

Kind regards,

1 Answers

Go to your /home/user/.bashrc and add this line:

alias matlab='export GTK_PATH=/usr/lib/x86_64-linux-gnu/gtk-2.0; export MESA_LOADER_DRIVER_OVERRIDE=i965; /usr/local/MATLAB/R2020b/bin/matlab'

save and open a new termianl window then execute

matlab

See if it works. Your might have to change your matlab version in the last part which you can check using matlabroot in MATLAB terminal.

For more, check here: https://www.mathworks.com/matlabcentral/answers/342906-could-not-initialize-shared-resources-for-x11graphicsdevice#answer_270207

Related