VirtualBox 客户机添加程序崩溃,无法在 Ubuntu 20.04 客户机上完全安装

VirtualBox 客户机添加程序崩溃,无法在 Ubuntu 20.04 客户机上完全安装

我的 Windows 10 Pro 上的带有 Ubuntu 20.04 客户机的 virtualbox 6.1.4 vm 安装失败:

Verifying archive integrity... All good.
Uncompressing VirtualBox 6.1.4 Guest Additions for Linux........
VirtualBox Guest Additions installer
Removing installed version 6.1.4 of VirtualBox Guest Additions...
Copying additional installer modules ...
Installing additional modules ...
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 5.8.0-38-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

当我查看该日志文件时,它显示以下内容:

Building the main Guest Additions 6.1.4 module for kernel 5.8.0-38-generic.
Error building the module.  Build output follows.
make V=1 CONFIG_MODULE_SIG= CONFIG_MODULE_SIG_ALL= -C /lib/modules/5.8.0-38-gene
ric/build M=/tmp/vbox.0 SRCROOT=/tmp/vbox.0 -j4 modules
make[1]: warning: -j4 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 ;
...

我检查了 include/generated/autoconf.h 或 include/config/auto.conf,它们都存在于 /usr/src/linux-headers-5.8.0-38-generic 中,所以我认为日志的顶部部分运行良好。

在上述输出之后,有几个 gcc 命令完成,然后有一个失败,导致客户添加中止:

...
gcc -Wp,-MMD,/tmp/vbox.0/.combined-agnostic.o.d  ... -c
 -o /tmp/vbox.0/combined-agnostic.o /tmp/vbox.0/combined-agnostic.c
In file included from /tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c:44,
                 from /tmp/vbox.0/combined-agnostic.c:34:
/tmp/vbox.0/include/iprt/time.h: In function ‘RTTimeSpecGetTimeval’:
/tmp/vbox.0/include/iprt/time.h:379:13: error: dereferencing pointer to incomple
te type ‘struct timeval’
  379 |     pTimeval->tv_sec = (time_t)i64;
      |             ^~
/tmp/vbox.0/include/iprt/time.h:379:25: error: ‘time_t’ undeclared (first use in
 this function); did you mean ‘ktime_t’?
  379 |     pTimeval->tv_sec = (time_t)i64;
      |                         ^~~~~~
      |                         ktime_t
/tmp/vbox.0/include/iprt/time.h:379:25: note: each undeclared identifier is repo
rted only once for each function it appears in
/tmp/vbox.0/include/iprt/time.h:379:32: error: expected ‘;’ before ‘i64’
  379 |     pTimeval->tv_sec = (time_t)i64;
      |                                ^~~
      |                                ;
/tmp/vbox.0/include/iprt/time.h: In function ‘RTTimeSpecSetTimeval’:
/tmp/vbox.0/include/iprt/time.h:393:67: error: dereferencing pointer to incomple
te type ‘const struct timeval’
  393 |     return RTTimeSpecAddMicro(RTTimeSpecSetSeconds(pTime, pTimeval->tv_s
ec), pTimeval->tv_usec);
      |                                                                   ^~
make[2]: *** [scripts/Makefile.build:290: /tmp/vbox.0/combined-agnostic.o] Error
 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile:1780: /tmp/vbox.0] Error 2
make: *** [/tmp/vbox.0/Makefile-footer.gmk:114: vboxguest] Error 2

我猜这是 gcc 版本问题或标头问题,但没有进一步的升级可用。我刚刚在安装 virtualBox Guest Additions 时出现问题建议已知问题,所以我将首先尝试升级。如果可行,我将发布答案,敬请期待。

答案1

现在它起作用了,这是我所做的:

  • 在运行于 virtualbox 6.1.4 的客户虚拟机中,运行sudo apt upgrade显示 gcc 和 linux 头文件等的升级

  • 重新运行客户机添加安装程序,同样的崩溃问题;我尝试重新启动客户机并重新安装几次以确保万无一失;登录后,我还会收到客户机添加程序崩溃的消息

  • 将 virtualbox 升级到 6.1.18

  • 重新运行客户机添加安装,成功了,但剪贴板共享仍然不起作用。输出:

      Verifying archive integrity... All good.
      Uncompressing VirtualBox 6.1.18 Guest Additions for Linux........
      VirtualBox Guest Additions installer
      Removing installed version 6.1.18 of VirtualBox Guest Additions...
      update-initramfs: Generating /boot/initrd.img-5.8.0-40-generic
      Copying additional installer modules ...
      Installing additional modules ...
      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 5.8.0-40-generic.
      update-initramfs: Generating /boot/initrd.img-5.8.0-40-generic
      VirtualBox Guest Additions: Running kernel modules will not be replaced until 
      the system is restarted
      Press Return to close this window...
    
  • 重新启动虚拟机:登录时不再崩溃,并且与主机共享剪贴板正常

这很奇怪,因为我有其他几个装有 Ubuntu 18 和 6.1.4 客户机添加功能的虚拟机,一切都很好。

相关内容