Shared clipboard not working with Linux guest

Discussions related to using VirtualBox on Mac OS X hosts.
Post Reply
le_jawa
Posts: 12
Joined: 24. Jan 2012, 19:16
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Ubuntu, RHEL/Oracle/CentOS

Shared clipboard not working with Linux guest

Post by le_jawa »

I know this has come up in the past, but the shared clipboard is not working on my Mac; neither drag-n-drop nor copy-and-paste works. As far as I can tell, everything has been setup right, but please look over the info below and let me know if something is missing.

Host system:
Hardware model: MacBook Air 2017
Operating system: macOS 11.5.2

VirtualBox:
Version: 6.1.26
GA version: 6.1.26

VM Guest:
Operating System: Oracle Linux 8.4 (with UEK)
Shared Clipboard: Bidirectional
Drag'n'Drop: Bidirectional

I've also attached the current log file (attempts to use the shared clipboard should be toward the end of the log), and a few screenshots backing up the information I provided above.

If this is a bug, I'll be happy to report it, or if someone has someone troubleshooting ideas, I'll be happy to give those a shot.

Thank you!
Attachments
Oracle Linux 8-2021-08-27-15-02-27.log
(119.04 KiB) Downloaded 11 times
GA Installed.png
GA Installed.png (38.63 KiB) Viewed 11112 times
Clipboard settings.png
Clipboard settings.png (60.61 KiB) Viewed 11115 times
fth0
Volunteer
Posts: 5661
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Shared clipboard not working with Linux guest

Post by fth0 »

In the Oracle%20Linux%208-2021-08-27-15-02-27.log file, I didn't see any indication of Shared Clipboard issues. I noticed only two rarely used settings (System > Motherboard > Chipset set to ICH9 instead of PIIX3, and System > Processor > Nested VT-x/AMD-V being enabled), which I wouldn't expect to have influence on the Shared Clipboard, though.

In the Linux guest, you could try the following commands for additional logging:

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_FLAGS="time tid thread" VBOX_RELEASE_LOG="all.e.l.l2.l3.f" VBoxClient -d --clipboard
le_jawa
Posts: 12
Joined: 24. Jan 2012, 19:16
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Ubuntu, RHEL/Oracle/CentOS

Re: Shared clipboard not working with Linux guest

Post by le_jawa »

fth0 -
Thanks for looking at that. I used the commands you provided, but I'm not sure it did what it was supposed to. clipboard.log was not created in /tmp, and I noticed that when I run VBoxClient at the end,I get a message saying "Worker loop running" and the command prompt does not return. I presume that VBoxClient is a daemon and does not return to the prompt, but I've put it in here just in case.

I have attached the latest log file, also just in case it proves useful.
Attachments
Oracle Linux 8-2021-08-30-13-31-18.log.zip
(40.89 KiB) Downloaded 8 times
fth0
Volunteer
Posts: 5661
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Shared clipboard not working with Linux guest

Post by fth0 »

le_jawa wrote:I used the commands you provided, but I'm not sure it did what it was supposed to.
You're right. ;)

"-d" is equivalent to "--nodaemon" (counterintuitive to me). In consequence, with "-d" the log messages are printed to the shell, and without "-d" they are printed to the given log file. Other than that, it works for me as expected, and log messages are printed for copy and paste operations.
le_jawa
Posts: 12
Joined: 24. Jan 2012, 19:16
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Ubuntu, RHEL/Oracle/CentOS

Re: Shared clipboard not working with Linux guest

Post by le_jawa »

fth0-
Tried that, no log file is being generated; I even killed and restarted the draganddrop client daemon, and that had no effect. Come to think of it, when I was running it in the foreground, I never saw any messages going to the terminal either

To be certain that I communicated the problem clearly... Neither drag 'n' drop nor copy 'n' paste from the guest to the host works at all (or the other way, for that matter). When I try to drag from the guest to the host, the file icon goes the edge of the VM screen and stops there. If I go the other way around, I see the Mac icon for the file go over the VM screen, but it doesn't drop there; it just cancels. If I try to copy and paste from the guest to the host, nothing is ever on my Mac clipboard.

So... any other thoughts?
fth0
Volunteer
Posts: 5661
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Shared clipboard not working with Linux guest

Post by fth0 »

When running the command in the foreground (with "-d"), you saw at least the "Worker loop running" message. When running daemonized (without "-d"), did you write the whole command VBOX_RELEASE_LOG_DEST="file=/tmp/clipboard.log" VBOX_RELEASE_LOG_FLAGS="time tid thread" VBOX_RELEASE_LOG="all.e.l.l2.l3.f" VBoxClient --clipboard in a single line? I'm asking because I just noticed that this forum software can create the impression that the command spans multiple lines. ;)

But it doesn't really matter: Simply run the command in the foreground (with "-d").

Does macOS perhaps require any special security permissions to let VirtualBox access the macOS clipboard?
granada29
Volunteer
Posts: 687
Joined: 3. Mar 2015, 07:27
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Linux, macOS, Windows

Re: Shared clipboard not working with Linux guest

Post by granada29 »

I just tested with

Host
macOS 11.5.2
VirtualBox 6.1.26 r145957
Security & Privacy: Full disk access for VirtualBox

VM
Linux debian bullseye debian-64bit
8192MB RAM
Shared Clipboard: Bidirectional
Drag'n'Drop: Bidirectional
3 vCPU
KDE windowing environment

It all worked as expected, being able to D&D both text and images. I have never used the Oracle Linux VM but debian bullseye definitely is working.
le_jawa
Posts: 12
Joined: 24. Jan 2012, 19:16
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Ubuntu, RHEL/Oracle/CentOS

Re: Shared clipboard not working with Linux guest

Post by le_jawa »

Hmmmm... The main difference between my setup and yours is the distro. I'll have to throw Ubuntu or Debian on and see if that makes any difference.
le_jawa
Posts: 12
Joined: 24. Jan 2012, 19:16
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Ubuntu, RHEL/Oracle/CentOS

Re: Shared clipboard not working with Linux guest

Post by le_jawa »

fth0 wrote:When running the command in the foreground (with "-d"), you saw at least the "Worker loop running" message. When running daemonized (without "-d"), did you write the whole command VBOX_RELEASE_LOG_DEST="file=/tmp/clipboard.log" VBOX_RELEASE_LOG_FLAGS="time tid thread" VBOX_RELEASE_LOG="all.e.l.l2.l3.f" VBoxClient --clipboard in a single line? I'm asking because I just noticed that this forum software can create the impression that the command spans multiple lines. ;)

But it doesn't really matter: Simply run the command in the foreground (with "-d").

Does macOS perhaps require any special security permissions to let VirtualBox access the macOS clipboard?
Variable setting: I had done that on separate lines previously, so I tried them all together, with no effect. Since it is just setting variables, I can't imagine putting them on 1 line or 3 would make a difference. (But I don't know it all, especially where VB is concerned :D )

Clipboard permissions: VB has "Accessibility" and "Input Monitoring"; that should cover everything it needs for clipboard access.

Tried the same thing with drag and drop, got an entirely different result this time (see attachment).
DragnDrop Error.png
DragnDrop Error.png (113.53 KiB) Viewed 10917 times
fth0
Volunteer
Posts: 5661
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Shared clipboard not working with Linux guest

Post by fth0 »

le_jawa wrote:Since it is just setting variables, I can't imagine putting them on 1 line or 3 would make a difference.
In a Linux OS, you can use different shells. In BASH for example, you'd have to use the export command. See Defining a Bash Variable With or Without ‘export’.
le_jawa
Posts: 12
Joined: 24. Jan 2012, 19:16
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Ubuntu, RHEL/Oracle/CentOS

Re: Shared clipboard not working with Linux guest

Post by le_jawa »

Grrrrr... :x I installed Ubuntu and the GA's, and it doesn't work there either. Maybe fth0 was on to something with permissions. I'll take a look at that, but if anyone else has any other thoughts, feel free to share.
fth0
Volunteer
Posts: 5661
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Shared clipboard not working with Linux guest

Post by fth0 »

I re-learned today to ask an easy question first:

VirtualBox only supports the X11 clipboard. Does your Linux guest OS provide an X11 clipboard?

Background information: The Wayland clipboard and the X11 clipboard are two different things, and VirtualBox only supports the X11 clipboard. Wayland installations can provide an X11 clipboard, but it depends on their configuration. Look for components like KWayland or XWayland, and investigate if your guest OS has a running X11 clipboard (and not "only" a running Wayland clipboard).
le_jawa
Posts: 12
Joined: 24. Jan 2012, 19:16
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Ubuntu, RHEL/Oracle/CentOS

Re: Shared clipboard not working with Linux guest

Post by le_jawa »

Aw dang, I didn't even know that Wayland had a different clipboard. It sounds like you probably just hit the nail on the head.

Thanks for bringing that up; I'll have to go educate myself a little bit and see what I can do.
le_jawa
Posts: 12
Joined: 24. Jan 2012, 19:16
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Ubuntu, RHEL/Oracle/CentOS

Re: Shared clipboard not working with Linux guest

Post by le_jawa »

I've been digging around for info on this for about 3 hours now, and I can't anything definitive regarding an X-server and support for VirtualBox. Here's what (I think) I know at this point:
  1. There are a couple of packages that add X functionality/compatibility to Wayland: XWayland and mutter.
  2. There's nothing definitive on either of these and VirtualBox
  3. The only solid, direct suggestion I can see is to move back to X11 instead of Wayland
So is that accurate, that XWayland and mutter don't solve the problem, and X11 is the only solution?

If anyone can offer advice on Wayland and VirtualBox, I'd really appreciate it.
fth0
Volunteer
Posts: 5661
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Shared clipboard not working with Linux guest

Post by fth0 »

le_jawa wrote:So is that accurate, that XWayland and mutter don't solve the problem, and X11 is the only solution?
I'm not sure. For Wayland, you'll have to check at least two things: If XWayland runs an X11 clipboard, and if VBoxClient --clipboard is running. One starting point may be ps -elfH | grep -i clipboard.
Post Reply