copy/paste failure from host to guest with VirtualBox 6.1.16

Discussions related to using VirtualBox on Windows hosts.
HaroldFinch
Posts: 25
Joined: 22. Sep 2014, 01:33

copy/paste failure from host to guest with VirtualBox 6.1.16

Post by HaroldFinch »

I recently installed xubuntu-20.04.1-desktop-amd64 into a new virtual machine created with the latest VirtualBox 6.1.16.

As part of my configuration of that new xubuntu, I installed the VirtualBox Guest Additions (following these instructions):

Code: Select all

	--in the guest xubuntu, opened a Terminal and executed
		sudo apt update
		sudo apt install build-essential dkms linux-headers-$(uname -r)
	--mounted the VBoxGuestAdditions.iso CD file into the xubuntu guest's virtual CD-ROM drive
	--opened a Terminal in the directory where that CD-ROM drive was mounted and executed
		sudo sh ./VBoxLinuxAdditions.run

That seemed to work, indeed, here is what xubuntu thinks it has:

Code: Select all

	$ lsmod | grep -i vbox
	vboxsf                 81920  1
	vboxvideo              36864  0
	ttm                   106496  2 vmwgfx,vboxvideo
	drm_kms_helper        184320  2 vmwgfx,vboxvideo
	vboxguest             348160  6 vboxsf
	drm                   491520  7 vmwgfx,drm_kms_helper,vboxvideo,ttm




	$ modinfo vboxguest
	filename:       /lib/modules/5.4.0-58-generic/misc/vboxguest.ko
	version:        6.1.16 r140961
	license:        GPL
	description:    Oracle VM VirtualBox Guest Additions for Linux Module
	author:         Oracle Corporation
	srcversion:     72CDCB8BA3ED3B5FE9AE9E8
	alias:          pci:v000080EEd0000CAFEsv00000000sd00000000bc*sc*i*
	depends:        
	retpoline:      Y
	name:           vboxguest
	vermagic:       5.4.0-58-generic SMP mod_unload
After doing the above, I shutdown the virtual machine and changed some off its Settings, such as

Code: Select all

		General
			Advanced
				Shared Clipboard: Disabled --> Bidirectional
		...
		Shared Folders
			click on + to add new, and then:
				Folder path: C:\davidm\virtualMachines\shared
				Folder Name: shared
				Auto-mount: (checked)

The Shared Folder seems to now work fine, after I executed

Code: Select all

	sudo adduser davidm vboxsf
to address this bug. This ought to be added to VBoxLinuxAdditions.run?

But the shared host to guest clipboard has a bizarre problem: copying from my favorite Windows text editor, TextPad, and pasting inside the guest xubuntu works bizarrely.

In particular, in a newly launched xubuntu, if I open a Terminal and attempt to paste some text from TextPad into it, nothing appears!

I can then go to seemingly any other Windows program on the host and paste what I copied from TextPad into it (e.g. into Notepad++).

I can copy text from seemingly any OTHER Windows host program (e.g. Notepad++, IntelliJ, etc) and paste that text into the xubuntu guest.

Strangest of all, if I copy something from the xubuntu guest and paste it into TextPad, I can then copy text from TextPad and paste it back into xubuntu!

So, why does the inital copy/paste from TextPad alone into xubuntu fail?

I am using the latest TextPad 8.5.0 64 bit.

Before doing this post, I web searched and found some clipboard issues in the last year like but these seem to be unrelated to what I report above.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: copy/paste failure from host to guest with VirtualBox 6.1.16

Post by mpack »

Please provide a VM log file. Make sure the VM is fully shut down, then right click it in the manager UI. Select "Show Log" and save "VBox.log" (no other file) to a zip file. Attach the zip here.
HaroldFinch
Posts: 25
Joined: 22. Sep 2014, 01:33

Re: copy/paste failure from host to guest with VirtualBox 6.1.16

Post by HaroldFinch »

mpack: thanks for your reply, and sorry for taking so long to get back to you, I had to wait till now to have the time...

Attached are the zips of 2 log files taken as explained below.

Both contain lines like these related to the Clipboard:

Code: Select all

00:00:03.354786 Shared Clipboard: Service loaded
00:00:03.355186 Shared Clipboard: Mode: Bidirectional
00:00:03.355910 Shared Clipboard: Service running in normal mode
...
00:00:30.876793 Shared Clipboard: New Clipboard API enabled
For the TextPad log file, I:
  • 1) started the Xubuntu virtual machine, logged in and opened a Terminal
    2) I copied from TextPad running on my host Win 10 machine the text "pwd", pasted it into the Terminal, that paste worked, so I pressed enter to execute the command
    3) I copied from TextPad running on my host Win 10 machine the text "ls -al", pasted it into the Terminal, that paste FAILED, it instead pasted in the previous text "pwd"
    4) I copied the text in the Xubuntu Teminal and pasted it back into TextPad, which worked
    5) I then retried step 3) and this time it worked
    6) to make sure that it now works fine, I copied from TextPad running on my host Win 10 machine the text "uname -a", pasted it into the Terminal, that paste worked, so I pressed enter to execute the command
    7) I then closed the Terminal, shut down Xubuntu, and saved the requested log file
