Matlab hangs when closing/exiting on Ubuntu 16.10

16 views (last 30 days)
I can start and use Matlab with no problem, except when trying to exit. When I hit the close button on the top right corner or type the exit command, Matlab hangs. I have to manually kill the process. No problems exiting when starting matlab without jvm.
Is there any fix or workaround to this problem?
I am currently using Xubuntu 16.10 and Matlab 2016b (student license).
$ uname -a
Linux smallhead 4.8.0-34-generic #36-Ubuntu SMP Wed Dec 21 17:24:18 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Accepted Answer

Vandana Ravichandran
Vandana Ravichandran on 19 Jan 2017
This crash may be related to an issue with the graphics drivers. You may be able to resolve this problem by running the following command in MATLAB:
>> opengl save software
Restart MATLAB and see if the problem still persists.
If the problem still persists or you never get a MATLAB command prompt at all, check to make sure that your user account has access to a home directory.
If your account is using symbolic links to point to a home directory, remove them and grant access to an actual home directory and the issue should be resolved.
  1 Comment
Hector Flores Rodriguez
Hector Flores Rodriguez on 19 Jan 2017
That worked like a charm. It seems like the issue was that my laptop's graphics wasn't cutting it.
Thank you!

Sign in to comment.

More Answers (1)

Breno Odnan Souza
Breno Odnan Souza on 23 Sep 2021
Hello there!
I have the same problem on my Ubuntu 20.04
Running "opengl save software" did work for opening and closing MATLAB only, but the problem persists when Simulink is used.
I have tried Opening MATLAB, (1)running "opengl save software", (2) opening simulink, then (3)Closing simulink, and finally closing MATLAB. After this process, MATLAB still hangs in the background, even when doing (1) after (2) or after (3).
Is there any variant of this fix for simulink?
The following messages appear on the terminal running MATLAB (wheter or not (1) is used)
MATLAB is selecting SOFTWARE OPENGL rendering.
Gtk-Message: 19:09:09.593: Failed to load module "canberra-gtk-module"
MESA-LOADER: failed to open iris: /usr/lib/dri/ não é possível abrir arquivo compartilhado: Arquivo ou diretório inexistente (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri)
failed to load driver: iris
MESA-LOADER: failed to open kms_swrast: /usr/lib/dri/ não é possível abrir arquivo compartilhado: Arquivo ou diretório inexistente (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri)
failed to load driver: kms_swrast
MESA-LOADER: failed to open swrast: /usr/lib/dri/ não é possível abrir arquivo compartilhado: Arquivo ou diretório inexistente (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri)
failed to load swrast driver
Currently running R2021b - Trial license
$ uname -a
Linux Charizard-L 5.11.0-34-generic #36~20.04.1-Ubuntu SMP Fri Aug 27 08:06:32 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Chao Wang
Chao Wang on 11 Mar 2022
I've experienced similar issue, and the program would return after hanging about five minutes. Matlab R2021b on Ubuntu Linux 20.04, run with the following bash script at the command line prompt:
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu/dri/
matlab -desktop
After I closed the Matlab window, the terminal would hang for about five minutes before it could return to the prompt. I used top to see that the matlab process takes 100% of one of the CPU cores, and the corresponding thread is shown to be "MCR 0 interpret." Hope this info would help identify the problem.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!