MATLAB 2020a No display available error on Ubuntu
72 views (last 30 days)
Show older comments
I'm installing MATLAB 2020a on Ubuntu 18.04 LTS.
However when I execute in terminal with:
sudo bash install
I got error
No protocol specified
terminate called after throwing an instance of '(anonymous namespace)::DisplayError'
what(): No display available.
Aborted
For some reason it works without using sudo
bash install
But I have to use sudo, as I need to create matlab folder in /usr/local/
How should I solve this?
9 Comments
Samuel Gray
on 19 Dec 2020
Edited: Samuel Gray
on 20 Dec 2020
...just as well, the first time that I tried to install R2020b on CentOS8 using the standard sudo ./install it shagged the x11 configuration though admittely this is an AMD laptop with onboard AMD graphics...I reinstalled CentOS8 and now it won't even run sudo ./install. So the legacy installer seems to have finished without a problem...now if I can just actually start Matlab...
ah, so
this time I did not use sudo, just called the installer as a regular user...
still got an X glitch but only for a moment then the installer screen came up as usual.
./bin/glnxa64/install_unix_legacy -input_file=./custom_installer_input.txt
...but that won't let me install into /usr/local so sudo it is...and that won't launch the installer!
Back to regular user but installing Matlab to my home account, ok that works...
Wow it's downloading 1.241MB just for for the core Matlab code and 29 toolkits! I already have downloaded 277MB just to run the installer...must be a lot of elves running around at Mathworks writing code especially since there are so many more toolkits that I could not download with one trial license! There must be an entire business-school, engineering, computer-science and computer graphics school of stuff in Matlab now.
Anyway I am glad that this time the installer started (twice) using sudo without blowing-up the x window manager this time and forcing me t wipe & reinstall CentOS8. Which probably someone else could have fixed, but I gave up trying to fix it after a week and just started over.
Answers (3)
Alejandro Verri
on 2 Feb 2021
Edited: Alejandro Verri
on 2 Feb 2021
Effectively, in order to create the folders /usr/local/ you must be superuser, but the installation can and should be done with your user and avoid some know issues using root accounts with X11 video. A simple way to install it is to create the installation folders in usr/local and then change its owner (or group), before running the installer
sudo mkdir /usr/local/MATLAB
sudo mkdir /usr/local/MATLAB/R2020a
sudo chown YOUR_USERNAME /usr/local/MATLAB
sudo chown YOUR_USERNAME /usr/local/MATLAB/R2020a
./install
When the installer asks you if it should create symlinks in /usr/bin, simply change the destination to your local ~/Desktop or any other local folder and then, as superuser you just move those symlinks to the bin locations
sudo cp ~/Desktop/matlab /usr/bin
sudo cp ~/Desktop/mex /usr/bin
1 Comment
Alejandro Lorite Mora
on 8 Oct 2021
It worked for me, but the final step should be:
sudo cp ~/Desktop/matlab /usr/bin -P
sudo cp ~/Desktop/mex /usr/bin -P
Nick Warren
on 10 Nov 2020
Didn't work for me, presumably as I was SU'ing in as root, rather than logging in directly as root. This worked for me:
user@myserver:~$ xauth list
myserver/unix:11 MIT-MAGIC-COOKIE-1 27fbcf94c244d6946e39bd7a11d41453
myserver/unix:10 MIT-MAGIC-COOKIE-1 b00729a0755ddefa14a8fae6c677efd3
user@myserver:~$ echo $DISPLAY
localhost:10.0
user@myserver:~$ sudo su --login root
root@myserver:~# export DISPLAY=':10.0'
Add magic cookie for matching display - 10 in this case:
root@myserver:~# xauth add myserver/unix:10 MIT-MAGIC-COOKIE-1 b00729a0755ddefa14a8fae6c677efd3
Run the installer:
root@myserver:~# ~/path-to-matlab-installer/install
2 Comments
Herman Wong
on 8 Oct 2022
Awesome. Works like a charm instead of 'xhost +SI:localuser:root' solution others referring to.
Yuval Zukerman
on 1 Feb 2021
Open a terminal as regular user and execute "xhost +" to allow connections to the user's X11 server
user@computer $ xhost +
>> access control disabled, clients can connect from any host
Then open a terminal as root and export the DISPLAY and run the installer:
root@computer # export DISPLAY=:0.0
root@computer # ./install
I was also able to install using:
sudo ./install
1 Comment
Wei
on 19 Nov 2022
Hi, Dear Yuval.
i had a simiar proble, but when i try to excute the ./install or sudo ./install, it jump a blank window like this. do you know any way to fix this? Thanks
See Also
Categories
Find more on Introduction to Installation and Licensing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!