Error displayed when starting MATLAB on Linux systems using NVIDIA OR AMD graphics hardware

Hey,
I'm using Dell precision 7510 with preinstalled Ubuntu 14.04(I have the driver the NVIDIA). I just downloaded the MATLAB 2017a and I run into the following error. I just searched and found it's not just me who have the same problem. I wonder if this problem is fixable? To put it in another way, could I use all the features provided by MATALB with this error?
Thank you in advance, attached is the error infor
com.jogamp.opengl.GLException: X11GLXDrawableFactory - Could not initialize shared resources for X11GraphicsDevice[type .x11, connection :0, unitID 0, handle 0x0, owner false, ResourceToolkitLock[obj 0x413b9df1, isOwner false, <30fe5aac, af2eb55>[count 0, qsz 0, owner <NULL>]]]
at jogamp.opengl.x11.glx.X11GLXDrawableFactory$SharedResourceImplementation.createSharedResource(X11GLXDrawableFactory.java:326)
at jogamp.opengl.SharedResourceRunner.run(SharedResourceRunner.java:297)
at java.lang.Thread.run(Unknown Source)
Caused by: com.jogamp.opengl.GLException: glXGetConfig(0x1) failed: error code Unknown error code 6
at jogamp.opengl.x11.glx.X11GLXGraphicsConfiguration.glXGetConfig(X11GLXGraphicsConfiguration.java:570)
at jogamp.opengl.x11.glx.X11GLXGraphicsConfiguration.XVisualInfo2GLCapabilities(X11GLXGraphicsConfiguration.java:500)
at jogamp.opengl.x11.glx.X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationXVisual(X11GLXGraphicsConfigurationFactory.java:434)
at jogamp.opengl.x11.glx.X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(X11GLXGraphicsConfigurationFactory.java:240)
at jogamp.opengl.x11.glx.X11GLXDrawableFactory.createMutableSurfaceImpl(X11GLXDrawableFactory.java:524)
at jogamp.opengl.x11.glx.X11GLXDrawableFactory.createDummySurfaceImpl(X11GLXDrawableFactory.java:535)
at jogamp.opengl.x11.glx.X11GLXDrawableFactory$SharedResourceImplementation.createSharedResource(X11GLXDrawableFactory.java:283)
... 2 more

 採用された回答

Kushagr Gupta
Kushagr Gupta 2023 年 8 月 30 日
編集済み: MathWorks Support Team 2023 年 8 月 30 日
This low-level graphics error is an NVIDIA driver issue. If possible, downgrade to a previous NVIDIA driver, such as the one that was on the system before the update.
1. Start MATLAB with 'nodesktop' AND the 'opengl' info command, and then open the desktop. This gets the right library load order for everything to work. Try to start MATLAB with the following command (in the Windows Command Prompt) :
>>matlab -nodesktop -r "opengl info, desktop"
This command starts MATLAB with "nodesktop" and the "opengl info" command, and then opens the desktop. The downside is you cannot start MATLAB in the background, or suspend (Ctrl-Z) and push it to the background (bg).
This might have to be used in conjunction with the "libstdc++.so.6" library being incompatible which can be resolved using the workaround in the following bug report :
2. Downgrade from NVIDIA driver version 367.57 to version 340.98, a stable previous release:
3. Keep an eye out for new NVIDIA drivers on the NVIDIA website:
4. If it is not possible or preferable to change your graphics driver, use MATLAB with Software OpenGL. Open MATLAB from the Linux Terminal with the following command:
$ matlab -softwareopengl
You can set your preferences so that MATLAB always starts with Software OpenGL by executing the following in the MATLAB Command Window:
>> opengl('save','software')
You can always revert to your default graphics renderer with the following:
>> opengl('save','none')
Please refer to the following possible workarounds if the above does not resolve the issue:
1)  Hardware OpenGL Renderer Workaround:
         -  Create a file named 'java.opts' in the directory where MATLAB is executed with the following line added and start MATLAB:
-Djogl.disable.openglarbcontext=1
        Please refer to the following documentation page for additional details about creating a 'java.opts' file:
2)  Painters Renderer Workaround:
         - Start MATLAB with the '-noopengl' startup option. This can be done by running the following command on the terminal:
matlab -noopengl

6 件のコメント

Cliff Bargar
Cliff Bargar 2018 年 8 月 27 日
Thanks, I'm running MATLAB in an Ubuntu VM and was experiencing this problem. I tried options 1-3 unsuccessfully but option 4 seems to work
Danit Gino
Danit Gino 2022 年 5 月 24 日
same for me, only option 4 worked well
Beatriz Extremo
Beatriz Extremo 2022 年 10 月 11 日
thank you! Option 4 worked for me
Akhilesh
Akhilesh 2022 年 12 月 11 日
Thank you so much.....4th option is working pretty well......
The "matlab -softwareopengl" command works very well. I had this problem but with this command no more problem. Thanks
The java.opts option worked for Fedora 41 on intel, thanks so much!

