xsel via qrexec fails to set clipboard, "conversion refused"

33 views
Skip to first unread message

Dave C

unread,
Dec 28, 2018, 1:28:12 PM12/28/18
to qubes-users
I've written a qrexec script which, among other things, attempts to place something into the clipboard, using `xsel`.

xsel fails, with error: "xsel: Conversion refused"

Attempting to troubleshoot, I've learned that `xsel -o` can show the contents of the clipboard, but `xsel` fails to set the clipboard. Both `xsel -v` and `xsel -b -v` fail with the "conversion refused" messages. `xsel` works fine when I run it from a terminal. The error occurs only when running via qrexec.

For some context, if you're interested... I recently became aware of a password manager with some interesting features: https://github.com/renatoathaydes/go-hash. I'd like to modify it, so that it both opens a URL in a VM, and places a password in that VM's clipboard. I've got most of that working, except that I can't get the password into the clipboard, because xsel fails with "conversion refused".

unman

unread,
Dec 30, 2018, 8:32:58 AM12/30/18
to qubes-users
It would help if you provided a copy of your script and some detail on
where you are calling xsel, how you are handling it on the receiving
side, and what templates you are using.
Are you using the normal Qubes clipboard paste mechanism or are you
rolling your own?


Dave C

unread,
Jan 12, 2019, 11:14:19 PM1/12/19
to qubes-users


I'll attach a file, which is a version of the script I'm working on. It's based on /etc/qubes-rpc/qubes.OpenURL. In addition to opening URLs, it takes the first line of stdin and uses `xsel` to put that line into the clipboard. It doesn't work. If you change `xsel -v`, you'll see it gets the error I've described in the first post.

qpass.ClipOpenURL

799

unread,
Jan 13, 2019, 5:15:31 AM1/13/19
to Dave C, qubes-users
Hello Dave,

On Fri, 28 Dec 2018 at 19:28, Dave C <qu...@dave-cohen.com> wrote:
I've written a qrexec script which, among other things, attempts to place something into the clipboard, using `xsel`.
xsel fails, with error: "xsel: Conversion refused"

I don't know what xsel is doing. I have written a script which uses xclip (which needs to be installed as an additional package).
Maybe you can get some info from there:

Copy content from the dom0clipboard to an AppVMs clipboard including a notification

--- --- ---
#!/bin/bash
# name : qvm-xclip-to-vm
# purpose: Copy the clipboard of dom0 to the clipboard of an appvm
# Usage : qvm-xclip-to-vm <AppVM>

AppVM=$1
xclip -o | qvm-run --pass-io $AppVM 'cat | xclip -selection clipboard &>/dev/null'
notify-send --urgency low --icon image --expire-time=5000 "$0" "Clipboard pasted from dom0 to $AppVM"
--- 8< --- --- ---

The other way around:

Additionaly there's a script to do the same for screenshots:

O.

Dave C

unread,
Jan 13, 2019, 8:53:12 PM1/13/19
to qubes-users

Hey, good idea. Not sure why I hadn't thought to try `xclip` earlier. While I'd still like to know what xsel is complaining about, I'm able to get it working with xclip.

I've started making a qubes-specific version of `go-hash`, a tool for managing passwords. I like one feature in particular: open a URL while copying a password to the clipboard. I renamed my version `qpass`, and created command "appvm" which opens a URL in an appvm while copying the password to that appvm's clipboard. The "dispvm" command is similar, but opens a disposable vm.

Work (still a bit in progress) is here:
https://github.com/dncohen/qpass/tree/qpass

The idea is to run `qpass` in a vault, and use it to launch URLs in app vms that have network access. While qubes copy/paste is pretty good, I find that I can get sloppy with it, sometimes manually pasting to the wrong vm. I'm hoping this approach is a little more idiot-proof.

-Dave

Dave C

unread,
Feb 1, 2019, 11:13:06 PM2/1/19
to qubes-users

Just to update this thread... it turns out I was trying to have xsel work with an invalid utf8 string. I fixed a bug in the code generating a password string. Once it was proper utf8, xsel works fine (although running verbose, it still warns "conversion refused" - no idea what it is referring to.)

Reply all
Reply to author
Forward
0 new messages