167

Sometimes while using VirtualBox, I have tried copying text from the virtual machine to the host machine but failed. Whenever that happens, I fix it by rebooting the virtual machine. Is there a solution to this because I don't want to keep rebooting again and again.

Note: It is always possible for me to copy text from the host to the virtual machine.

Nicolas Raoul
  • 11,921
sam
  • 6,921

18 Answers18

168

If your guest OS is ubuntu then running following two commands in ubuntu terminal should help:

$ killall VBoxClient
$ VBoxClient-all
Dmitry
  • 2,229
44

On a Windows XP guest, I can kill "VBoxTray.exe" using the Task Manager (Ctrl+Alt+Del), then restart it from "Program Files/VirtualBox Guest Additions".

slava
  • 4,085
sam
  • 6,921
36

Install VBoxClient (requirement for next step):

sudo apt install virtualbox-guest-x11

Restart the VBox clipboard module:

pkill 'VBoxClient --clipboard' -f & sleep 1 && VBoxClient --clipboard

DBedrenko
  • 461
31

In the Oracle virtual box setting go to

Settings > General > Advance

There is a an option Drag n Drop. Select the direction you want to copy the text.

amjad
  • 689
27

For me, Windows 7 host and Ubuntu 16.04 guest, I had to install VirtualBox guest additions.

  1. Start the virtual machine
  2. Click Devices menu
  3. Select Insert Guest Additions CD image
  4. Change to the directory where your CD-ROM drive is mounted (typically /media/<user>/VBOXADDITIONS_x.x.x/)
  5. Install it sudo sh ./VBoxLinuxAdditions.run
  6. Reboot the virtual machine!

I found the complete steps in this link

16

In Ubuntu you may need to install virtualbox-guest-x11

sudo apt-get install virtualbox-guest-x11

and then start virutal box client

VBoxClient-all
Jossef Harush Kadouri
  • 5,326
  • 2
  • 23
  • 23
Bala
  • 161
8

