How to enable Shared Clipboard & Drag-and-Drop features inside VirtualBox with Whonix-LXQt-18.0.8.7 ?

Full Bash script from Filebin URL above:

#!/bin/bash
set -o nounset
set -o pipefail

UNIT_NAME='vbox-wayland-clipboard.service'
UNIT_PATH='/usr/lib/systemd/user/vbox-wayland-clipboard.service'
LAUNCH_PATH='/usr/libexec/vm-config-dist/vbox-wayland-clipboard-autostart'
DESK_PATH='/etc/xdg/autostart/vbox-wayland-clipboard.desktop'

red() { printf '\033[31m%s\033[0m\n' "$*"; }
grn() { printf '\033[32m%s\033[0m\n' "$*"; }
ylw() { printf '\033[33m%s\033[0m\n' "$*"; }

if [ "$(id -u)" -ne 0 ]; then
   red "ERROR: run as root in the 'sysmaint' boot mode:  sudo bash $0"
   exit 1
fi

search_dirs=(/etc/systemd/user /run/systemd/user /usr/lib/systemd/user \
             /usr/local/lib/systemd/user /root/.config/systemd/user)
for h in /home/*; do
   [ -d "$h/.config/systemd/user" ] && search_dirs+=("$h/.config/systemd/user")
done

echo "=== INSTALL ==="

echo "[1/6] clearing masks (/dev/null symlinks) and empty unit files ..."
for d in "${search_dirs[@]}"; do
   f="$d/$UNIT_NAME"
   if [ -L "$f" ] || { [ -e "$f" ] && [ ! -s "$f" ]; }; then
      echo "  removing $f"
      rm -f "$f"
   fi
done
systemctl --global unmask "$UNIT_NAME" 2>/dev/null || true

echo "[2/6] writing $UNIT_PATH ..."
install -d /usr/lib/systemd/user
cat > "$UNIT_PATH" <<'UNIT'
[Unit]
Description=VirtualBox shared clipboard for Wayland (opt-in, default-off)
ConditionVirtualization=oracle
ConditionEnvironment=WAYLAND_DISPLAY
StartLimitIntervalSec=10
StartLimitBurst=3

[Service]
Type=simple
ExecStart=/usr/bin/VBoxClient --foreground --wayland
Restart=on-failure
RestartSec=2s

[Install]
WantedBy=default.target
UNIT

echo "[3/6] writing $LAUNCH_PATH ..."
install -d /usr/libexec/vm-config-dist
cat > "$LAUNCH_PATH" <<'LAUNCH'
#!/bin/bash
set -o nounset
set -o pipefail
PATH=/usr/bin:/bin
unit='vbox-wayland-clipboard.service'
state="$(systemctl --user is-enabled "$unit" 2>/dev/null || true)"
case "$state" in
   enabled|enabled-runtime) ;;
   *) exit 0 ;;
esac
counter=0
while [ "$counter" -lt 50 ]; do
   systemctl --user show-environment 2>/dev/null | grep -q '^WAYLAND_DISPLAY=' && break
   counter="$(( counter + 1 ))"
   sleep 0.2
done
systemctl --user reset-failed "$unit" 2>/dev/null || true
exec systemctl --user start "$unit"
LAUNCH
chmod 755 "$LAUNCH_PATH"

echo "[4/6] writing $DESK_PATH ..."
cat > "$DESK_PATH" <<'DESK'
[Desktop Entry]
Type=Application
Name=VirtualBox shared clipboard for Wayland (opt-in)
Exec=/usr/libexec/vm-config-dist/vbox-wayland-clipboard-autostart
StartupNotify=false
NoDisplay=true
NotShowIn=QUBES;
DESK

echo "[5/6] Guest Additions device (/dev/vboxuser) on every boot ..."
systemctl enable --now virtualbox-guest-utils.service 2>/dev/null \
   || ylw "  virtualbox-guest-utils.service not found; loading module only."
echo vboxguest > /etc/modules-load.d/vboxguest.conf
modprobe vboxguest 2>/dev/null || true

echo "[6/6] enabling for ALL users ..."
systemctl daemon-reload
systemctl --global enable "$UNIT_NAME"

echo
echo "=== CHECKUP ==="
fail=0; warn=0

chk_file() {
   local p="$1" min="$2" sz
   if [ -L "$p" ]; then red "  FAIL  $p is a symlink (masked?)"; fail=$((fail+1)); return; fi
   if [ ! -f "$p" ]; then red "  FAIL  $p missing"; fail=$((fail+1)); return; fi
   sz="$(wc -c < "$p")"
   if [ "$sz" -lt "$min" ]; then red "  FAIL  $p is $sz bytes (empty/too small)"; fail=$((fail+1)); return; fi
   grn "  OK    $p ($sz bytes)"
}
chk_file "$UNIT_PATH"   100
chk_file "$LAUNCH_PATH" 100
chk_file "$DESK_PATH"    50

leftover=0
for d in "${search_dirs[@]}"; do
   f="$d/$UNIT_NAME"
   [ "$f" = "$UNIT_PATH" ] && continue
   if [ -L "$f" ] || { [ -e "$f" ] && [ ! -s "$f" ]; }; then
      red "  FAIL  leftover mask/empty: $f"; leftover=$((leftover+1)); fail=$((fail+1))
   fi
done
[ "$leftover" -eq 0 ] && grn "  OK    no leftover masks / empty unit files"

if [ -x "$LAUNCH_PATH" ]; then grn "  OK    launcher is executable"; else red "  FAIL  launcher not executable"; fail=$((fail+1)); fi

if [ -L "/etc/systemd/user/default.target.wants/$UNIT_NAME" ]; then
   grn "  OK    enabled for all users (default.target.wants symlink present)"
else
   ylw "  WARN  global enable symlink missing"; warn=$((warn+1))
fi

if command -v VBoxClient >/dev/null 2>&1; then
   grn "  OK    VBoxClient present ($(VBoxClient --version 2>/dev/null | head -n1))"
else
   red "  FAIL  /usr/bin/VBoxClient not found (Guest Additions missing)"; fail=$((fail+1))
fi

if lsmod 2>/dev/null | grep -q '^vboxguest'; then grn "  OK    vboxguest module loaded"; else ylw "  WARN  vboxguest module not loaded"; warn=$((warn+1)); fi
if [ -e /dev/vboxuser ]; then grn "  OK    /dev/vboxuser present"; else red "  FAIL  /dev/vboxuser missing (VBoxClient will fail VbglR3InitUser)"; fail=$((fail+1)); fi

echo
if [ "$fail" -eq 0 ]; then grn "RESULT: install OK ($warn warning(s))."; else red "RESULT: $fail problem(s), $warn warning(s) — fix the FAIL lines above."; fi
echo
echo "NEXT:"
echo "  1) On the HOST (normal user, VM powered off):"
echo "       VBoxManage modifyvm \"<vm-name-or-uuid>\" --clipboard-mode bidirectional"
echo "     and launch the VM as your NORMAL user, not root."
echo "  2) Reboot Whonix into the normal 'user' mode."
echo "  3) As 'user' (no sudo) verify:"
echo "       systemctl --user is-enabled $UNIT_NAME    # => enabled  (NOT masked)"
echo "       systemctl --user status    $UNIT_NAME     # => active (running)"

[ "$fail" -eq 0 ] && exit 0 || exit 1
1 Like

I would prefer to try updating virtualbox and the guest additions before trying these scripts. This is because in theory the updated virtualbox should have fixed the issue. But right now, I am stuck (see previous comment).

I have done a test of current Wayland shared clipboard compatibility using a non-Whonix Virtualbox virtual machine.

Virtualbox version- version 7.2.8, from Oracle, for Ubuntu Noble
Host- Zorin OS 18.1, running Wayland with GNOME
Guest- Fedora KDE 44, running Wayland on KDE Plasma.

Apparently, this version of Fedora comes with virtualbox guest additions version 7.2.6 already pre-installed. I was able to mount the virtualbox guest additions ISO, but I did not install them. This is because the installer warned me not to install them if I already have virtualbox guest addtions installed by the distribution. The installer said that I needed to uninstall the preexisting guest additions and then install the guest additions from the ISO. I am not completely sure on exactly how to do this, and I did not want to figure it out, since I could already see that bidirectional clipboard sharing was working on the current version of guest additions.

Conclusion-
Bidirectional clipboard sharing works perfectly between the Wayland host and the Wayland guest.
Additionally, mounting an ISO for the virtualbox guest additions works perfectly. However, I did not go through with installing the guest additions from it, since I could already see that the clipboard sharing was working with the pre-installed guest additions that came as part of the ISO.

Conclusion 2-
The clipboard sharing issue does not appear to be virtualbox-specific any longer. It is now Whonix-specific, unless my test was flawed in some way.

Please let me know if there is any flaw in my test or my conclusions. If you think it would be more appropriate to try a different guest distribution or follow different directions, please provide the directions so that I may conduct a correct test.

To conclude it’s Whonix specific, functionality testing is required on a Debian stable host with a Debian stable VM.

Fortunately, I have a spare laptop lying around. For my next test, I will install debian-lxqt from Debian -- Live install images on that laptop. I will install the latest version of Virtualbox from Oracle. Then I will install whonix-gateway, whonix-workstation and debian-lxqt as three virtual machines on it.

Hi, for unknown reason clipboard works from Vm to host, but not vice versa.

I`ve installed latest script version from filesharin service
both systemctl indicates that everything is working, so no idea whys that
Version 7.2.8 r173730 (Qt6.8.0 on xcb), host is Mint 22.3 cinnamon

Thank you for effort anyway, at least we are moving somewhere

So I installed debian-lxqt on a spare laptop for this test. But I discovered that it did not come with wayland support automatically. Fortunately, I found a way to install it. Although I did not document it while I was doing it, I am going to try to document it here to the best of my memory. That way, if someone wants to follow me and does not know what to do, they have a roadmap ready to go.

What we want to do is install lxqt-wayland-session. Unfortunately, this is in debian sid and not the mainline debian.

Step 1- Add debian sid to our sources list

sudo nano /etc/apt/sources.list.d/sid.list

Add the following text-

deb http://deb.debian.org/debian sid main

Save and close the file.

Step 2- Configure apt pinning in order to avoid upgrading all packages from debian sid

sudo nano /etc/apt/preferences.d/99-sid-repository-pinning

Add the following text-

Package: *
Pin: release a=unstable
Pin-Priority: -10

Save and close the file.

Step 3- Install lxqt-wayland-session

sudo apt update
sudo apt upgrade
sudo apt install -t sid lxqt-wayland-session

Step 4- Install labwc

sudo apt install labwc

You may or may not have to restart the computer after this. If you do, open up LXQT desktop on the login screen and continue to have X11 selected.

Step 5- Set up labwc as your wayland compositor.
Go into the menu and open up Session Settings.
Click the icon that says “Wayland Settings (Experimental)”.
Select labwc as your wayland compositor in the resulting interface.
Restart the computer.
At the login screen, select “LXQt Desktop (Wayland)” and login.

Step 6- Check to make sure you are using wayland.

sudo apt install fastfetch
fastfetch

Step 7 (Optional)- Install Kanshi in order to configure the display resolution.

sudo apt install kanshi

Use wdisplays to find out the name of your monitor

sudo apt install wdisplays
wdisplays

Write a configuration file for kanshi that sets the display resolution to what you want.

nano /home/user/.config/kanshi/config

Your configuration file will depend on your preferences and the name of your display. Here is an example.

profile {
	output eDP-1 enable scale 1.5
}

Save the file.

Step 8 (Optional)- Add kanshi to autostart
Open up Session Settings.
Click on Autostart.
Press Add.
Name: kanshi
Command: kanshi
Press OK.
Restart the computer.

We are now ready to install Oracle Virtualbox. Later I will continue with my test.

1 Like

Sorry that I have not been punctual with my testing. So far, I have ran into a few snags.

At first, virtualbox was not working at all.

In order to fix this error, I had to blacklist kvm kernel modules.

sudo systemctl stop libvirtd
sudo systemctl disable --now libvirtd
sudo modprobe -r kvm_intel kvm_amd kvm
sudo nano /etc/modprobe.d/blacklist-kvm.conf
sudo update-initramfs -u
sudo reboot

This fixed that issue, and I was able to run virtualbox.

Then I had to install debian-lxqt virtualbox guest and guest additions.
After inserting the guest additions cd image under devices…

cd /media/virtualbox/VBox_GAs_7.2.8
sudo sh ./VBoxLinuxAdditions.run

At this point, debian-lxqt guest is on x11, while the host is on wayland using labwc.
But despite selecting bidirectional clipboard sharing, only clipboard sharing from guest to host works. Host to guest clipboard sharing does not work.

I noticed that when I booted up debian-lxqt, I got 4 errors on startup. I used “sudo journalctl -b” in the terminal in order to find them later.

The first error relates to the issue I had with this laptop and posted about at http://forums.dds6qkxpwdeubwucdiaord2xgbbeyds25rbsgr73tbfpqpt4a6vjwsyd.onion/t/retbleed-warning/20226. I never fixed the issue, which is one reason why I moved over to using another laptop that does not have this problem. Regardless, it is not the cause of the clipboard sharing issue.

The other issue has to do with vmwgfx. I do not understand what this is, but I was able to find a workaround by changing the graphics controller from VMSVGA to VBoxVGA in the Screen tab in the display settings. However, this does not resolve the shared clipboard issue.

So my first conclusion is that with a Debian Trixie LXQt host running labwc and a Debian Trixie Guest running LXQT desktop under X11, clipboard sharing only works from guest to host. It does not work from host to guest.

I went ahead and restarted the host system under LXQT Desktop (X11). When keeping the host and the guest on X11, clipboard sharing does work bidirectionally.

Next I need to change the guest to use Wayland and test whether bidirectional clipboard sharing works with a Wayland host and an X11 host. Then, I need to check the whonix VMs.

1 Like

hi mate, just try to do that on clean whonix (just deploy new workstation)
don’t forget to set bidirectional and version of Vbox req 7.2.8+ so check it also

1 Like

A new version of virtualbox has just been released.

~$ apt policy virtualbox-7.2
virtualbox-7.2:
  Installed: 7.2.10-174163~Debian~trixie
  Candidate: 7.2.10-174163~Debian~trixie
  Version table:
 *** 7.2.10-174163~Debian~trixie 500
        500 https://download.virtualbox.org/virtualbox/debian trixie/contrib amd64 Packages
        100 /var/lib/dpkg/status

Guest additions 7.2.10 must also be installed.

cd /media/virtualbox/VBox_GAs_7.2.10
sudo sh ./VBoxLinuxAdditions.run

Under this version,

Scenario 1-
Host: Debian GNU/Linux 13 (trixie) x86_64 with LXQT, Wayland, and labwc
Guest: Debian GNU/Linux 13 (trixie) x86_64 with LXQT, X11, guest additions 7.2.10 installed.
Clipboard sharing only works from guest to host. Clipboard sharing does not work from host to guest.

Scenario 2-
Host: Debian GNU/Linux 13 (trixie) x86_64 with LXQT, Wayland, and labwc
Guest: Debian GNU/Linux 13 (trixie) x86_64 with LXQT, Wayland, labwc, guest additions 7.2.10 installed.
Clipboard sharing does not work at all, from either direction.

Scenario 3-
Host: Debian GNU/Linux 13 (trixie) x86_64 with LXQT, Wayland, and labwc
Guest: Whonix-Workstation-LXQt Build version 18.1.4.2
I am unable to mount the Virtualbox Guest Additions disk.
Clipboard sharing does not work at all, from either direction.

2 Likes

Whonix-Workstation VirtualBox VMs do not have a virtual optical disk drive by default. You need to add one in the VM’s settings menu first.

1 Like

Regular users have already released a fix. When will there be an official update? Does anyone know if I should create an issue in the code repository?

The issue is already well known by the developers and the ticket for getting the fix implemented is high-priority, so submitting an issue is not necessary.

We don’t generally provide ETAs. They’re notoriously difficult to get right, sometimes aren’t in our control, and can easily slip if other critical tasks end up higher priority. The best we provide is a prioritized development roadmap:

1 Like

Whonix 18.2.1.7 (internal developers-only release) comes with virtualbox-guest-additions-iso installed by default (sourced from Oracle virtualbox.org, installed using vbox-guest-installer (during vm-config-dist.postinst).

Systemd user unit vboxclient-wayland.service executes /usr/bin/VBoxClient --foreground --wayland.

On a Windows test machine with a Kicksecure or Whonix guest:

  • VM to host copy/paste: Functional.
  • Host to VM copy/paste: Functional.

Using VirtualBox host software version 7.2.12.

1 Like

But now a vm-config-dist update broke it again.

systemctl --user status vboxclient-wayland.service
                                          
vboxclient-wayland.service - VirtualBox clipboard sharing for Wayland
     Loaded: loaded (/usr/lib/systemd/user/vboxclient-wayland.service; static)
     Active: active (running) since Tue 2026-07-14 19:48:31 UTC; 4min 53s ago
 Invocation: c9ebf3d1dd6c4e698290ef6021928d95
   Main PID: 2213 (VBoxClient)
      Tasks: 6 (limit: 2339)
     Memory: 6.5M (peak: 8.5M)
        CPU: 208ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/vboxclient-wayland.service
           2213 /usr/bin/VBoxClient --foreground --wayland

Jul 14 19:48:32 localhost VBoxClient[2213]: 19:48:32.256302 main     VBoxClient Wayland: found Wayland Shared Clipboard helper 'wayland-dcp-legacy'
Jul 14 19:48:32 localhost VBoxClient[2213]: 19:48:32.256430 main     VBoxClient Wayland: Error: Wayland Drag-and-Drop helper not found, drag-and-drop not possible
Jul 14 19:48:32 localhost VBoxClient[2213]: 19:48:32.256481 main     VBoxClient Wayland: Creating worker thread ...
Jul 14 19:48:32 localhost VBoxClient[2213]: 19:48:32.265192 wl-clip  VBoxClient Wayland: cannot process host clipboard event, rc=VERR_NO_DATA
Jul 14 19:48:32 localhost VBoxClient[2213]: 19:48:32.268797 main     VBoxClient Wayland: Service started
Jul 14 19:50:46 localhost VBoxClient[2213]: 19:50:46.357144 wl-clip  VBoxClient Wayland: cannot process host clipboard event, rc=VERR_TIMEOUT
Jul 14 19:50:53 localhost VBoxClient[2213]: 19:50:53.653966 wl-clip  VBoxClient Wayland: cannot process host clipboard event, rc=VERR_TIMEOUT
Jul 14 19:51:15 localhost VBoxClient[2213]: 19:51:15.969664 wl-clip  VBoxClient Wayland: cannot process host clipboard event, rc=VERR_TIMEOUT
Jul 14 19:51:38 localhost VBoxClient[2213]: 19:51:38.642341 wl-clip  VBoxClient Wayland: cannot process host clipboard event, rc=VERR_TIMEOUT
Jul 14 19:53:19 localhost VBoxClient[2213]: 19:53:19.271456 wl-clip  VBoxClient Wayland: cannot process host clipboard event, rc=VERR_TIMEOUT

May be broken due to code changes or due to re-installation of guest additions during package upgrade.

1 Like

Fixed using:

sudo mv /etc/xdg/autostart/vboxclient.desktop ~/

Our systemd user unit vboxclient-wayland.service might compete with /etc/xdg/autostart/vboxclient.desktop.

1 Like

It might not be truly broken; clipboard sharing is flaky in my experience. Sometimes it works. Sometimes you see weird timeout errors. Sometimes it seems to not work at all. Sometimes if you press Ctrl+V many times (20 or so) it will start working. The best way I’ve found to mitigate this is to always ensure clipboard sharing is disabled in VirtualBox before shutting down or rebooting a VM. Then once the VM is fully booted, enable clipboard sharing. This seems to avoid whatever is getting the clipboard sharing code hung up, at least partially.

1 Like

File /etc/xdg/autostart/vboxclient.desktop is now deleted by vbox-guest-installer.