0

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:

  1. Setup a VNC session on the remote server by running:
    vncserver :0
    
  2. 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.

  3. 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.

Bodai
  • 1
  • What VNC server are you using? there's usually a distinction to be made between standalone VNC (vnc4server,tightvncserver et al.) and "desktop sharing" VNC servers such as x11vnc or Vino that are intended to provide remote access to a physical X display – steeldriver Apr 29 '20 at 12:06
  • Hello, I believe i'm using this linux application: https://linux.die.net/man/1/vncserver – Bodai Apr 30 '20 at 00:01
  • There is no physical display for the remote server, I believe. It is a high-performance computing server used by many users. Perhaps it's running headless. I found 'vncviewer' in the bin directory. Perhaps it's similar to 'vnc4viewer'. Perhaps this is exactly the software what is to be used on a headless server, if I understand you correctly. Would you please give some instructions if 'vncserver' can be made work with my setup? – Bodai Apr 30 '20 at 00:14
  • Ah my mistake - I assumed when you mentioned "a GUI of the operating system" you were referring to an existing local display - please ignore my previous comment – steeldriver Apr 30 '20 at 00:26
  • Did you set up a ~/.vnc/xstartup file on the remote server? if so, please [edit] your question to include its contents. – steeldriver Apr 30 '20 at 00:46
  • Could it be that i have the black VNC client screen because no GUI desktop is present on the headless server? I cannot install a desktop, like it is described here https://unix.stackexchange.com/questions/181503/how-to-install-desktop-environments-on-centos-7, as I'm not a sudo-er. Therefore, I wonder if VNC can be used also without a GUI desktop. – Bodai Apr 30 '20 at 01:08
  • It shouldn't matter that a desktop isn't running on the remote server, but some of the software components (such as a basic window manager) will need to be installed (which they likely are, if vncserver is). – steeldriver Apr 30 '20 at 01:21

0 Answers0