サインインしてコメントする。

その他の回答 (8 件)

Willi Mutschler
Willi Mutschler 2020 年 4 月 12 日
Hi,
I am on Ubuntu 20.04 beta and running the nvidia on-demand prime profile, and get the same error. I can solve this (see the Archwiki) by starting matlab from terminal:
export MESA_LOADER_DRIVER_OVERRIDE=i965; matlab
Or (additionaly) you can change the EXEC in /usr/share/applications/matlab.desktop to:
Exec=env MESA_LOADER_DRIVER_OVERRIDE=i965 matlab -desktop

20 件のコメント

Andrea Pasqualini
Andrea Pasqualini 2020 年 4 月 24 日
I'm on Ubuntu 20.04 (just released today) and I'm on a ThinkPad T470 (no discrete GPU). I'm running into the same issue and modifying the Exec line in /usr/share/applications/matlab.desktop fixed the problem for me, too. Thank you!
Fredrik Fryklund
Fredrik Fryklund 2020 年 4 月 26 日
Same, but X1 Carbon. This solved the problem. Thank you!
Isidro Losada López
Isidro Losada López 2020 年 4 月 28 日
編集済み: Isidro Losada López 2020 年 4 月 28 日
I'm on Ubuntu 18.04.4 LTS and Mesa Intel(R) HD Graphics 520 (SKL GT2). Due to some automatic updates I got the issue this morning. I tried to start Matlab with the flag -softwareopengl and it worked, but the quality of the graphics was so bad. So then, I tried to modify the EXEC line in matlab.desktop and now it works with good graphics quality, like before the issue appears. Thank you very much! (Now I'll try to figure out what' happening haha)
Wojciech Krauze
Wojciech Krauze 2020 年 4 月 29 日
I confirm that this solutions solves the problem without downgrading the driver.
Mateusz Litwin
Mateusz Litwin 2020 年 5 月 2 日
Same, but MSI PE70 7RD. This solution solved problem. Thanks.
Tunde Aluko
Tunde Aluko 2020 年 6 月 9 日
This works for me on Ubuntu 20.04 LTS.
This (first command) worked for me too on Ubuntu 20.04 LTS with an Nvidia graphics card. Weirdly altering matlab.desktop did not work.
Nick Evstigneev
Nick Evstigneev 2020 年 8 月 4 日
Here is the source of the problem for intel GPUs with CPUs gen 7 or less:
Rogier Delporte
Rogier Delporte 2020 年 12 月 15 日
編集済み: Rogier Delporte 2020 年 12 月 16 日
This (first command) worked for me too on Ubuntu 20.04.1 LTS with Mesa Intel® UHD Graphics 630 (CFL GT2) as graphics. Weirdly altering matlab.desktop did not work. It seems like Matlab tries to load an Iris driver, but I am not sure if I have that driver installed at all.
EDIT: I found the problem, there was a matlab.desktop file in /usr/share/applications/ and one in ~/.local/share/applications (probably one I made myself), the latter of which came on my icon and that one I didn't edit.
BTW: does anyone have any idea if it is possible to get MATLAB running with the IRIS drivers yet?
Abinash Dash
Abinash Dash 2020 年 12 月 16 日
編集済み: Abinash Dash 2020 年 12 月 16 日
With "export MESA_LOADER_DRIVER_OVERRIDE=i965; matlab" , now I can use hardware opengl on my system(MX linux 19, Intel HD Graphics 620). Thanks.
Thanks man, it worked
I think
Exec=env MESA_LOADER_DRIVER_OVERRIDE=i965 matlab -desktop
is missing a semi-colon. So should be
Exec=env MESA_LOADER_DRIVER_OVERRIDE=i965; matlab -desktop
which worked in the /usr/share/applications/matlab.desktop
hey,
well this ( export MESA_LOADER_DRIVER_OVERRIDE=i965; matlab ) worked for me and resolved my problem but i have to open matlab everytime with this command. is there any permanent fix to this issue??
everytime i use the about command it opens fine but otherwise showing the same errors..
Hi,
I had the same issue with an Intel® UHD Graphics (CML GT2) on-board graphics card and also could solve it by calling
export MESA_LOADER_DRIVER_OVERRIDE=i965
This command sets an envrionment variable. To make it permanent to your system, check out the following thread:
Personally, I would suggest to add to it your
/ect/environment
I did exactly this and it works for me.
Best of luck
S. Cho
S. Cho 2021 年 10 月 30 日
I had the same issue with Fedora 34, R2021b, the suggested solution solved the problem.
export MESA_LOADER_DRIVER_OVERRIDE=i965
Below is my video card information from lspci -v:
00:02.0 VGA compatible controller: Intel Corporation WhiskeyLake-U GT2 [UHD Graphics 620] (prog-if 00 [VGA controller])
Subsystem: LG Electronics, Inc. Device 0325
Exec=env MESA_LOADER_DRIVER_OVERRIDE=i965; matlab -desktop
A semicolon is missing!
Daniele Picone
Daniele Picone 2022 年 7 月 26 日
編集済み: Daniele Picone 2022 年 7 月 26 日
Damn I looked for this issue forever and this was the only thing that worked for me! Thanks a lot!
Ivo
Ivo 2022 年 9 月 23 日
Very elegant solution, thanks!
Mustafa Melih
Mustafa Melih 2022 年 11 月 11 日
First line worked for me thanks a lot! (Ubuntu 20.04, Matlab 2022b, Intel Core i7, Nvidia 2060, Monster Notebook)
Oben
Oben 2022 年 11 月 24 日
I was not able to visualize data on scope tool because of this error. I copied "export MESA_LOADER_DRIVER_OVERRIDE=i965" into "/ect/environment" directory. I don't have to call it everytime now. Thank you so much Willi Mutschler and Felix Sch
My system: Ubuntu 20, Matlab 2022b, Intel Core 7, Nvidia 1050, Monster Notebook

