matlab won't start on Ubuntu 20.04
230 views (last 30 days)
When I run the matlab command, nothing pops up and a process is created. It uses 100% CPU but almost no memory. Tried 2021a, 2020b but both have the same issues.
- sudo chown xxx -R ./matlab
- sudo apt-get intsall matlab-support: the installation seems to require execution of matlab command - whenever I try to install, it hangs because matalb command is not responding - I'll need to end the matlab command manually and the installation will continue. Doesn't seem to work even with it installed.
- Removing preferences
What would be something else to try? Thank you.
Rishik Ramena on 23 Aug 2021
If you are having trouble starting MATLAB on a UNIX-based system and you are not receiving license manager related errors, your start up problems may be resolved by performing the following steps:
Solution #1: Remove Preferences
Remove your preferences directory, so that it can be recreated cleanly:
1. Open the Terminal Application (usually found in Applications or Utilities).
2. In the terminal window and run the following commands:
3. Once in the .matlab folder, delete the folder for the version of MATLAB you have. For example, if you have R2015a, run the command:
rm -rf R2015a
NOTE: Do not remove any folder that ends with "_licenses."
4. Once cleared, restart MATLAB. The preferences should be recreated.
On some distributions, launching MATLAB with sudo will create MATLAB preferences in your home folder that are owned by root. You will then not able to launch MATLAB as a standard user as MATLAB will not be able to read it's own preferences.
Solution #2: Move Working Directory
If the above solutions do not work, be sure that there are no files conflicting on your MATLAB path. To verify that your work files and/or startup.m files are not conflicting with this MATLAB installation, perform the following steps:
1. Move the contents of your ~/Documents/MATLAB folder to another location on your computer.
2. Start MATLAB again to see if the problem still occurs.
If this resolves the problem, one of your work files is likely conflicting with your MATLAB installation or your startup.m file is crashing MATLAB.
Solution #3: Disable SELinux, AppArmor or other security software:
Try running MATLAB with SELinux disabled. SELinux may prevent MATLAB from starting. To temporarily disable it, run the following command as root:
(/usr/sbin/setenforce 1 will turn SELinux back on)
To disable AppArmor on newer Ubuntu versions, run the below as root:
invoke-rc.d apparmor kill
update-rc.d -f apparmor remove
Once disabled, try MATLAB again. If it works, see the Related Solution at the bottom of the page:
"Why do I receive errors relating to the file "libmwlapack" when starting MATLAB R14SP3 or higher on Linux?"
Note: You may also have to reset the permissions on the folder you are trying to install from. Run the following command to modify the permissions:
chmod -R 755 $installfolder
Solution #4: Debugging Mode
Open MATLAB with the Desktop and Java options Disabled:
1. From the terminal, type the following:
Where $MATLABROOT is the path to your root MATLAB directory)
By default this will be /usr/local/MATLAB/R2015a/bin for R2015a.
2. Try launching MATLAB with each of the below commands:
If MATLAB starts in either of these modes, there is most likely a Java issue. If MATLAB fails to start in either of these modes, more information may be obtained from the MATLAB crash dump files. These files will be located in your home folder and will have the names:
If any of these files exists, send those files along with the output of the commands above to the Installation and Licensing team using the form at the bottom of this article.
Solution #5: Missing Libraries
MATLAB is tested and fully qualified on Ubuntu, Debian, Red Hat Enterprise Linux (RHEL), and SuSE. However, it will still run on most popular distributions of Linux, provided it is a full desktop installation of the distribution. MATLAB is not supported on minimal or server distributions. A minimal installation may not contain all libraries that MATLAB requires.
Even if you intend to run MATLAB only in non-graphical mode, MATLAB requires some X11 libraries to run. However, we are not able to specify the X11 requirements down to the exact set of packages required because different distributions may package the libraries differently. MATLAB will work out of the box on desktop installations of any supported distribution.
See the below for a list of qualified distributions:
If you are still unable to launch MATLAB on Linux after trying these troubleshooting steps, please contact the Installation & Licensing Support team:
Ruoshui Liu on 19 Mar 2022
What error message did you get?
If you see the following error while starting MATLAB from Ubuntu 20.04 terminal:
"Unexpected error during communication with services required to run MATLAB."
Then, here are some things you can try:
1. Launch the MATLAB for the first time
2. Invoke the command from your terminal
$ps aux | grep MathWorks
3. Look for the process "MathWorksServiceHost", and note the process ID
4. Kill that process
5. Launch the MATLAB again
6. You would see the Keyring dialog popping up, then you type in your password
7. MATLAB should launch
Have a go with this, and hope it helps you.