166

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.

1
  • 4
    Have you tried just re-installing the Guest Additions in the Virtual Machine? If not, check the answer from Pisu below. You didn't mention how you originally installed VirtualBox (external package from VirtualBox's website, or the virtualbox-ose package from the Ubuntu repositories) Also, what version you are on (both Ubuntu and VirtualBox). This info may help us help you. Sep 30, 2011 at 1:58

18 Answers 18

165

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

$ killall VBoxClient
$ VBoxClient-all
15
  • 2
    VBoxClient wasn't running on my Ubuntu. VBoxClient-all started the tools correctly and fixed host-to-guest pasting (but not the other way). Notice VBoxClient-all is the binary name and not a flag!
    – Air
    May 22, 2014 at 15:18
  • 2
    Worked for me on Ubuntu 14.04 running on a Windows7 host. Thanks!
    – Paul
    Sep 10, 2015 at 6:56
  • 16
    Couldn't find a VBoxClient-all binary on my system. Just kill-ing and restarting VBoxClient --clipboard seems to have worked for me. Mar 13, 2017 at 16:56
  • 3
    @decimusphostle In my Ubuntu 16.04 it is located in /usr/bin/VBoxClient-all . Actually it is not a binary but a script which executes the following commands: /usr/bin/VBoxClient --clipboard /usr/bin/VBoxClient --checkhostversion /usr/bin/VBoxClient --display /usr/bin/VBoxClient --seamless /usr/bin/VBoxClient --draganddrop
    – Dmitry
    Mar 13, 2017 at 17:28
  • 4
    Worked on Ubuntu 16.04
    – qwertzguy
    Oct 19, 2017 at 16:53
43

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".

8
  • Unbelievable, it works great though :) Also on my Windows 2008R2 x64 virtual OS. Thanks for sharing! Apr 6, 2012 at 14:00
  • Thank you! Works for Windows 7 x64, VirtualBox 4.3.16.0. Oct 6, 2014 at 20:59
  • It didn't work for me, my host is Win7 and VirtualBox is running Win7. It seems like it is supported only with linux?
    – zadane
    Oct 5, 2016 at 14:40
  • This didn't work for host/guest win10
    – andy
    Jan 9, 2017 at 11:30
  • Still on W81, works.
    – Harald
    Aug 2, 2017 at 14:22
33

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

5
  • Thanks. I was having a problem pasting from guest to host (but not from host to guest) and this solved it for me. Jun 15, 2015 at 14:52
  • Should we run this command from guest or host?
    – Black
    Jun 1, 2017 at 11:48
  • @Black Guest OS.
    – DBedrenko
    Jun 1, 2017 at 16:30
  • 2
    This does fix the problem when manually run, but the issue comes up every time I restart the machine. I've tried running the command when the machine starts automatically, but doesn't work (I'm assuming the vbox service hasn't initialized yet when the command is run.) -- Anyone else know of an easier solution than manually pasting this in each time I want to copy/paste to my host? Aug 14, 2017 at 18:17
  • @ZacharySchuessler If it takes a bit for the service to startup then add sleep 3m && the_pkill_command. There are lots of options. You can edit the service to run the pkill after it starts.
    – DBedrenko
    Jan 22, 2021 at 18:18
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.

8
  • Thanks, that helped. I would have had to search for a long time to find that one.
    – WitchCraft
    Apr 23, 2014 at 20:11
  • 7
    @amjad, Nope, it's already selected. Still not working, you need to restart the vboxtray as the other answers suggested.
    – Pacerier
    Sep 2, 2015 at 4:59
  • 3
    Drag'n'Drop? Are you sure? Shared Clipboard should be option for guest-host copy/paste, but the trick is that it stopped working for some reason.
    – Traxo
    Aug 8, 2018 at 17:15
  • 1
    If it was not enabled, then restarting wouldn't fix the issue for the original question. But this might help some people for whom it NEVER works. Aug 15, 2018 at 17:10
  • For VirtualBox 6.1, in VirtualBox Manager, it is Machine => Settings => General => Advanced => Shared Clipboard => Bidirectional (was: Disabled).
    – Atafar
    Sep 11, 2020 at 14:11
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

5
  • Thanks. I don't need need to install that "Guest Additions CD". This solves my problem. May 10, 2017 at 7:59
  • 3
    I had to reboot, then it worked. Jul 9, 2017 at 9:13
  • It seems this requirement depends on the guest you install, but after installing Guest Additions on a new VM, and restarting it, my clipboard settings where then respected.
    – BuvinJ
    Aug 17, 2017 at 13:47
  • Worked for me on Ubuntu 18.04.1 LTS.
    – Jake Reece
    Dec 27, 2018 at 19:50
  • Worked for me after reboot. Thank you a lot!
    – QtRoS
    Dec 15, 2019 at 17:08
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
4
  • 8
    I tried it but I get VBoxClient-all: command not found
    – Black
    Jun 1, 2017 at 11:49
  • 2
    I tried VBoxClient --clipboard worked for me
    – Dee
    Nov 15, 2017 at 1:17
  • +1 I had to do this on Lubuntu
    – addison
    Jan 23, 2019 at 19:48
  • Should use sudo VBoxClient-all Sep 2, 2021 at 15:56
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.

1
  • This answer worked for me. Do the command line install, restart Linux box, then try that VBoxClient --clipboard. Then try copy and pasting between guest + host and it worked.
    – AndyUK
    Jul 29, 2022 at 11:52
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.

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.

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.

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!

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

2
  • Is this still the case, or has there been an update? This seems to be my problem as well.
    – skjerns
    Apr 5, 2023 at 11:48
  • @skjerns I think it'll probably stay like that, because if they could have made it work by default, it would already function, but I can't tell for sure. What I did is if I plan to do copy/paste and interactively work on the machine, I start it in normal mode, and when I want it to run in background, with no expectation to interactively work on it, I start it in detached mode. I guess perhaps this is what detachable was designed to be used as, non-interactively. But I have no official source, just trying to guess.
    – Wadih M.
    Apr 18, 2023 at 15:20
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

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.

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!

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .