We’ve run into problems remotely running some applications via X. Even when the app runs OK, it is quite sluggish. We also had trouble running in secondary X sessions, which is the default behavior of vncserver. Most apps acted just fine; however, some apps got confused about what desktop to use. We tried VNC, though, and started it up as the initial X session, and that works very well. Here is a screenshot where you can see our Mac OS X desktop with a separate X desktop on the bottom running icewm, the regular tool dock on the right, and a Chicken of the VNC session connecting to display 0 on a GNU/Linux box that is running VMWare, which has Windows Server 2003 loaded:
Click the above image for a larger image. Start vncserver with this command:
[usr-1@srv-1 ~]$ vncserver :0 New 'srv-1.example.com:0 (usr-1)' desktop is srv-1.example.com:0 Starting applications specified in /home/usr-1/.vnc/xstartup Log file is /home/usr-1/.vnc/srv-1.example.com:0.log [usr-1@srv-1 ~]$ |
There are two lines to edit for a full desktop:
[usr-1@srv-1 ~]$ head -n 5 /home/usr-1/.vnc/xstartup #!/bin/sh # Uncomment the following two lines for normal desktop: unset SESSION_MANAGER exec /etc/X11/xinit/xinitrc [usr-1@srv-1 ~]$ |
The result is that apps run remotely over the network perform better. True, this runs an entire desktop, and not just one app, but the performance gains are worth the extra layer. Note that this is not as secure as running your remote X apps over ssh; however, if you are on the same, secure LAN, and don’t need to encrypt the data stream, then this method is fine.
Just to show you how desktopie this exported desktop really is, even the screensaver pops up:
Click the above image for a larger image. Of course, it is silly to run the screensaver over the network. Probably there is some way to detect that the desktop is VNC, and disable the screen saver. We have been running VMware and doing other funky things like the above for many years. Check out this article from 1999, where we are running Windows NT via VMware, and watching the whole thing via PCAnywhere. Similar motivations. A lot has changed since then.
Note that on some systems I’ve connected and only seen a black screen. This xstartup file in ~/.vnc/ worked better:
[usr-1@sv-1 .vnc]$ cat xstartup #!/bin/sh # Uncomment the following two lines for normal desktop: unset SESSION_MANAGER #exec /etc/X11/xinit/xinitrc exec startx #[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup #[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources #xsetroot -solid grey #vncconfig -iconic & #xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & #twm & [usr-1@sv-1 .vnc]$ |
To get out of full screen mode the default, at least on a Mac with Chicken of the VNC, use command-option-control and back-quote (next to the 1).