How to properly reset the VBoxClient clipboard (copy-paste from guest to host) on Devuan Linux and probably Debian too

There is an elusive bug in the VirtualBox client software, which on rare occasions causes the clipboard to stop working. I've seen the issue with both Windows and Linux guests, and I've developed workarounds by writing tiny scripts that reset the client software. However, my standard Devuan client has not been easy to do this with. Over years of experimenting and often just manually restarting the client, I've finally found out what makes this work reliably:

  • On Devuan, and possibly other Debian derivatives, when the client gets restarted, it creates 2 processes instead of one. You have to delete the 2nd process (but not the 1st) and then everything works as expected.
  • Also there needs to be a pause while the original failed client is being killed, otherwise the new client doesn't always work.

So here is a lil script I wrote to solve the problem. I call it "byeclipboard.sh" and I put the following lines in a bash script, made it executable. When the issue occurs, it's only a couple seconds to run the script and have my copy-paste clipboard working again:

echo 'ending VBoxClient process...'
pkill -9 VBoxClient
echo 
echo 'sleeping...'
sleep 1
echo 
echo 'starting new VBoxClient...'
VBoxClient --clipboard
echo 
echo 'show process says this:'
ps -aux|grep VBoxClient
echo 
echo 'ending duplicate...'
kill $(ps -aux|grep VBoxClient|grep ' S '| awk '{print $2}')
echo 
echo 'show process now says this:'
ps aux | grep -v grep | grep 'VBoxClient --clipboard'
echo 
echo 'all done.'

And for those who are curious, here's what it looks like when it runs:

./byeclipboard.sh 
ending VBoxClient process...

sleeping...

starting new VBoxClient...
12:44:27.701746 main     VBoxClient 7.2.2 r170484 (verbosity: 0) linux.amd64 (Sep 10 2025 18:43:28) release log
12:44:27.701747 main     Log opened 2025-12-04T12:44:27.701741000Z
12:44:27.701763 main     OS Product: Linux
12:44:27.701765 main     OS Release: 5.10.0-35-amd64
12:44:27.701766 main     OS Version: #1 SMP Debian 5.10.237-1 (2025-05-19)
12:44:27.701769 main     Executable: /opt/VBoxGuestAdditions-7.2.2/bin/VBoxClient
12:44:27.701769 main     Process ID: 7434
12:44:27.701769 main     Package type: LINUX_64BITS_GENERIC
12:44:27.701773 main      VBoxClient 7.2.2 r170484 started. Verbose level = 0
12:44:27.702449 main      Session type is: VBGHDISPLAYSERVERTYPE_X11
12:44:27.702459 main      Service: Shared Clipboard
12:44:27.702488 main      Daemonizing service ...

show process says this:
clearhat     7437  0.0  0.0  18736   360 ?        S    06:44   0:00 VBoxClient --clipboard
clearhat     7439  0.0  0.0   6240   648 pts/0    S+   06:44   0:00 grep VBoxClient
clearhat     7440  0.0  0.0 217516  4168 ?        Sl   06:44   0:00 VBoxClient --clipboard

ending duplicate...

show process now says this:
clearhat     7440  0.0  0.0 217548  4216 ?        Sl   06:44   0:00 VBoxClient --clipboard

all done.

Have fun!

 

 

Add a comment

Fields followed by * are mandatory

HTML code is displayed as text and web addresses are automatically converted.

Page top