Matlab unable to install R2021b: "unable to write to selected folder" in Ubuntu 20.04

Trying to install R2021b on the system drive. Using Ubuntu 20.04. 384 Gb available. I download
matlab_R2020b_glnxa64.zip
and unzip it.
unzip matlab_R2020b_glnxa64.zip
If I run
./install
I go through the setup, select /usr/local/MATLAB/R2021b, and the installer fails, saying something like "Unable to create selected folder". If I create the folder with open (chmod 777) permissions, I get "Unable to write to selected folder".
If I instead use
sudo ./install
I'm asked for my password, and the process hangs. No graphical install window, nothing. Just an unusable terminal window. This happens in both terminator and term.

6 Comments

My understanding is that the sudo (superuser do) runs the command as a superuser. As I said, if I run the command
sudo ./install
and enter my password, the install hangs. No window opens. It just hangs.
If I run
./install
then the window opens but fails when it tries to create or write /usr/local/MATLAB/R2021b.
same issue here!
Also tryed the to change the directorys permission, but it does not solve the problem
You'll want to run MATLAB as root if you wish to install it in the default directory. However, there is a known issue where the MATLAB installer where it won't lauch as root. To get past this issue, do the following:
  • Launch Terminal
  • Type the following in the terminal to allow the root user to access the running X server:
xhost +SI:localuser:root
  • After running the command above try running the installer "sudo ./install"

Sign in to comment.

 Accepted Answer

A bit more detail - thanks to Philip (see above) for the answer. Apparently in a terminal window you must run
xhost +SI:localuser:root
before installing. Then you should be able to run
sudo ./install
I didn't see a .desktop file created so I created my own, in /usr/share/applications. In fact I have several such files, for different matlab versions. My approach may be crude, but I have something like matlab21b.desktop containing:
[Desktop Entry]
Name=MATLAB21b
Version=2021b
Type=Application
Terminal=false
Exec=/usr/local/MATLAB/R2021b/bin/matlab -desktop
Icon=/usr/local/MATLAB/R2021b/ui/install/installer_login/images/bg_global_logo.jpg
Categories=Development;Math;Science
Comment=Scientific Computing Environment
StartupNotify=true
StartupWMClass=com-mathworks-util-PostVMInit
I use several different desktops, and don't define a symlink named matlab because if I did, which version would it run? As a last step I had to run the license manager to capture the renewal I did at the last minute in 2021...
sudo ./activate_matlab.sh
With all this, the program shows up in Launcher (click the icon in the lower left corner, type in mat and the matlab icon appears). You can also pin this to the favorites to that it's available with one click.

5 Comments

Thank you so much for posting this Jim, it was a great help.
Happy New Year.
And to you, Stephane. Happy to help and, once again, thanks to Philip at Mathworks.
some additional comments
  • ./actiavte_matlab.sh is in urs/local/matlab/YOURMATLABVERSION/bin
  • to run matlab command from the terminal you have to add the urs/local/matlab/YOURMATLABVERSION/bin to your path e.g. `export PATH=/usr/local/MATLAB/R2021b/bin/:$PATH`

Sign in to comment.

More Answers (0)

Categories

Products

Asked:

on 29 Dec 2021

Commented:

Ren
on 12 Jul 2022

Community Treasure Hunt

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

Start Hunting!