Xsel error in ssh (Neovim 0.5)

I’m using Neovim 0.5 in an ssh connection with X11 enabled.

When I try to yank text to the clipboard the following error is printed in the status line:

clipboard: error invoking xsel: /usr/bin/xsel: BadAccess (attempt to access private resource denied): Resource temporarily unavailable

However, xsel does work when invoked from the shell. E.g:

> xsel
text in clipboard%

The server is running Ubuntu 18.04.5 LTS (GNU/Linux 4.15.0-140-generic x86_64).
The xsel version is 1.2.0.

Any help to fix this would be very much appreciated.

EDIT: Somebody reported a similar issue here to which someone responded: “does xsel also have the same issue outside nvim? Then it is not nvim bug. I would guess some kind of xauth problem with ssh X11 forwarding.” I’m not familiar with xauth. If anybody could expand on this I would really appreciate it.

EDIT 2: I investigated a bit further and it seems to be a problem with xsel’s CLIPBOARD selection (which is the same unnamedplus register in nvim). I suspect that it does not work on the server probably because the administrator disabled it. The PRIMARY selection does work fine though.

Have you solved it? I meet the same problem

No because I don’t have server admin rights to enable the CLIPBOARD selection. This means that when I try to yank to the + register (e.g. with "+yiw), I get the error posted above. However, yanking to the PRIMARY selection does work, i.e. yanking to the * register (e.g. with "*yiw). See :help clipbard-x11.

2 Likes