For the NotePad++ log file, almost all the steps were the same as above except that the pastes from NotePad++ into Xubuntu always worked, there was no need for step 4) or 5).

I cannot wait to read what you trace this bug down to.
Attachments
2_paste_fromNotePad++_toXubuntu.zip
NotePad++ logs
(33.02 KiB) Downloaded 8 times
1_paste_fromTextPad_toXubuntu.zip
TextPad logs
(22 Bytes) Downloaded 8 times
fth0
Volunteer
Posts: 5677
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: copy/paste failure from host to guest with VirtualBox 6.1.16

Post by fth0 »

One of your attachments is too small to be a zip file. ;)
HaroldFinch
Posts: 25
Joined: 22. Sep 2014, 01:33

Re: copy/paste failure from host to guest with VirtualBox 6.1.16

Post by HaroldFinch »

fth0: how right you are. I have no idea how that happened...

I redid the steps in my last post in the TextPad section, and have recreated the log file and zipped it, which is attached this time as what should be a 34 KB file.
Attachments
1_paste_fromTextPad_toXubuntu.zip
(33.01 KiB) Downloaded 9 times
fth0
Volunteer
Posts: 5677
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: copy/paste failure from host to guest with VirtualBox 6.1.16

Post by fth0 »

In your VBox.log files, I don't see anything indicating problems with the Shared Clipboard.

Generally speaking, the VirtualBox Shared Clipboard implementation is known for supporting not all possible types of clipboard content. Perhaps you can use a clipboard tool on the host to verify what content data types are created by TextPad.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: copy/paste failure from host to guest with VirtualBox 6.1.16

Post by mpack »

IMHO the fact that Notepad++ always works pretty much guarantees that the problem is with TextPad, and specifically the clipboard formats served up by TextPad.
HaroldFinch
Posts: 25
Joined: 22. Sep 2014, 01:33

Re: copy/paste failure from host to guest with VirtualBox 6.1.16

Post by HaroldFinch »

There may indeed be something screwy with how TextPad copies stuff to the Clipboard.

That said:
  • 1) I have been using TextPad for 20+ years, and have never seen a problem with its copy/paste into another app
    2) In particular, since I have been using VirtualBox for the last several years, I have never seen a copy / paste from TextPad into VirtualBox fail before
    3) TextPad is what I am normally using to copy / paste into VirtualBox, so this has been tested a lot!
    4) why do the copy pastes from TextPad into VirtualBox suddenly start working normally once I have copied and pasted something from VirtualBox back into TextPad?
    5) A quick web search found that NotePad++ has had copy / paste bugs before, like this
Has anything changed in the VirtualBox Guest Additions Clipboard code which could cause this?
fth0
Volunteer
Posts: 5677
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: copy/paste failure from host to guest with VirtualBox 6.1.16

Post by fth0 »

HaroldFinch wrote:Has anything changed in the VirtualBox Guest Additions Clipboard code which could cause this?
AFAIK, there have been several changes to the Shared Clipboard related code in the previous years, but I cannot really answer your question.
HaroldFinch wrote:A quick web search found that NotePad++ has had copy / paste bugs before, like ...
Interesting case, but in the end it also occurred without using Notepad++. ;)

If we want to better understand the problem, you will probably have to investigate and/or experiment further ...
HaroldFinch
Posts: 25
Joined: 22. Sep 2014, 01:33

Re: copy/paste failure from host to guest with VirtualBox 6.1.16

Post by HaroldFinch »

Just now, I experienced a similar issue with pasting from any text editor (either TextPad or Notepad++) into LibreOffice Calc.

I can copy a value from the text editor and paste it into a cell in a Calc worksheet. This first copy and paste always works fine.

I then try the same procedure a second time, but it fails: the paste produces nothing in the Calc cell.

If I restart LibreOffice Calc, I can then do 1 copy from a text editor and paste it into Calc, but then it fails once more on all subsequent attempts.

Another way to get it to work 1 time is after I copy and paste something from the text editor into Calc, if I then copy something from Calc and paste it back into the text editor. I can then copy from the text editor and paste into Calc 1 more time. But I have to keep copying back from Calc to the text editor to repeat this process.

This is a very similar phenomena to what I reported above (copying from TextPad into a VirtualBox virtual machine). Yes, some of the details differ, but they are close enough.

Doing a web search for the Calc problem found these: link1, link2, link3.

It seems that the bug is because some application can lock the Clipboard.

Unclear if the bug is in that locking application or in Windows 10...
fth0
Volunteer
Posts: 5677
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: copy/paste failure from host to guest with VirtualBox 6.1.16

Post by fth0 »

The X11 Clipboard handling code was changed in VirtualBox 6.1.18. Can you test if your problem persists?
HaroldFinch
Posts: 25
Joined: 22. Sep 2014, 01:33

