无法在 Ubuntu 18.04 上安装 VBoxGuestAddition 5.1.2

无法在 Ubuntu 18.04 上安装 VBoxGuestAddition 5.1.2

我正在尝试在我的 Ubuntu 18.04 上安装 VBoxGuestAddition 5.1.2,并通过运行以下命令安装了所需的所有软件包

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install build-essential dkms module-assistant linux-headers-$(uname -r)
sudo m-a prepare

然后我选择了 设备 -> 插入 Guest Additions CD 映像并运行 Vboxguestaddition 安装。但是,我收到了此错误

Verifying archive integrity... All good.
Uncompressing VirtualBox 5.1.2 Guest Additions for Linux...........
VirtualBox Guest Additions installer
Removing installed version 5.1.2 of VirtualBox Guest Additions...
update-initramfs: Generating /boot/initrd.img-5.3.0-28-generic
update-initramfs: Generating /boot/initrd.img-5.3.0-40-generic
update-initramfs: Generating /boot/initrd.img-5.3.0-42-generic
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文件时,我发现/lib/modules/5.3.0-42-generic/build/include/linux/version.h缺少了它,并且内核配置无效

grep: /lib/modules/5.3.0-42-generic/build/include/linux/version.h: No such file 
or directory
make KBUILD_VERBOSE=1 CONFIG_MODULE_SIG= -C /lib/modules/5.3.0-42-generic/build 
SUBDIRS=/tmp/vbox.0 SRCROOT=/tmp/vbox.0 -j1 modules
Makefile:227: ================= WARNING ================
Makefile:228: 'SUBDIRS' will be removed after Linux 5.3
Makefile:229: 
Makefile:230: If you are building an individual subdirectory
Makefile:231: in the kernel tree, you can do like this:
Makefile:232: $ make path/to/dir/you/want/to/build/
Makefile:233: (Do not forget the trailing slash)
Makefile:234: 
Makefile:235: If you are building an external module,
Makefile:236: Please use 'M=' or 'KBUILD_EXTMOD' instead
Makefile:237: ==========================================
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.";      \
...
...
cc1: some warnings being treated as errors
scripts/Makefile.build:288: recipe for target '/tmp/vbox.0/VBoxGuest-linux.o' failed
make[2]: *** [/tmp/vbox.0/VBoxGuest-linux.o] Error 1
Makefile:1655: recipe for target '_module_/tmp/vbox.0' failed
make[1]: *** [_module_/tmp/vbox.0] Error 2
/tmp/vbox.0/Makefile.include.footer:84: recipe for target 'vboxguest' failed
make: *** [vboxguest] Error 2
Creating user for the Guest Additions.
Creating udev rule for the Guest Additions kernel module.

我不确定如何修复此问题。我已经安装了内核 (5.3.0-42-generic) + 标头、gcc,但我不知道为什么标/linux/version.h头缺失或内核配置无效。任何帮助都将不胜感激。

答案1

似乎 VBoxGuestAdditions 5.1.2 与 Ubuntu 18.04 不兼容。我尝试将我的虚拟盒管理器安装到最新版本并下载最新的 VBoxGuestAdditions (16.0.4),现在它可以正常工作了。

相关内容