VirtualBox: Copy-n-Paste Host-to-Guest CLI Issue
VirtualBox is a popular open-source virtualization software that allows users to run multiple operating systems on a single machine. One of the most common features used in VirtualBox is the copy-paste functionality between the host and guest machines. However, some users have reported issues with bidirectional drag-n-drop clipboard not working correctly when copying text from the guest OS to the host OS, especially when using the command line interface (CLI). In this article, we will discuss the possible causes and solutions for this issue.
Prerequisites
To follow this article, ensure you have the following:
- VirtualBox version 6.1 or later (latest version recommended)
- Ubuntu server guest OS
- Windows 10 host OS
- Bidirectional drag-n-drop clipboard enabled
Issue Description
The issue occurs when users try to copy text from the Ubuntu guest OS CLI and paste it into the Windows 10 host OS. The text is not pasted, and the clipboard remains empty. However, the reverse operation, copying text from the Windows 10 host OS and pasting it into the Ubuntu guest OS, works correctly.
Possible Causes
The following are possible causes for the copy-n-paste issue:
- VirtualBox Guest Additions: The VirtualBox Guest Additions package is responsible for providing the necessary software components to enable seamless communication between the host and guest machines. If the package is not installed or outdated, the copy-paste functionality may not work correctly.
- Clipboard Format: The clipboard format used by the guest OS and the host OS may not be compatible. VirtualBox uses the X11 clipboard format by default, which may not be supported by all applications.
- Firewall: Firewall settings on the guest OS or the host OS may block the necessary communication between the two machines.
Solutions
The following are the recommended solutions for the copy-n-paste issue:
Install or Update VirtualBox Guest Additions
To install or update VirtualBox Guest Additions:
- On Ubuntu guest OS, open a terminal and run:
- On Windows 10 host OS, open the VirtualBox Manager, select the Ubuntu guest VM, and click on "Settings". Go to the "Devices" tab, and under "Guest Additions", click on the "Install Guest Additions" button.
sudo apt-get update
sudo apt-get install virtualbox-guest-dkms
Change Clipboard Format
To change the clipboard format:
- On Ubuntu guest OS, open a terminal and run:
- On Windows 10 host OS, open the VirtualBox Manager, select the Ubuntu guest VM, and click on "Settings". Go to the "Display" tab, and under "Screen", check the "Enable Guest Isplications" and "Enable EFI" options.
sudo apt-get install virtualbox-ext-pack
sudo usermod -aG vboxusers $USER
sudo reboot
Configure Firewall
To configure the firewall:
- On Ubuntu guest OS, open a terminal and run:
- On Windows 10 host OS, go to "Control Panel" > "System and Security" > "Windows Defender Firewall" > "Advanced settings". Add a new inbound rule for port 22, 25, 80, and 443, and set the protocol to "TCP".
sudo ufw allow 22/tcp
sudo ufw allow 25
sudo ufw allow 80
sudo ufw allow 443
sudo ufw enable
The copy-n-paste issue between VirtualBox host and guest machines can be frustrating, especially when using the command line interface. However, by following the recommended solutions, you can enable seamless communication between the two machines and enjoy the full functionality of the VirtualBox clipboard.