On Ubuntu 18.04 running on VirtualBox 5.2.22, I did the following:

  1. On VirtualBox Manager, right click Ubuntu VM -> Settings -> General tab on left -> Advanced tab on right`.
    Now choose Shared Clipboard as : Bidirectional

  2. On Ubuntu, on the terminal run the following commands:

    sudo apt install virtualbox-guest-x11
    

Now I had to restart Ubuntu to run the below command run successfully:

VBoxClient --clipboard

After this, the bi-directional copy started working.

Gryu
  • 8,002
  • 9
  • 37
  • 53
6

How to fix shared clipboard in VirtualBox (Windows Guest)

  1. In VirtualBox Windows Guest, Open Task Manager
  2. Go to Processes Tab, highlight VBoxTray.exe and select End Process
  3. Go to Applications Tab and select New Task
  4. Browse to the VirtualBox Guest Additions installation folder and select VBoxTray.exe and select OK.

The bidirectional shared clipboard should work afterwards.

5

In Ubuntu 16.10 I had to run following command to get it to work:

service virtualbox-guest-utils start

In addition to this, set the Shared Clipboard setting to Bidirectional in General/Advanced Virtual box settings.

Dave Jarvis
  • 991
  • 2
  • 12
  • 26
3

If needed, upgrade VirtualBox to latest version, currently 4.1.2, they solved many issues. Then reinstall Guest Additions on the VM, as copy-paste is managed by guest additions drivers.

Stefano
  • 2,394
2

Enabling Shared Clipboard on Ubuntu 19.10 Host, Ubuntu 18.04 Guest, VirtualBox 6.1.

VirtualBox VM Menu ->
Machine ->
  General ->
   Advanced ->
    Shared Clipboard: Bidirectional

is set

The guest's Ubuntu terminal commands:

sudo apt install virtualbox-guest-x11 --reinstall
VBoxClient-all --clipboard

I used --reinstall option because of I had virtualbox-guest-x11 package installed and before reinstalling it I had:

$ VBoxClient-all --clipboard
VBoxClient: error: No service specified. Quitting because nothing to do!

After reboot screen resolution jumps to its minimal value, so

VirtualBox VM Menu ->
View ->
  Auto-resize Guest Display

clicking would be required if you want it.

Gryu
  • 8,002
  • 9
  • 37
  • 53
1

As of time of this post,

In my case, I've noticed bidirectional copy/paste doesn't work when VM is started in detachable mode.

For bidirectional copy/paste to work, I had to start the VM in Normal mode.

Ubuntu 20.04, Virtual Box 6.1

Wadih M.
  • 392
1

Copy and paste does work (provided you have installed VBoxGuestAdditions), but there is a few caveats:

  • There is text copy-and-paste and there is file copy-and-paste
  • If your VM is Windows, copy and paste should work for both text and file
  • If your VM is Ubuntu (or a flavor thereof, eg. Lubuntu)
    • text copy and paste should work
    • to copy files, you have to use the VirtualBox file manager...

To use File Manager...

  • In the VM window, choose file manager... open file manager

  • Log in using a linux user that exist on the VM to create a session log in to file manager

  • Then use the copy buttons copy between host and guest

tno2007
  • 141
1

I use a Mac Host OS, and Ubuntu Guest (with lubuntu desktop).

Dmitry's answer got me so close! But VBoxClient wasn't running when I looked for it with ps, and trying VBoxClient-all failed:

$ VBoxClient-all
Failed to connect to the VirtualBox kernel service
Failed to connect to the VirtualBox kernel service
Failed to connect to the VirtualBox kernel service
Failed to connect to the VirtualBox kernel service
Failed to connect to the VirtualBox kernel service

Then I found https://www.virtualbox.org/ticket/9332

Turns out, VirtualBox additions didn't launch automatically for some reason. Starting vboxadd manually allowed me to then run the VBoxClient with the clipboard enabled.

arin@arin-VirtualBox:~$ sudo /etc/init.d/vboxadd start
Starting the VirtualBox Guest Additions ...done.
arin@arin-VirtualBox:~$ ps -ef | grep -i vbox
arin      2687 22537  0 10:53 pts/1    00:00:00 grep --color=auto -i vbox
arin@arin-VirtualBox:~$ sudo /usr/bin/VBoxClient --clipboard
arin@arin-VirtualBox:~$ ps -ef | grep -i VBox
root      2693 22100  0 10:53 ?        00:00:00 /usr/bin/VBoxClient --clipboard
arin      2698 22537  0 10:53 pts/1    00:00:00 grep --color=auto -i VBox

And now copy/paste works!

arinmorf
  • 141
  • 3
0

On the guest, apt gets the wrong version! On the host, verify with something like

VBoxManage --version
VBoxManage guestproperty get VM /VirtualBox/GuestAdd/VersionExt
VBoxManage guestproperty get VM /VirtualBox/GuestAdd/Version
VBoxManage guestproperty get VM /VirtualBox/GuestAdd/Revision

where VM is your Virtual Machine name or uuid. You may need to specify the path, e.g.,

"C:\Program Files\Oracle\VirtualBox\VBoxManage" --version
⋮

On the guest, with VirtualBox > Devices > Insert Guest Additions CD Image… and privs (and headers) I mounted the CD and re-installed it. On the host, I verified the versions match. On the guest,

VBoxClient --version
VBoxClient --clipboard

fixed everything without rebooting. YMMV. I wonder what happens if you try

VBoxManage guestcontrol VM updatega --source=guest-additions.ISO
Devon
  • 111
0

My configuration is Windows host, Xubuntu guest. I guess it doesn't hurt to restart everything, but this is the client that matters. (VBoxClient-all is merely a script that runs /usr/bin/VBoxClient --clipboard and others.)

$ ps -fe|grep -i clip
tbc       1400     1  0 Jan18 ?        00:00:00 /usr/bin/VBoxClient --clipboard
$
$ p=1400;kill -int $p;ps -fp $p
$ /usr/bin/VBoxClient --clipboard
$ ps -fe|grep -i clip
tbc      30555  1281  0 13:01 ?        00:00:00 /usr/bin/VBoxClient --clipboard
$ pstree -sp 30555
init(1)---lightdm(1094)---lightdm(1261)---init(1281)---VBoxClient(30555)---{VBoxClient}(30556)
$

Note it runs in the background by default. It was owned by init(1), but when I invoked it, it got adopted through a tree I'm not familiar with.

tbc0
  • 163
0

I was using VirtualBox 4.3.12. Once I upgraded to 5.0 the latest, the bugs were fixed.

No combination of reinstalling Vbox additions helped.

Solution: always try upgrading to the latest https://www.virtualbox.org/wiki/Downloads

0

Login to your guest machine and open the CD drive where "VirtualBox Guest Additions" should be inserted.

Open this CD drive and execute the file "VBoxWindowsAdditions.exe".

After the installation you have to restart, then it should work!

Black
  • 844