在 Ubuntu 20.04.2 中安装 Virtualbox 客户机添加程序时出错:查看 /var/log/vboxadd-setup.log 以找出问题所在

在 Ubuntu 20.04.2 中安装 Virtualbox 客户机添加程序时出错:查看 /var/log/vboxadd-setup.log 以找出问题所在

我在尝试安装 Virtual Box Guest Additions 时遇到问题。我的主机操作系统是 Ubuntu 20.04.2,我的电脑有 Windows 10 操作系统。

我尝试安装 Guest Addition 的步骤如下:

  1. 转到设备菜单。2. 单击插入 Guest Additions CD 映像,然后输入密码,然后单击运行。

这将打开一个终端,开始下载 Virtual Box Guest Additions,我得到的终端输出是:

VirtualBox Guest Additions: Look at /var/log/vboxadd-setup.log to find out what went wrong

因此我检查了 /var/log/vboxadd-setup.log 的内容:

 Building the main Guest Additions 6.1.18 module for kernel 5.8.0-44-generic.
Error building the module.  Build output follows.
make V=1 CONFIG_MODULE_SIG= CONFIG_MODULE_SIG_ALL= -C /lib/modules/5.8.0-44-generic/build M=/tmp/vbox.0 SRCROOT=/tmp/vbox.0 -j2 modules
make[1]: warning: -j2 forced in submake: resetting jobserver mode.
test -e include/generated/autoconf.h -a -e include/config/auto.conf || (    \
echo >&2;                           \
echo >&2 "  ERROR: Kernel configuration is invalid.";       \
echo >&2 "         include/generated/autoconf.h or include/config/auto.conf are missing.";\
echo >&2 "         Run 'make oldconfig && make prepare' on kernel src to fix it.";  \
echo >&2 ;                          \
/bin/false)

  ERROR: Kernel configuration is invalid.
         include/generated/autoconf.h or include/config/auto.conf are missing.
         Run 'make oldconfig && make prepare' on kernel src to fix it.

make[1]: *** [Makefile:746: include/config/auto.conf] Error 1
make: *** [/tmp/vbox.0/Makefile-footer.gmk:117: vboxguest] Error 2

但我似乎不明白我需要做什么才能让它发挥作用。

我将非常感激任何关于此问题的帮助。

答案1

这似乎是 VirtualBox 错误导致的问题。以下是我遇到的情况:

我使用内核为 4.4.0-210 的 Ubuntu 16.04,将 VirtualBox 升级到 6.1.22 后,遇到了上述问题。我使用 @Jamie Brown 的解决方案解决了它。谢谢!

然后我在https://www.virtualbox.org/wiki/Changelog-6.1说:

VirtualBox 6.1.24(2021 年 7 月 20 日发布)

Linux Guest Additions:引入对 Ubuntu 特定内核的支持(错误 #20325

并且错误单页面上显示:在内核 4.4.0.210-generic(Ubuntu 16.04)中安装 6.1.20 版的 Guest Additions 时,模块 vboxsf 编译失败,出现与 #18697 完全相同的错误。

所以这是在 6.1.20 中引入并在 6.1.24 中解决的一个错误,并且只会导致某些特定内核出现错误。

答案2

我遇到了同样的问题 - 今天我的 Vagrant 框突然停止挂载我的共享文件夹,并且每次启动时都无法更新 Virtual Guest Additions:

==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Machine booted and ready!
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims:   5.0.18
VBoxService inside the vm claims: 6.1.18
Going on, assuming VBoxService is correct...
[default] GuestAdditions seems to be installed (6.1.18) correctly, but not running.
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims:   5.0.18
VBoxService inside the vm claims: 6.1.18
Going on, assuming VBoxService is correct...
Job for vboxadd-service.service failed because the control process exited with error code. See "systemctl status vboxadd-service.service" and "journalctl -xe" for details.
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims:   5.0.18
VBoxService inside the vm claims: 6.1.18
Going on, assuming VBoxService is correct...
update-initramfs: Generating /boot/initrd.img-4.4.0-209-generic
W: mdadm: /etc/mdadm/mdadm.conf defines no arrays.
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel 
modules.  This may take a while.
VirtualBox Guest Additions: To build modules for other installed kernels, run
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup <version>
VirtualBox Guest Additions: or
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup all
VirtualBox Guest Additions: Building the modules for kernel 4.4.0-209-generic.

VirtualBox Guest Additions: Look at /var/log/vboxadd-setup.log to find out what 
went wrong
VirtualBox Guest Additions: Running kernel modules will not be replaced until 
the system is restarted
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims:   5.0.18
VBoxService inside the vm claims: 6.1.18
Going on, assuming VBoxService is correct...
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims:   5.0.18
VBoxService inside the vm claims: 6.1.18
Going on, assuming VBoxService is correct...
Restarting VM to apply changes...
==> default: Attempting graceful shutdown of VM...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...

日志没有帮助,它只是说:

vagrant@ubuntu-xenial:~$ cat /var/log/vboxadd-setup.log
Could not find the X.Org or XFree86 Window System, skipping.

经过长时间的折腾和阅读了几年前的几个 StackOverflow 答案(都没有帮助)后,我升级了我的内核:

vagrant@ubuntu-xenial:~$ wget https://raw.githubusercontent.com/pimlie/ubuntu-mainline-kernel.sh/master/ubuntu-mainline-kernel.sh
sudo install ubuntu-mainline-kernel.sh /usr/local/bin/
ubuntu-mainline-kernel.sh -c
sudo ubuntu-mainline-kernel.sh -i v5.11.15

然后使用vagrant halt和重新启动vagrant up,VB Guest Additions 就全部整理好了。

因此,如果您有一个旧盒子,看起来最新的 VirtualBox Guest Additions 不能很好地运行,您需要更新您的内核。

答案3

我在装有 Ubuntu 20.04.2 LTS、内核 5.11.0-27-generic 和 VBox 6.1.16 的客户操作系统上遇到了同样的问题。

作为基瑟指出,这似乎与 Guest Additions 和安装的 Linux 内核版本不匹配有关。

将 VBox 升级到 6.1.26 并重新安装提供的 Guest Additions,然后重新启动后,问题得到解决。

答案4

我在 Ubuntu 20.04 Kernel 5.15.0-46-generic、Vbox 6.1.14 中遇到了同样的问题。

更新了它至 6.1.38,已修复。

相关内容