Which is the best way, if possible, to maintain a remote X session that survives network outages, reboots etc

remote-accessx11

Even since I read the chapter about X in Unix Haters handbook I still thought that X was one of the things that make unix superior to Windows, since it makes it "possible" to work on machines remotely with a graphical user interface.

But after using Windows Remote Desktop a lot, which even has fully working Unix clients, I must say that remote X feels more and more ancient.

Today I accidentally put my stationary windows machine to sleep and lost my entire working environment which was running over X with Xming and had been running since May this year. It wouldn't matter if it was Ubuntu I was running, it would be lost any way since my working environment consisting of gnome-terminal sessions and emacs sessions instantly died when the X server disappeared. Sure there is screen which can save your gnome-terminal sessions, if you can live with the Ctrl-A clash, but for X?

If my remote machine had been a Windows server I would simply reconnect my Remote Desktop Client and proceed as if nothing has happend.

Why has the Unix community allowed this fragile remote graphical environment to sustain without a proper improvement? I have googled and googled and examined VNC ant NoMachine but they seem either not doing the right thing or being commercial or being crippled in various ways.


I have recently found an awkward but superior solution in terms of performance, instead of using NX or VNC (I even tried the experimental xpra utility), I tried a totally different aproach which works like a charm:

  • On the Linux host, install VirtualBox
  • In VirtualBox, install WinXP (Or whatever Window XP/Vista/7 dist you like).
  • In the virtual Windows machine, install Xming
  • In the virtual Windows machine, enable remote desktop access.
  • Restart the Virtual Machine in headless mode (VBoxManage startvm name –typ headlesss)

Using remote desktop, start Xming… enjoy, the fastest, re-attachable X-server solution I have tried so far.

Note It may be possible to run a Virtual Linux machine instead of XP and use the built in VRDP protocol in VirtualBox, I have not tried that yet. That solution would not require a Windows/Xming based solution and can be built entirely using OSS.

Best Answer

Run an X Server on the remote system that presents as a VNC server to your workstation.
Have the X clients on the remote system connect to that X server, then connect your workstation to it using a VNC client.

The Xvnc X/VNC server was part of the standard AT&T VNC distribution - I believe most VNC distributions still ship with something equivalent.


To address the "why doesn't it do what I want?" part of your question, X was never intended for what you're doing with it - to put a very sharp point on it, X is not remote access. It's remote display.
X was designed for use at large universities where you had big-ol-honkin' man-eatin' server in a datacenter somewhere with no display, and dinky little graphics terminals in computer labs with no real CPU horsepower, connected to each other by ethernet (which is unlikely to go down, and if it does you have bigger problems).
The exact same principles apply to an X session and a telnet or SSH session - If the underlying network link goes away the session will die.

X itself is pretty ancient. vi is even older. Both do exactly what they were intended to do by the original designers, with minimal feature creep. This is the Unix way.