I have been clumsily working around a strange clipboard issue on a Linux system over VNC. I recently noted a fix and want to document it here. An alternate title for this post might be: VNC client/host clipboard sharing may impact copy/paste behavior in certain Linux programs.
For reference, the VNC session in question is a TigerVNC (version 1.1.0-24.el6) on a CentOS 6 Linux system. I connect to this remote session from Mac OS (Mojave 10.14.6) with the TigerVNC client and run in fullscreen mode.
This setup worked without issue for a long time (session uptime is ~300 days as of this writing). Recently, the selection-based copy/paste functionality ceased to work in gnome-terminal windows. Middle-click was still able to paste text but I was unable to update that text by selecting text in the terminal. Further, the Ctrl-Shift-C method also failed for gnome-terminal. Oddly, I was able to paste text when copied from GUI programs such as Firefox or gedit. This led to extremely clunky workarounds such as redirecting terminal output to files so that could be opened with gedit and pasted elsewhere.
So how do I resolve this odd copy/paste behavior? Numerous solutions (such as manual use of xclip) have been reported around the internet for related issues. None of these worked for me. In my case, even manual use of xclip proved unable to update the stored text for paste with middle click (I suspect this is a clue but am not quite sure what it points to).
I was preparing to shut down the session entirely when I stumbled upon a fix: unchecking "Accept clipboard from viewers" and "Send clipboard to viewers" in the VNC config window completely resolved the issue. I have been working with the session for several hours now and normal behavior is restored. To be clear, after the config adjustment, I can now copy/paste from/to terminal windows that were previously uncooperative without any need to close and reopen.
The nature of the fix suggests that some clipobard issues on the Linux side are affected or even caused by the client VNC program and/or the client's OS. I have muddled through similar clipboard issues for years but never came across this particular solution to 'recover' normal behavior in a running session. Given how irritating the problem was and the ease of the solution, I thought it would be worth noting the finding here for other folks with VNC and clipboard issues.