xclip gives `Error: Can't open display: localhost:10.0` in tmux session in Ubuntu VirtualBox VM
Asked Answered
H

1

9

I'm attempting to use xclip in a tmux session in my Ubuntu VirtualBox VM for some copy/paste keybindings, but keep getting the same error message.

I have XQuartz installed on my host machine:

ysim:~$ which xquartz
/opt/X11/bin/xquartz
ysim:~$ echo $DISPLAY
/tmp/launch-N0023n/org.macosforge.xquartz:0

I have ForwardX11 yes set in ~/.ssh/config:

Host vm
ForwardX11 yes

In my VM too, in /etc/ssh/sshd_config:

X11Forwarding yes

When I'm ssh'ed in my VM, xclip works fine when I'm not in a tmux session:

$ echo hello | xclip
$ xclip -o
hello

But errors when I'm in one:

$ echo hello | xclip
Error: Can't open display: localhost:10.0

Any ideas why this might be the case?

Update: Now it seems to only happen if I exit a tmux session, then create a new one.

Hereinto answered 23/9, 2013 at 19:9 Comment(1)
Have you fixed this issue or found any solution?Parrot
W
5

I got the same error. I fixed it by exiting my tmux session, disconnecting my ssh session and reconnecting (opening another terminal window).

I was ssh'd into a server, but if you're just using a local VM, I think exiting your tmux session and reopening terminal should have the same effect.

Woodpile answered 25/6, 2016 at 16:46 Comment(1)
The problem still exists in tmux v2.6, the workaround is still working. Is this a tmux bug? Anyone has ideas? btw, I've been using tmux for at least 1.5 years, this is my first time encountering this problem, which is pretty weired.Hildegaard

© 2022 - 2024 — McMap. All rights reserved.