如何让剪贴板在 Windows 上的 VirtualBox 中的 CentOS 中使用?

如何让剪贴板在 Windows 上的 VirtualBox 中的 CentOS 中使用?

我在 Windows 8.1 上的 Oracle VirtualBox 5.1.16 中运行 CentOS 7.3.1611 和 XFCE。其他问题与旧版本有关,或者客户机/主机已切换。我设置了设备 > 共享剪贴板 > 双向,但我在 Windows 中复制的任何内容都无法在 CentOS 中粘贴,我在 CentOS 中复制的任何内容都无法在 Windows 中粘贴。

我使用 Vagrant 来创建这个盒子。vagrant init centos/7; vagrant up

==> default: Checking for guest additions in VM...
    default: No guest additions were detected on the base box for this VM! Guest
    default: additions are required for forwarded ports, shared folders, host only
    default: networking, and more. If SSH fails on this machine, please install
    default: the guest additions and repackage the box to continue.
    default:
    default: This is not an error message; everything may continue to work properly,

我还手动添加了光驱并VBoxGuestAdditions.iso从 VirtualBox 文件夹加载、重新启动、手动挂载 CDROM 并手动运行脚本,但是:

[vagrant@localhost ~]$ sudo mount /dev/sr0/ /mnt
mount: /dev/sr0 is write-protected, mounting read-only
[vagrant@localhost ~]$ cd /mnt
[vagrant@localhost mnt]$ sudo ./autorun.sh
Linux guest additions installer not found -- try to start them manually.
[vagrant@localhost mnt]$ ls
32Bit  AUTORUN.INF  cert  runasroot.sh            VBoxSolarisAdditions.pkg        VBoxWindowsAdditions.exe
64Bit  autorun.sh   OS2   VBoxLinuxAdditions.run  VBoxWindowsAdditions-amd64.exe  VBoxWindowsAdditions-x86.exe

所以现在我不知道如何让剪贴板工作。


这是运行的日志VBoxLinuxAdditions.run

[vagrant@localhost mnt]$ sudo ./VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.1.16 Guest Additions for Linux...........
VirtualBox Guest Additions installer
Removing installed version 5.1.16 of VirtualBox Guest Additions...
Copying additional installer modules ...
Installing additional modules ...
vboxadd.sh: Building Guest Additions kernel modules.
Failed to set up service vboxadd, please check the log file
/var/log/VBoxGuestAdditions.log for details.
[vagrant@localhost mnt]$ cat /var/log/VBoxGuestAdditions.log

vboxadd.sh: failed: Look at /var/log/vboxadd-install.log to find out what went wrong.
vboxadd.sh: failed: Please check that you have gcc, make, the header files for your Linux kernel and possibly perl installed..
[vagrant@localhost mnt]$ cat /var/log/vboxadd-install.log
/tmp/vbox.0/Makefile.include.header:97: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again.  Stop.
Creating user for the Guest Additions.
Creating udev rule for the Guest Additions kernel module.
[vagrant@localhost mnt]$ gcc
gcc: fatal error: no input files
compilation terminated.
[vagrant@localhost mnt]$

答案1

我认为,如果不安装附加组件,您将无法使用剪贴板共享功能。您可以手动运行 VBoxLinuxAdditions.run 文件,看看它是否会安装或给出正确的错误吗?

相关内容