サインインしてコメントする。

Willi Mutschler
Willi Mutschler 2020 年 4 月 26 日
編集済み: Willi Mutschler 2020 年 4 月 26 日

23 投票

I also ran into this issue on my Dell XPS 13 9360 which neither has a NVIDIA or AMD card, but an on-board intel graphics card.
I filed a bug report with MATHWORKS and they proposed two solutions:
  1. Create a file with the name 'java.opts' in the directory where MATLAB is executed (for me this is in '/usr/local/MATLAB/R2020a/bin/glnxa64') with the following line: -Djogl.disable.openglarbcontext=1
  2. If this does not work, then the above solution using export MESA_LOADER_DRIVER_OVERRIDE=i965 is working.
For me both solve my issue.

10 件のコメント

Biswarup Biswas
Biswarup Biswas 2020 年 4 月 27 日
Thanks Willi Mutschler. Both 1 and 2 working for me.
Gaurav Nirala
Gaurav Nirala 2021 年 2 月 13 日
Thanks @Willi Mutschler. Both worked for me too. This is a lifesaver for people doing MATLAB on linux.
Michiel Firlefyn
Michiel Firlefyn 2021 年 3 月 14 日
only 1 is working for me
2 works when I am launching from the command line
1 works when I am launching from the *.desktop file
Thanks for this tip. The first option, by doing point 1 suggested by Willi Mutschler, works for me. I am using linux mint with kernel 5.13.0-35-generic in a Dell Inspiron-3501. The matlab version is R2022a.
Abel Alvarez
Abel Alvarez 2022 年 4 月 29 日
Thaks for the trick. The first option worked very well
Thank you. First option worked :-)
Cyprien Tamekue
Cyprien Tamekue 2022 年 6 月 16 日
編集済み: Cyprien Tamekue 2022 年 6 月 16 日
Thank you! The first option also works for me on Ubuntu 20.04.4 LTS. The matlab version is R2022a.
Sudip Kumar
Sudip Kumar 2022 年 10 月 31 日
編集済み: Sudip Kumar 2022 年 10 月 31 日
Option 1 worked for me on Ubuntu 22.04 and Matlab R2022a. Thanks.
Matias
Matias 2024 年 9 月 10 日
Thanks a lot for this! Option 1 worked for me with Ubuntu 22.04.4 LTS and Matlab R2023b.

サインインしてコメントする。

Georg Beyerle
Georg Beyerle 2018 年 10 月 6 日

2 投票

Same behaviour with R2018b on openSUSE Leap 15 with ATI Radeon HD 5450 graphics card.
Miroslav Flídr
Miroslav Flídr 2018 年 4 月 19 日

1 投票

