I might have a too basic question. I'm trying to use Matlab on a remote server with the standard Matlab GUI. (The GUI is quite essential for development, e.g. for debugging; and I really need to do the development on the remote server as I need to access very large files.) For now, I'm using X11 forwarding via ssh, but that is very sluggish, and I gathered from this question on stackoverflow that VNC might be a good alternative.
Also, somehow after some time, when I try to plot in Matlab, the new X window popping up for a Matlab figure window is completely blank and errors are thrown in the Matlab Command Window. Then I have to not only close Matlab, but even exit the ssh session and log back by running ssh -X
... Really inconvenient.
The owner of the server requires me to use a Yubikey to generate a one time password (OTP), and to tunnel the connection through ssh
. In fact, the standard VNC port(s) is (are?) blocked on the server. So, this is what I have done:
- Setup a VNC session on the remote server by running:
vncserver :0
Create an
ssh
tunnel by running on my local machine in the Terminal window of OSX:ssh -p4022 -N -L localhost:5901:localhost:5900 my_user_name@xxx.xxx.xxx.xxx
where the
xxx.xxx.xxx.xxx
is standing for the server's IP address. I have to use my Yubikey here and then enter my user password on the server.Run the VNC client on my local machine executing the following in Terminal:
open vnc://localhost:5901
I need to provide the VNC pw here that I created the first time of doing the above under point 1.
My experience at this point is that I seemingly managed to connect to the VNC session running on the server, but I can see only a blank screen.
Why can I not see a GUI of the operating system and then go away and start Matlab - this is what I would do on my own Raspberry pi. Probably this is where my lack of experience with Linux makes me stuck.
Is there actually not a GUI available by default? I tried to run startx
on the server, but probably nothing happened. The output in the Terminal was the following among others:
xinit: connection to X server lost
waiting for X server to shut down (II) Server terminated successfully (0). Closing log file.
Is there a way to start an x application, Matlab or any other, and direct it to a particular VNC desktop? It would be really useful if I didn't need to close the Matlab session on the remote server every time I want to close the X window on my local machine, but I could log back to the same remote VNC desktop.
Any comments would be really appreciated. Probably I need something really step-by-step and exact.
Thank you in advance!
Tamas
Edit: Thanks for the comments. In the meantime, I have realised that a Gnome desktop is actually installed on the server. Therefore, according to this note I added the last line to my ~/.vnc/xstartup now reading in full as:
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
exec /etc/X11/xinit/xinitrc
gnome-session &
However, this has not solved the problem. Actually, running gnome-session
is not successful, just as running startx
wasn't. I get the following thrown
...
xinit: connection to X server lost
waiting for X server to shut down (II) Server terminated successfully (0). Closing log file.
So, it looks like the Gnome desktop installation needs to be troubleshot first by our IT staff.
Otherwise, this question on stackexchange suggests only a desktop can be relayed by VNC.
vnc4server
,tightvncserver
et al.) and "desktop sharing" VNC servers such asx11vnc
orVino
that are intended to provide remote access to a physical X display – steeldriver Apr 29 '20 at 12:06~/.vnc/xstartup
file on the remote server? if so, please [edit] your question to include its contents. – steeldriver Apr 30 '20 at 00:46vncserver
is). – steeldriver Apr 30 '20 at 01:21