Strange clipboard share in VirtualBox 6 (#18285)

This is for discussing general topics about how to use VirtualBox.
Sarke
Posts: 13
Joined: 4. Jan 2019, 06:03

Strange clipboard share in VirtualBox 6 (#18285)

Post by Sarke »


ModEdit; related ticket: #18285: Cannot paste copied Chromium URL into Windows
I recently upgraded from 5.1 to 6.0, and I have never encountered this before, so pretty sure it's new in 6.0.

Bi-directional clipboard works, EXCEPT when I copy from the address bar in Chrome on the host, into the guest (both Ubuntu based).

When this happens, the clipboard on the guest becomes empty.

I can work around this by pasting into a text editor on the host, then copying again. This will correctly set the clipboard on the guest.

Copying from other sources, or even from the web pages in Chrome works fine.

I know that Linux has a few different clipboard systems, so perhaps when Chrome sets it the VirtualBox doesn't detect it from the right system?

I am using Ubuntu Mate 18.04.
Last edited by socratis on 8. Jan 2019, 20:13, edited 2 times in total.
Reason: Added ticket related information.
Sarke
Posts: 13
Joined: 4. Jan 2019, 06:03

Re: Strange clipboard share in VirtualBox 6

Post by Sarke »

Tested a couple of other browsers.

I CAN copy from the Firefox address bar.

I CANNOT copy from the Chromium address bar.
Sarke
Posts: 13
Joined: 4. Jan 2019, 06:03

Re: Strange clipboard share in VirtualBox 6

Post by Sarke »

Tested with a Windows 7 guest as well.

I CANNOT copy from the Win7 guest Chrome address bar to the Ubuntu guest. Same thing happens, where the clipboard does change, but becomes empty.

I CAN copy from the Win7 guest Chrome address bar to the Ubuntu host text editor. Just like how I could copy from the host Chrome address bar to the host text editor. So the clipboard change does propagate up from the guest to the host, but not back down into the other guest (other than erasing the clipboard).

This definitely worked in 5.1, as I do this multiple times a day.

Chrome does have some sort of processing going on with the address bar copying that might be relevant. When you go to a non-secure site, then the protocol part will be hidden. If you then copy only the visible domain name then the clipboard will actually be set to the full address including the protocol and a trailing slash.

EDIT: wow, can't even say u-r-l, spam filter think I'm posting a link. The above paragraph would have made more sense, sorry, if I could have typed out an example.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Strange clipboard share in VirtualBox 6

Post by socratis »

VirtualBox shared clipboard works only with plain text. If Chrome is doing something funky, it won't work and it needs the text editor workaround.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Sarke
Posts: 13
Joined: 4. Jan 2019, 06:03

Re: Strange clipboard share in VirtualBox 6

Post by Sarke »

But this worked fine in version 5. I just upgraded to version 6 yesterday and this started happening.

EDIT: Also, the fact that it does sync from Chrome address bar in a guest to the host seems to suggest that it is in fact a valid clipboard. Just not to a guest.
Last edited by socratis on 5. Jan 2019, 10:30, edited 1 time in total.
Reason: Removed unnecessary verbatim quote of the whole previous message.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Strange clipboard share in VirtualBox 6

Post by socratis »

You may have upgraded to VirtualBox 6.0.0, but Chrome also updates itself all the time. If you think it's a VirtualBox issue, there's an easy way to verify it; downgrade to the last 5.x.y that worked. See if it works.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Strange clipboard share in VirtualBox 6

Post by socratis »

And I finally found the references I was looking for...

This has been reported in:
  • #15960 (Copying of HTML from windows host to Firefox on a Linux guest doesn't work), as a result of changes in
    • #15782 (Shared Clipboard failing; Guest to Host -> fixed in 5.2 builds after Nov 10 2017), due to a crash as described in
      • #16242 (MacOS Sierra host, CentOS 7 guest, VBoxClient clipboard breaks when copying rich text in guest).
Follow the trail...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Sarke
Posts: 13
Joined: 4. Jan 2019, 06:03

Re: Strange clipboard share in VirtualBox 6

Post by Sarke »

Downgraded to 5.2, and it works fine now, which suggests the issue is in 6.0, and not 5.2 (or 5.1 which also worked previously).
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Strange clipboard share in VirtualBox 6

Post by socratis »

That is a very helpful observation! Then maybe did something change indeed between 5.2.x and 6.0.0 and it's not simply that old issue.

Which version of 5.2.x did you download to exactly?
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Sarke
Posts: 13
Joined: 4. Jan 2019, 06:03

Re: Strange clipboard share in VirtualBox 6 (#18285)

Post by Sarke »

5.2.22 r126460
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Strange clipboard share in VirtualBox 6 (#18285)

Post by socratis »

Is there any tool in Linux that allows you to see the contents and kind of the clipboard? I know there's a couple for Windows (Free Clipboard Viewer, ClipView, InsideClipboard) and one for OSX (ClipboardViewer, Apple source code), but I don't know what's available for Solaris or Linux hosts, something like an X11 clipboard viewer.

If you know of such a tool, please post it here, so that we can examine the clipboard contents. I've heard that "xclip" might do the job...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Sarke
Posts: 13
Joined: 4. Jan 2019, 06:03

Re: Strange clipboard share in VirtualBox 6 (#18285)

Post by Sarke »

Yes, I've tried with both xclip and xsel, and they both show the contents as plain text on the host, and no content on the guest.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Strange clipboard share in VirtualBox 6 (#18285)

Post by socratis »

I can't verify your setup, I'm really in a bad spot as far as my host goes. Let's hope that another user will confirm your findings...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Kweo
Posts: 2
Joined: 15. Jan 2019, 16:21

Re: Strange clipboard share in VirtualBox 6 (#18285)

Post by Kweo »

Hi,

I can confirm the issue starting with VirtualBox 6. The same thing happens with the Opera address bar too, which is not surprising since its more or less a Chrome fork.

However, this is not the only source from which things can't be pasted: I used to be able to copy screenshots directly from the flameshot utility.

As mentioned by Sarke, any attempt to copy from these locations clears the clipboard on the guest, but the host clipboard holds the correct content when inspecting it with xclip.

I am running Arch Linux, with VirtualBox installed from the Arch repository.
Sarke
Posts: 13
Joined: 4. Jan 2019, 06:03

Re: Strange clipboard share in VirtualBox 6 (#18285)

Post by Sarke »

Could it be a race condition?

Here's a quick python script that follows the clipboard content (modified, source):

Code: Select all

#!/usr/bin/env python
import sys 
import signal
import gi
gi.require_version("Gtk", "3.0")
from   gi.repository import Gtk, Gdk 

def pcallBack(*args):
    print pclip.wait_for_text() 

if __name__ == '__main__':    
    import signal    
    signal.signal(signal.SIGINT, signal.SIG_DFL)    
    pclip = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
    pclip.connect('owner-change',pcallBack)
    Gtk.main()
I was suspecting it might be a race condition going on, since we know Chrome modifies the clipboard when copying from the address bar. As you can see from this output here, the last two were from the address bar and were duplicated.

Code: Select all

Could
it
be a race condition?
https://forums.virtualbox.org/posting.php?mode=reply&f=7&t=91093&sid=f6d352649a972155e118bb60c289fb30
https://forums.virtualbox.org/posting.php?mode=reply&f=7&t=91093&sid=f6d352649a972155e118bb60c289fb30
forums.virtualbox.org
forums.virtualbox.org
Could it be that the guest's clipboard is not being set properly because the host is busy with Chrome overwriting it at the same exact time? Or it's momentarily blank in between the first copy and the second copy (by Chrome)?
Post Reply