The problem is caused by changes in NVIDIA drivers 361.xx and newer and MATLAB reliance on driver behavior outside standard Linux OpenGL ABI (thus it's mainly MathWorks problem). These changes are described here . I could solve the problem by replacing the libGL.so.1.0.0 driver library from the official NVIDIA binary driver installer. First check the version of the driver used in the system, e.g. using nvidia-smi utility. Download the driver https://www.geforce.com/drivers. Then unpack the downloaded driver installer using the --extract-only installer command line switch. Finally replace the installed libGL.so.1.0.0 library file with the libGL.so.$VERSION file from the unpacked installer (the file must be renamed to libGL.so.1.0.0).

I already lost hope that the MathWorks will fix anytime soon this two years old bug.

Christopher Wong
Christopher Wong 2021 年 8 月 28 日
編集済み: Christopher Wong 2021 年 8 月 28 日
For AMD GPUs on Ubuntu:
If you're using an AMD graphics card on Ubuntu (or perhaps some other flavor of Linux) and you are having this issue, or if you notice that MATLAB automatically switches to a software implementation of OpenGL, you most likely need to install the amdgpu-pro package, which includes all of the open-sourced drivers, plus a few of the proprietary drivers, mainly Vulkan. The Ubuntu software repositories only maintain a stable release of the amdgpu package, which appears to not provide enough to support MATLAB. I reccomend installing amdgpu-pro. AMD GPUs and drivers are very reliable in Ubuntu OS (much more so than NVIDIA). It's totally safe to install and I've never had any issues.
Set your OpenGL preference to 'none' in MATLAB so that it's automatically determined at the start of each session:
opengl('save', 'none')
Then close MATLAB. Now, go and find the latest AMD drivers for your GPU and OS here and download the tarball. Carefully follow the instructions they provide you to unpack and install the drivers (but don't take too literally their recommendation to use amdgpu-pro with their Pro series GPUs, it works for their consumer products as well, e.g., I have a Radeon RX 5700 XT). I recommend just going with the heaviest pro install option that includes the OpenCL components, i.e., run the installer by the following command:
./amdgpu-pro-install -y --opencl=rocr,legacy
Finally, reboot your system and open MATLAB. The output from the rendererinfo(gca) command should indicate that the renderer is using a hardware-accelerated version of OpenGL.

1 件のコメント

Christopher Wong
Christopher Wong 2021 年 8 月 28 日
編集済み: Christopher Wong 2021 年 8 月 28 日
P.S., I realize my answer isn't 100% focused on the original question (since @Yalun Wen's problem was with an NVIDIA GPU), but I ended up here through the same error key "Could not initialize shared resources for X11GraphicsDevice" and I noticed a few others mentioning AMD/ATI on this thread so I figured I'd drop my solution. None of the solutions posted here worked for me. I simply needed the additional driver components provided by the pro package.

サインインしてコメントする。

Abel Alvarez
Abel Alvarez 2022 年 11 月 1 日
編集済み: Abel Alvarez 2022 年 11 月 1 日
Hello, I installed Matlab in ubuntu 20.04, I have HP probook with Device-1: Intel UHD Graphics 620 vendor: Hewlett-Packard driver: i915 v: kernel bus ID: 00:02.0 Display: x11 server: X.Org 1.20.13 driver: i915 resolution: 1366x768~60Hz, 1920x1080~60Hz OpenGL: renderer: Mesa Intel UHD Graphics 620 (WHL GT2) v: 4.6 Mesa 21.2.6 direct render: Yes
and I have this error, I can't run a graphical. I don't know that do
When I lauch matlab in the terminal appear this messenge
Failed to load module "canberra-gtk-module". I try install module canberra with following instructions
sudo apt-get install --reinstall libcanberra-gtk-module and other alternatives but the error persists
help me!!!

3 件のコメント

Beatriz Extremo
Beatriz Extremo 2022 年 11 月 2 日
For me the 4th option presented by Kushagr Gupta worked to get the graphics again.
Govind
Govind 2023 年 2 月 18 日
For me also the 4th option presented by Kushagr Gupta worked to get the graphics again.
Try to open matlab in terminal window with this command:
$ matlab -softwareopengl
I had the same problem but with this command no more problem. Thanks

サインインしてコメントする。

chao yao
chao yao 2019 年 1 月 15 日

0 投票

I have the same issue with AMD Radeon VEGA 64, the 4th solution in the accepted answer works for me.
Diego Blanco
Diego Blanco 2023 年 7 月 25 日
編集済み: Diego Blanco 2023 年 7 月 25 日
I'm currently running Ubuntu 22.04 with Nvidia drivers and the "on-demand" prime profile. In this case, if matlab is run with
matlab -desktop
it defaults to software OpenGL. By forcing it to use hardware acceleration with
matlab -nosoftwareopengl -desktop
the error in question appears.
You can force it to launch using the dedicated GPU by running on the terminal:
switcherooctl launch matlab -nosoftwareopengl -desktop
The "switcherooctl launch" part is equivalent to selecting the option "Launch with dedidated graphics card" on the gnome desktop. More info here.

カテゴリ

ヘルプ センター および File ExchangeStartup and Shutdown についてさらに検索

製品

リリース

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by