16

I am trying to copy&paste from my local Windows machine into my CentOS guest machine, running on VirtualBox. The CentOS installation is minimal (only the console).

I followed this guide, and enabled both shared clipboard and drag and drop, and rebooted. Now, when I get to the end of the article, it says

That’s it!  When you log back into the guest machine, you should be able to copy text from the host machine to the guest easily. The Drag’n’Drop option lets you select a whole data file from the host to the guest or vice versa.

I am not able to copy&paste. I tried right clicking on my guest OS, expected a copy/paste dialog to open up. No dice. I can't even see a mouse arrow on my guest OS.

I tried Ctrl+V and Ctrl+Shift+V....but they didn’t work.

Ctrl+Shift+V caused a ^V to appear on the command line, but nothing got pasted.

I was able to paste into Notepad on my Windows host machine, so I know my copy buffer (clipboard) is at least getting filled with what I want to copy on the host side of things.

The article just treats it as self-evident that there are no further instructions to be given. Did anyone run into this dilemma? What combination of keystrokes / mouse clicks do I need to copy/paste into my guest OS?

EDIT I managed to track down this forum which was talking about Guest Additions/Centos and a .iso that I would need to replace another with. I downloaded the .iso, so.... now what?

I tried going into

> devices
    >> Insert Guest additions CD image

Which looked promising. But then I got hit with this error.

Unable to insert the virtual optical disk D:\virtualbox\VBoxGuestAdditions.iso into the machine Centos 7.

Would you like to try to force insetion of this disk?

Could not mount the media/drive 'D:\virtualbox/VBoxGuestAdditions.iso'
(VERR_PDM_MEDIA_LOCKED).

Clicking force unmount appears to do nothing.

22
  • 1
    @Scott AFAIK, bash has no clipboard i.e. you can't copy/paste from/to a console-only system. – NZD Aug 22 '16 at 5:35
  • 1
    @NZD: You may have just identified Zack's actual problem. – Scott Aug 22 '16 at 5:46
  • 1
    I do indeed have only the console. So... go get something with a GUI and report back? The plot thickens... – Zack Aug 22 '16 at 17:40
  • 1
    @Zack: If your objective is to copy&paste small bits of text, like commands and command outputs, then you probably need to have a GUI. To repeat what I’ve been saying another way: if you currently can’t copy&paste within your guest (i.e., from one CentOS program to another), then guest additions won’t help you with that. If you want to move larger chunks of data between your host and guest, and you have network connectivity, then you should be able to do things like FTP, rsync, scp, or set up shared directories. … (Cont’d) – Scott Aug 22 '16 at 19:16
  • 4
    Possible duplicate of Virtualbox clipboard sharing – Ivan Yurchenko Jul 24 '17 at 11:58
11

For that to work, you have to install the Guest Additions. That will give you a shared clipboard.

After starting your VM, you can install the Guest Additions from the menu. Click on Devices and then select Insert Guest additions CD image.

Another way is, when your VM is off, you can attach an ISO image to it from the VirtualBox GUI. It is under the Storage tab.

When you install VirtualBox, it should contain the Guest Additions ISO image as well. If you can't find it, you can download it from here. Make sure it matches the exact version of Virtualbox.

The reason you need to install the Guest Additions to get copy and paste working is that your VM is a separate machine running in its own environment that is unaware of the host machine. You have to install drivers on the guest machine so it can communicate with the Virtualbox instance running on the host.

You can use your mouse without Guest Additions, but then it is either captured by the guest or owned by the host. You transfer control to the Guest by clicking in the Guest window. You have to "release" the mouse from the guest using a key combination (Right-Alt by default) to use it on the host again. See imgur.com/a/Ci5HM

If you have the Guest Additions installed, you mouse moves seamlessly between guest and host.

Note that if you don't have a GUI on your VM, but only a console, then you won't get a mouse pointer. A console system has no mouse. The Bash shell has no clipboard i.e. you can't copy/paste from/to a console-only system.

The easiest way to get around that is to use ssh to your VM from your host. You can then use copy and paste in the ssh terminal.

9
  • I'll give this a try when I get home tonight. Off to work – Zack Aug 18 '16 at 12:31
  • 7
    Jeez this looks crazy complicated just to get copy/paste working. – Zack Aug 19 '16 at 3:30
  • For example "Insert the VBoxGuestAdditions.iso CD file into your Linux guest's virtual CD-ROM drive" Where do I get this .iso, what is the Linux guest's virtual CD ROM drive, and how do I insert the .iso? – Zack Aug 19 '16 at 3:34
  • This article assumes a lot of pre-existing knowledge. – Zack Aug 19 '16 at 3:35
  • 5
    The last line is the MVP here -- if you are doing console work on your VM, the easiest solution is just SSH into it, and have copy-paste working without issue. – Yablargo Mar 29 '18 at 17:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.