Description of problem:
When default /usr/bin/vncserver is used to start Xvnc, it generates a default
$HOME/.vnc/xstartup.
If vncserver uses the unmodified default $HOME/.vnc/xstartup, clipboard transfer
functionality works.
If user edits $HOME/.vnc/xstartup as instructed in the xstartup comment to
provide normal desktop,
the edit results in the loss of clipboard transfer functionality, because
vncconfig does not get executed any more.
Steps to Reproduce:
(Assuming default version of /usr/bin/vncserver)
1. If $HOME/.vnc/xstartup does not exist, go to step 2, otherwise delete it in
order to reset it back to default:
]$ rm $HOME/.vnc/xstartup
2. Start and stop vncserver to generate a default $HOME/.vnc/xstartup (you may
be asked to select a password if run for first time):
]$ vncserver :1
]$ vncserver -kill :1
3. Open $HOME/.vnc/xstartup in a text editor and uncomment the two lines for
normal desktop as instructed in the comment resulting in xstartup content like this:
--------
#!/bin/sh
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
[ -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 &
--------
4. Start vncserver
]$ vncserver :1
5. On another host start vncviewer (make sure the Accept clipboard, Send
clipboard items are enabled in Options) and connect to <yourvncserverhostname>:1
6. Try to copy and paste between the vncviewer window and some text app on the
vncviewer host: it will not provide any clipboard transfer
Workaround:
I have moved up vncconfig command in $HOME/.vnc/xstartup to the top of the
script to guarantee that vncconfig gets executed in the default case as well as
when user chooses to follow the instructions for uncommenting the lines to get
the normal desktop:
--------
#!/bin/sh
vncconfig -iconic &
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &
--------
Proposed permanent fix:
To make the solution in the above workaround permanent, the $defaultXStartup
string in /usr/bin/vncserver could be modified as follows:
$defaultXStartup
= ("#!/bin/sh\n\n".
"vncconfig -iconic &\n".
"# Uncomment the following two lines for normal desktop:\n".
"# unset SESSION_MANAGER\n".
"# exec /etc/X11/xinit/xinitrc\n\n".
"[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup\n".
"[ -r \$HOME/.Xresources ] && xrdb \$HOME/.Xresources\n".
"xsetroot -solid grey\n".
"xterm -geometry 80x24+10+10 -ls -title \"\$VNCDESKTOP Desktop\" &\n".
"twm &\n");
References:
After debugging this issue and coming up with the above workaround, I did some
back searching for the issue and found a confirmation of validity of this fix in
one of the VNC guys support responses at
http://www.realvnc.com/pipermail/vnc-list/2005-June/051269.html> >The reason vncconfig doesn't get run by your xstartup file is that the
> >second command you run in it is an exec! After an exec, it'll never get
> a
> >chance to run any commands, since it's been completely replaced by
> whatever
> >script you told the shell to replace it with (in this case xinitrc).
> >
> >Just move the vncconfig line before the exec and it should work fine.
> >
> >Cheers,
> >
> >Wez @ RealVNC Ltd.