3

I'm working in Ubuntu as Virtual-Box guest on top of Windows machine (as host)

I have generated a long key which I want to paste to gitlab - yet for some reason I cannot copy and paste it from the terminal.

  • I have gone into the settings and set the shared clipboard to bidirectional and rebooted the machine.
  • I have tried selecting text and right click, copy.
  • I have tried Ctrl + Shift + C.
  • It's definitely not my PC settings as I can copy and paste from elsewhere fine.

How can I solve it?

Yaron
  • 13,453
Louise
  • 151

2 Answers2

3

In order to allow copy/paste in your Ubuntu VirtualBox-Guest-Machine, you'll need to install VirtualBox Guest Additions

  • how to install guest additions in VirtualBox VM

  • Detailed explanation taken from how-to-enable-copy-and-paste-in-virtualbox

    1. Start VirtualBox.
    2. Start the host in question.
    3. Once the host has booted, click Devices | Insert Guest Additions CD Image.
    4. Open up a terminal window in the guest.
    5. Mount the CD-ROM with the command sudo mount /dev/cdrom /mnt.
    6. Change into the mounted directory with the command cd /mnt.
    7. Install the necessary dependencies with the command sudo apt-get install -y dkms build-essential linux-headers-generic linux-headers-$(uname -r).
    8. Change to the root user with the command sudo su.
    9. Install the Guest Additions package with the command ./VBoxLinuxAdditions.run.
    10. Allow the installation to complete.

One the installation is finished, reboot the guest operating system.

Enable copy and paste

At this point, copy and paste (from either guest to host or host to guest) can be enabled. Start the VM, and once it's booted, click Devices | Shared Clipboard | Bidirectional

enter image description here

You can now copy and paste from guest to host and host to guest. No more having to retype lines of code or URLs and no more wondering why the feature wasn't working.

Yaron
  • 13,453
2

For any other beginners in using VirtualBox I think this answer might be helpful as I had only discovered after asking my question.

Copying and pasting from the terminal open in VirtualBox to a browser in Windows (for example) proves complicated, but using the Firefox within VirtualBox it is straightforward to copy and paste between the two as you are going within the same system. I'm kicking myself for not copping on to this sooner

Louise
  • 151