Re: copy/paste failure from host to guest with VirtualBox 6.1.16

Post by HaroldFinch »

fth0 wrote:The X11 Clipboard handling code was changed in VirtualBox 6.1.18. Can you test if your problem persists?
fth0: thanks for following up.

Tonight I upgraded VirtualBox and the Extension Pack to 6.1.18.

I then reset my Xubuntu 20.04 virtual machine to its last SnapShot before I installed the Guest Additions. (This was SnapShot #3, early in the initialization of that virtual machine. I deleted all the SnapShots after #3.)

I then installed the 6.1.18 Guest Additions inside that virtual machine, and in that virtual machine's Settings, I enabled a Bi-directional clipboard and a shared folder.

All this to no avail, unfortunately: the same exact symptoms as in my original post are still present: I can paste once from TextPad into the virtual machine but all copies from TextPad thereafter don't update the clipboard when pasted into the virtual machine; what gets pasted is the 1st text. But they DO update the clipboard if I paste the contents into any other app, like Notepad++. Furthermore, Notepad++ does NOT exhibit this behavior: I can always copy from it and paste the correct text into the virtual machine. Furthermore, if I copy something from the virtual machine back to TextPad just once, then it cures TextPad forever (all subsequent copies from TextPad after that successfully paste into the virtual machine).
fth0
Volunteer
Posts: 5677
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: copy/paste failure from host to guest with VirtualBox 6.1.16

Post by fth0 »

If you're interested in investigating further, you can create a special log file by executing the following commands in the Linux guest:

Code: Select all

# Clipboard logging (X11 guest)
sudo pkill -fx "/usr/bin/VBoxClient --clipboard"
VBOX_RELEASE_LOG_DEST=file=/tmp/clipboard.log VBOX_RELEASE_LOG=+all.e.l.f VBoxClient -d --clipboard
Then post the VBox.log file and the /tmp/clipboard.log file, together with a description of your clipboard actions.
abcdefgh
Posts: 77
Joined: 22. Jul 2018, 03:29
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Linux Mint 20.3 Mate

Paste intermittent - Launch on startup, only

Post by abcdefgh »

VBox: 6.1.22 r144080 (Qt5.6.2)
Guest Additions: 6.1.22 r144080
Host: Win10-1803
Guest: Linux Mint 18.3

Hello, I'm posting to VBox on Win Hosts because I suspect the problem is with how VBox is launched. This isn't a show stopper, but any insight is appreciated.

-- Mark.

Problem: Host-to-Guest paste is intermittent when the VM is launched by Win10 startup -- sometimes it works, usually it doesn't.

When the Guest is launched manually, Host-to-Guest paste always works.

In Windows Task Manager [note],
Guest configured to launch (via 'C:\VMs\Mint18\Mint18.vbox') on any User log-in. Tested with/without 30 second delay.
Task Manager History:
- Task triggered on logon
- Created Task Process
- Task Started
- Action started
- Action completed
(no errors).

Also tested Windows Services:
VBoxSDS is the VirtualBox COM service.
If I set it to Startup Type = "Automatic", it gets set back to "Manual".
If I manually start it prior to VBox launch, it makes no difference.

[note] I'm using Task Manager because
this: 'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup' link to 'C:\VMs\Mint18\Mint18.vbox'
doesn't work, and
this: 'c:\Users\Mark\AppData\Roaming\Microsoft\Windows\Start Menu\Startup' link to 'C:\VMs\Mint18\Mint18.vbox'
doesn't work.
I'm actually markfilipak (which somehow became 'markfilipak2', then 'abcdefgh'). I've been here since 15 Jul 2012 but lost my name during the great shift to SSO (single sign-on) during 2017, and have not been able to recover it.
abcdefgh
Posts: 77
Joined: 22. Jul 2018, 03:29
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Linux Mint 20.3 Mate

Re: Paste intermittent - Launch on startup, only

Post by abcdefgh »

UPDATE

Well, this is interesting.

I repeated my search in this forum for "paste", but this time I limited it to just Topic Titles (so, I didn't get a flood of results) and turned up this: viewtopic.php?f=6&t=101174&p=491097&hilit=paste#p491097. HaroldFinch is (was) having a similar problem, and, interestingly, with copy-pastes from TextPad -- same as me.

I repeated my paste effort but this time from a different source, not TextPad. It worked.

Then I tried HaroldFinch's approach. I copied from the VM to TextPad, then copied that back to the VM and that worked! Thereafter, I can copy-paste from TextPad to the VM with no problems.

VBox doesn't like an initial paste from TextPad. This didn't happen in old versions of VBox. Now it does. Something ain't right with VBox.
I'm actually markfilipak (which somehow became 'markfilipak2', then 'abcdefgh'). I've been here since 15 Jul 2012 but lost my name during the great shift to SSO (single sign-on) during 2017, and have not been able to recover it.
Post Reply