根据以下文档下载以下 iso VBoxGuestAdditions_5.1.0.isohttps://www.vagrantup.com/docs/virtualbox/boxes.html
然后运行以下命令
sudo mkdir /media/VBoxGuestAdditions
sudo mount -o loop,ro VBoxGuestAdditions_5.1.0.iso /media/VBoxGuestAdditions
sudo sh /media/VBoxGuestAdditions/VBoxLinuxAdditions.run
我收到错误:
无法设置服务 vboxadd,请检查日志文件 /var/log/VBoxGuestAdditions.log 了解详细信息。
当我查看此日志时,它引用了另一个日志文件/var/log/vboxadd-install.log
。当我查看此日志时,我看到以下内容:
make KBUILD_VERBOSE=1 CONFIG_MODULE_SIG= -C /lib/modules/3.13.0-93-generic/build SUBDIRS=/tmp/vbox.0 SRCROOT=/tmp/vbox.0 -j2 modules
make[1]: Makefile: No such file or directory
make[1]: warning: -jN forced in submake: disabling jobserver mode.
make[1]: *** No rule to make target `Makefile'. Stop.
make: *** [vboxguest] Error 2
Creating user for the Guest Additions.
Creating udev rule for the Guest Additions kernel module.
我安装了以下软件包。我甚至删除了它们并再次添加它们:
linux-headers-$(uname -r) linux-generic linux-image-generic linux-headers-generic linux-signed-generic dkms build-essential
我不确定如何进一步调试。如能提供任何帮助,我将不胜感激。
此外,我随后尝试使用 Virtual Box 附带的 Guest Addition CD。插入 CD 并接受安装后,出现以下情况插入 Guest Additions CD 后,出现以下错误:
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.1.4 Guest Additions for Linux...........
VirtualBox Guest Additions installer
Removing installed version 4.3.20 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.
Press Return to close this window...
然后我继续查看文件 /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..
然后我继续打开 /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.
这会使系统处于不良状态,除了重新开始使用图像外没有其他方法恢复。
答案1
似乎您没有满足某些先决条件,例如:
apt-get install build-essential module-assistant linux-headers-$(uname -r)
它对我有用。
答案2
Guest Additions 是 VirtualBox 安装的一部分。在 Virtualbox 界面中,单击:
Device -> Insert Guest Additions -> CD Image.
现在从您的客户操作系统,在客户机的 CD 中运行客户安装。
答案3
我遇到了这个问题。为了解决这个问题,我将文件 VBoxLinuxAdditions.run 复制到 /root/ 文件夹,并将文件权限更改为 755。此外,我还安装了先决条件“build-essential module-assistant linux-headers-$(uname -r)”。之后安装成功。
答案4
我通过使用固定大小磁盘而不是动态大小磁盘安装虚拟机来解决了这个问题。