My virtualbox 6.1.4 vm with Ubuntu 20.04 guest on Windows 10 Pro fails to install:
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
When I look at that log file, it shows this:
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 ;
...
I checked for include/generated/autoconf.h or include/config/auto.conf, both exist from /usr/src/linux-headers-5.8.0-38-generic, so I think this top part of log runs fine.
After the above output there are a few gcc commands that complete and then one that fails, causing guest additions to abort:
...
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
I'm guessing this is a gcc version issue or headers issue but there are no further upgrades available. I just found a comment on Problem installing virtualBox Guest Additions suggesting known issues so I will first try upgrading. I will post answer if this works, stay tuned.