10

What I did:

  1. install a minimal debian-testing
  2. install build-essential, dkms, linux-headers-$(uname -r)
  3. install virtualbox, click Devices -> Insert guest additions CD
  4. run m-a prepare
  5. mount /dev/sr0 somewhere, cd there and ./VBoxLinuxAdditions.run

What I got:

...
Building the modules for kernel 5.4.0-4-amd64.
Look at /var/log/vboxadd-setup.log to find out what went wrong.
modprobe vboxsf failed
...

What is in the log:

...
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)
    ...

What I investigated:

    $modprobe vboxsf
    modprobe: FATAL: Module vboxsf not found in directory /lib/modules/5.4.0-4-amd
    $lsmod | grep vboxsf
    <no output>
    $find /usr/src/linux-headers-5.4.0-4-amd64/ -name autoconf.h
    /usr/src/linux-headers-5.4.0-4-amd64/include/generated/autoconf.h

The host OS is Ubuntu 18.

EDIT: on openbox the log looks like:

# less /var/log/vboxadd-setup.log
Building the main Guest Additions module for kernel 5.4.0-4-amd64.
Error building the module.  Build output follows.
make V=1 CONFIG_MODULE_SIG= -C /lib/modules/5.4.0-4-amd64/build M=/tmp/vbox.0 SRCROOT=/tmp/vbox.0 -j1 modules
make -C /usr/src/linux-headers-5.4.0-4-amd64 -f /usr/src/linux-headers-5.4.0-4-common/Makefile modules
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)
make -f /usr/src/linux-headers-5.4.0-4-common/scripts/Makefile.build obj=/tmp/vbox.0 single-build= need-builtin=1 need-modorder=1
   gcc-9 -Wp,-MD,/tmp/vbox.0/.VBoxGuest-linux.o.d  -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/src/linux-headers-5.4.0-4-common/arch/x86/include -I./arch/x86/include/generated -I/usr/src/linux-headers-5.4.0-4-common/include -I./include -I/usr/src/linux-headers-5.4.0-4-common/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/usr/src/linux-headers-5.4.0-4-common/include/uapi -I./include/generated/uapi -include /usr/src/linux-headers-5.4.0-4-common/include/linux/kconfig.h -include /usr/src/linux-headers-5.4.0-4-common/include/linux/compiler_types.h -D__KERNEL__ -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -DCONFIG_X86_X32_ABI -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_AVX512=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector-strong -Wno-unused-but-set-variable -Wimplicit-fallthrough -Wno-unused-const-variable -fno-var-tracking-assignments -g -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -flive-patching=inline-clone -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation -fno-strict-overflow -fno-merge-all-constants -fmerge-constants -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -fmacro-prefix-map=/usr/src/linux-headers-5.4.0-4-common/= -fcf-protection=none -Wno-packed-not-aligned -Wno-declaration-after-statement -include /tmp/vbox.0/include/VBox/VBoxGuestMangling.h -fno-pie -I/usr/src/linux-headers-5.4.0-4-common/include -I/tmp/vbox.0/ -I/tmp/vbox.0/include -I/tmp/vbox.0/r0drv/linux -I/tmp/vbox.0/vboxguest/ -I/tmp/vbox.0/vboxguest/include -I/tmp/vbox.0/vboxguest/r0drv/linux -D__KERNEL__ -DMODULE -DVBOX -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_GUEST -DIN_GUEST_R0 -DIN_MODULE -DRT_WITH_VBOX -DVBGL_VBOXGUEST -DVBOX_WITH_HGCM -DRT_ARCH_AMD64 -DVBOX_WITH_64_BITS_GUESTS  -DMODULE  -DKBUILD_BASENAME='"VBoxGuest_linux"' -DKBUILD_MODNAME='"vboxguest"' -c -o /tmp/vbox.0/VBoxGuest-linux.o /tmp/vbox.0/VBoxGuest-linux.c
   ./tools/objtool/objtool orc generate  --module --no-fp --retpoline --uaccess /tmp/vbox.0/VBoxGuest-linux.o
  if objdump -h /tmp/vbox.0/VBoxGuest-linux.o | grep -q __ksymtab; then  gcc-9 -E -D__GENKSYMS__ -Wp,-MD,/tmp/vbox.0/.VBoxGuest-linux.o.d  -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/src/linux-headers-5.4.0-4-common/arch/x86/include -I./arch/x86/include/generated -I/usr/src/linux-headers-5.4.0-4-common/include -I./include -I/usr/src/linux-headers-5.4.0-4-common/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/usr/src/linux-headers-5.4.0-4-common/include/uapi -I./include/generated/uapi -include /usr/src/linux-headers-5.4.0-4-common/include/linux/kconfig.h -include /usr/src/linux-headers-5.4.0-4-common/include/linux/compiler_types.h -D__KERNEL__ -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -DCONFIG_X86_X32_ABI -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_AVX512=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector-strong -Wno-unused-but-set-variable -Wimplicit-fallthrough -Wno-unused-const-variable -fno-var-tracking-assignments -g -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -flive-patching=inline-clone -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation -fno-strict-overflow -fno-merge-all-constants -fmerge-constants -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -fmacro-prefix-map=/usr/src/linux-headers-5.4.0-4-common/= -fcf-protection=none -Wno-packed-not-aligned -Wno-declaration-after-statement -include /tmp/vbox.0/include/VBox/VBoxGuestMangling.h -fno-pie -I/usr/src/linux-headers-5.4.0-4-common/include -I/tmp/vbox.0/ -I/tmp/vbox.0/include -I/tmp/vbox.0/r0drv/linux -I/tmp/vbox.0/vboxguest/ -I/tmp/vbox.0/vboxguest/include -I/tmp/vbox.0/vboxguest/r0drv/linux -D__KERNEL__ -DMODULE -DVBOX -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_GUEST -DIN_GUEST_R0 -DIN_MODULE -DRT_WITH_VBOX -DVBGL_VBOXGUEST -DVBOX_WITH_HGCM -DRT_ARCH_AMD64 -DVBOX_WITH_64_BITS_GUESTS  -DMODULE  -DKBUILD_BASENAME='"VBoxGuest_linux"' -DKBUILD_MODNAME='"vboxguest"' /tmp/vbox.0/VBoxGuest-linux.c | scripts/genksyms/genksyms    -r /dev/null > /tmp/vbox.0/.tmp_VBoxGuest-linux.ver; ld -m elf_x86_64  -z max-page-size=0x200000 -r -o /tmp/vbox.0/.tmp_VBoxGuest-linux.o /tmp/vbox.0/VBoxGuest-linux.o -T /tmp/vbox.0/.tmp_VBoxGuest-linux.ver; mv -f /tmp/vbox.0/.tmp_VBoxGuest-linux.o /tmp/vbox.0/VBoxGuest-linux.o; rm -f /tmp/vbox.0/.tmp_VBoxGuest-linux.ver; fi
   gcc-9 -Wp,-MD,/tmp/vbox.0/.VBoxGuest.o.d  -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/src/linux-headers-5.4.0-4-common/arch/x86/include -I./arch/x86/include/generated -I/usr/src/linux-headers-5.4.0-4-common/include -I./include -I/usr/src/linux-headers-5.4.0-4-common/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/usr/src/linux-headers-5.4.0-4-common/include/uapi -I./include/generated/uapi -include /usr/src/linux-headers-5.4.0-4-common/include/linux/kconfig.h -include /usr/src/linux-headers-5.4.0-4-common/include/linux/compiler_types.h -D__KERNEL__ -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -DCONFIG_X86_X32_ABI -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_AVX512=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector-strong -Wno-unused-but-set-variable -Wimplicit-fallthrough -Wno-unused-const-variable -fno-var-tracking-assignments -g -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -flive-patching=inline-clone -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation -fno-strict-overflow -fno-merge-all-constants -fmerge-constants -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -fmacro-prefix-map=/usr/src/linux-headers-5.4.0-4-common/= -fcf-protection=none -Wno-packed-not-aligned -Wno-declaration-after-statement -include /tmp/vbox.0/include/VBox/VBoxGuestMangling.h -fno-pie -I/usr/src/linux-headers-5.4.0-4-common/include -I/tmp/vbox.0/ -I/tmp/vbox.0/include -I/tmp/vbox.0/r0drv/linux -I/tmp/vbox.0/vboxguest/ -I/tmp/vbox.0/vboxguest/include -I/tmp/vbox.0/vboxguest/r0drv/linux -D__KERNEL__ -DMODULE -DVBOX -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_GUEST -DIN_GUEST_R0 -DIN_MODULE -DRT_WITH_VBOX -DVBGL_VBOXGUEST -DVBOX_WITH_HGCM -DRT_ARCH_AMD64 -DVBOX_WITH_64_BITS_GUESTS  -DMODULE  -DKBUILD_BASENAME='"VBoxGuest"' -DKBUILD_MODNAME='"vboxguest"' -c -o /tmp/vbox.0/VBoxGuest.o /tmp/vbox.0/VBoxGuest.c
/tmp/vbox.0/VBoxGuest.c: In function ‘vgdrvCheckIfVmmReqIsAllowed’:
/tmp/vbox.0/VBoxGuest.c:2060:16: warning: this statement may fall through [-Wimplicit-fallthrough=]
 2060 |             if (pSession->fUserSession)
      |                ^
/tmp/vbox.0/VBoxGuest.c:2062:9: note: here
 2062 |         case kLevel_AllUsers:
      |         ^~~~
   ./tools/objtool/objtool orc generate  --module --no-fp --retpoline --uaccess /tmp/vbox.0/VBoxGuest.o
  if objdump -h /tmp/vbox.0/VBoxGuest.o | grep -q __ksymtab; then  gcc-9 <compile flags deleted to fit in 30 000 characters>fi
   gcc-9 -Wp,-MD,/tmp/vbox.0/.VBoxGuestR0LibGenericRequest.o.d  -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/src/linux-headers-5.4.0-4-common/arch/x86/include -I./arch/x86/include/generated -I/usr/src/linux-headers-5.4.0-4-common/include -I./include -I/usr/src/linux-headers-5.4.0-4-common/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/usr/src/linux-headers-5.4.0-4-common/include/uapi -I./include/generated/uapi -include /usr/src/linux-headers-5.4.0-4-common/include/linux/kconfig.h -include /usr/src/linux-headers-5.4.0-4-common/include/linux/compiler_types.h -D__KERNEL__ -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -DCONFIG_X86_X32_ABI -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_AVX512=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector-strong -Wno-unused-but-set-variable -Wimplicit-fallthrough -Wno-unused-const-variable -fno-var-tracking-assignments -g -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -flive-patching=inline-clone -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation -fno-strict-overflow -fno-merge-all-constants -fmerge-constants -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -fmacro-prefix-map=/usr/src/linux-headers-5.4.0-4-common/= -fcf-protection=none -Wno-packed-not-aligned -Wno-declaration-after-statement -include /tmp/vbox.0/include/VBox/VBoxGuestMangling.h -fno-pie -I/usr/src/linux-headers-5.4.0-4-common/include -I/tmp/vbox.0/ -I/tmp/vbox.0/include -I/tmp/vbox.0/r0drv/linux -I/tmp/vbox.0/vboxguest/ -I/tmp/vbox.0/vboxguest/include -I/tmp/vbox.0/vboxguest/r0drv/linux -D__KERNEL__ -DMODULE -DVBOX -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_GUEST -DIN_GUEST_R0 -DIN_MODULE -DRT_WITH_VBOX -DVBGL_VBOXGUEST -DVBOX_WITH_HGCM -DRT_ARCH_AMD64 -DVBOX_WITH_64_BITS_GUESTS  -DMODULE  -DKBUILD_BASENAME='"VBoxGuestR0LibGenericRequest"' -DKBUILD_MODNAME='"vboxguest"' -c -o /tmp/vbox.0/VBoxGuestR0LibGenericRequest.o /tmp/vbox.0/VBoxGuestR0LibGenericRequest.c
   ./tools/objtool/objtool orc generate  --module --no-fp --retpoline --uaccess /tmp/vbox.0/VBoxGuestR0LibGenericRequest.o
  if objdump -h /tmp/vbox.0/VBoxGuestR0LibGenericRequest.o | grep -q __ksymtab; then  gcc-9 -E -D__GENKSYMS__ -Wp,-MD,/tmp/vbox.0/.VBoxGuestR0LibGenericRequest.o.d  -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/src/linux-headers-5.4.0-4-common/arch/x86/include -I./arch/x86/include/generated -I/usr/src/linux-headers-5.4.0-4-common/include -I./include -I/usr/src/linux-headers-5.4.0-4-common/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/usr/src/linux-headers-5.4.0-4-common/include/uapi -I./include/generated/uapi -include /usr/src/linux-headers-5.4.0-4-common/include/linux/kconfig.h -include /usr/src/linux-headers-5.4.0-4-common/include/linux/compiler_types.h -D__KERNEL__ -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -DCONFIG_X86_X32_ABI -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_AVX512=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-<some flags removed to fit into 30 000 char> -DVBOX_WITH_64_BITS_GUESTS  -DMODULE  -DKBUILD_BASENAME='"VBoxGuestR0LibGenericRequest"' -DKBUILD_MODNAME='"vboxguest"' /tmp/vbox.0/VBoxGuestR0LibGenericRequest.c | scripts/genksyms/genksyms    -r /dev/null > /tmp/vbox.0/.tmp_VBoxGuestR0LibGenericRequest.ver; ld -m elf_x86_64  -z max-page-size=0x200000 -r -o /tmp/vbox.0/.tmp_VBoxGuestR0LibGenericRequest.o /tmp/vbox.0/VBoxGuestR0LibGenericRequest.o -T /tmp/vbox.0/.tmp_VBoxGuestR0LibGenericRequest.ver; mv -f /tmp/vbox.0/.tmp_VBoxGuestR0LibGenericRequest.o /tmp/vbox.0/VBoxGuestR0LibGenericRequest.o; rm -f /tmp/vbox.0/.tmp_VBoxGuestR0LibGenericRequest.ver; fi
   gcc-9 -Wp,-MD,/tmp/vbox.0/.VBoxGuestR0LibHGCMInternal.o.d  -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/9/include -I/usr/src/linux-headers-5.4.0-4-common/arch/x86/include -I./arch/x86/include/generated -I/usr/src/linux-headers-5.4.0-4-common/include -I./include -I/usr/src/linux-headers-5.4.0-4-common/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/usr/src/linux-headers-5.4.0-4-common/include/uapi -I./include/generated/uapi -include /usr/src/linux-headers-5.4.0-4-common/include/linux/kconfig.h -include /usr/src/linux-headers-5.4.0-4-common/include/linux/compiler_types.h -D__KERNEL__ -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -DCONFIG_X86_X32_ABI -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_AVX512=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector-strong -Wno-unused-but-set-variable -Wimplicit-fallthrough -Wno-unused-const-variable -fno-var-tracking-assignments -g -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -flive-patching=inline-clone -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation -fno-strict-overflow -fno-merge-all-constants -fmerge-constants -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -fmacro-prefix-map=/usr/src/linux-headers-5.4.0-4-common/= -fcf-protection=none -Wno-packed-not-aligned -Wno-declaration-after-statement -include /tmp/vbox.0/include/VBox/VBoxGuestMangling.h -fno-pie -I/usr/src/linux-headers-5.4.0-4-common/include -I/tmp/vbox.0/ -I/tmp/vbox.0/include -I/tmp/vbox.0/r0drv/linux -I/tmp/vbox.0/vboxguest/ -I/tmp/vbox.0/vboxguest/include -I/tmp/vbox.0/vboxguest/r0drv/linux -D__KERNEL__ -DMODULE -DVBOX -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_GUEST -DIN_GUEST_R0 -DIN_MODULE -DRT_WITH_VBOX -DVBGL_VBOXGUEST -DVBOX_WITH_HGCM -DRT_ARCH_AMD64 -DVBOX_WITH_64_BITS_GUESTS  -DMODULE  -DKBUILD_BASENAME='"VBoxGuestR0LibHGCMInternal"' -DKBUILD_MODNAME='"vboxguest"' -c -o /tmp/vbox.0/VBoxGuestR0LibHGCMInternal.o /tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c
In file included from /usr/src/linux-headers-5.4.0-4-common/include/linux/compiler_types.h:59,
                 from <command-line>:
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c: In function ‘vbglR0HGCMInternalPreprocessCall’:
/usr/src/linux-headers-5.4.0-4-common/include/linux/compiler_attributes.h:200:41: error: expected ‘)’ before ‘__attribute__’
  200 | # define fallthrough                    __attribute__((__fallthrough__))
      |                                         ^~~~~~~~~~~~~
/tmp/vbox.0/include/iprt/cdefs.h:1116:48: note: in expansion of macro ‘fallthrough’
 1116 | # define RT_FALL_THROUGH()      __attribute__((fallthrough))
      |                                                ^~~~~~~~~~~
/tmp/vbox.0/include/iprt/cdefs.h:1123:33: note: in expansion of macro ‘RT_FALL_THROUGH’
 1123 | #define RT_FALL_THRU()          RT_FALL_THROUGH()
      |                                 ^~~~~~~~~~~~~~~
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c:271:17: note: in expansion of macro ‘RT_FALL_THRU’
  271 |                 RT_FALL_THRU();
      |                 ^~~~~~~~~~~~
In file included from /tmp/vbox.0/include/iprt/types.h:29,
                 from /tmp/vbox.0/VBoxGuestR0LibInternal.h:33,
                 from /tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c:33:
/tmp/vbox.0/include/iprt/cdefs.h:1116:60: error: expected identifier or ‘(’ before ‘)’ token
 1116 | # define RT_FALL_THROUGH()      __attribute__((fallthrough))
      |                                                            ^
/tmp/vbox.0/include/iprt/cdefs.h:1123:33: note: in expansion of macro ‘RT_FALL_THROUGH’
 1123 | #define RT_FALL_THRU()          RT_FALL_THROUGH()
      |                                 ^~~~~~~~~~~~~~~
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c:271:17: note: in expansion of macro ‘RT_FALL_THRU’
  271 |                 RT_FALL_THRU();
      |                 ^~~~~~~~~~~~
In file included from /usr/src/linux-headers-5.4.0-4-common/include/linux/compiler_types.h:59,
                 from <command-line>:
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c: In function ‘vbglR0HGCMInternalInitCall’:
/usr/src/linux-headers-5.4.0-4-common/include/linux/compiler_attributes.h:200:41: error: expected ‘)’ before ‘__attribute__’
  200 | # define fallthrough                    __attribute__((__fallthrough__))
      |                                         ^~~~~~~~~~~~~
/tmp/vbox.0/include/iprt/cdefs.h:1116:48: note: in expansion of macro ‘fallthrough’
 1116 | # define RT_FALL_THROUGH()      __attribute__((fallthrough))
      |                                                ^~~~~~~~~~~
/tmp/vbox.0/include/iprt/cdefs.h:1123:33: note: in expansion of macro ‘RT_FALL_THROUGH’
 1123 | #define RT_FALL_THRU()          RT_FALL_THROUGH()
      |                                 ^~~~~~~~~~~~~~~
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c:545:17: note: in expansion of macro ‘RT_FALL_THRU’
  545 |                 RT_FALL_THRU();
      |                 ^~~~~~~~~~~~
In file included from /tmp/vbox.0/include/iprt/types.h:29,
                 from /tmp/vbox.0/VBoxGuestR0LibInternal.h:33,
                 from /tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c:33:
/tmp/vbox.0/include/iprt/cdefs.h:1116:60: error: expected identifier or ‘(’ before ‘)’ token
 1116 | # define RT_FALL_THROUGH()      __attribute__((fallthrough))
      |                                                            ^
/tmp/vbox.0/include/iprt/cdefs.h:1123:33: note: in expansion of macro ‘RT_FALL_THROUGH’
 1123 | #define RT_FALL_THRU()          RT_FALL_THROUGH()
      |                                 ^~~~~~~~~~~~~~~
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c:545:17: note: in expansion of macro ‘RT_FALL_THRU’
  545 |                 RT_FALL_THRU();
      |                 ^~~~~~~~~~~~
In file included from /usr/src/linux-headers-5.4.0-4-common/include/linux/compiler_types.h:59,
                 from <command-line>:
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c: In function ‘vbglR0HGCMInternalCopyBackResult’:
/usr/src/linux-headers-5.4.0-4-common/include/linux/compiler_attributes.h:200:41: error: expected ‘)’ before ‘__attribute__’
  200 | # define fallthrough                    __attribute__((__fallthrough__))
      |                                         ^~~~~~~~~~~~~
/tmp/vbox.0/include/iprt/cdefs.h:1116:48: note: in expansion of macro ‘fallthrough’
 1116 | # define RT_FALL_THROUGH()      __attribute__((fallthrough))
      |                                                ^~~~~~~~~~~
/tmp/vbox.0/include/iprt/cdefs.h:1123:33: note: in expansion of macro ‘RT_FALL_THROUGH’
 1123 | #define RT_FALL_THRU()          RT_FALL_THROUGH()
      |                                 ^~~~~~~~~~~~~~~
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c:812:17: note: in expansion of macro ‘RT_FALL_THRU’
  812 |                 RT_FALL_THRU();
      |                 ^~~~~~~~~~~~
In file included from /tmp/vbox.0/include/iprt/types.h:29,
                 from /tmp/vbox.0/VBoxGuestR0LibInternal.h:33,
                 from /tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c:33:
/tmp/vbox.0/include/iprt/cdefs.h:1116:60: error: expected identifier or ‘(’ before ‘)’ token
 1116 | # define RT_FALL_THROUGH()      __attribute__((fallthrough))
      |                                                            ^
/tmp/vbox.0/include/iprt/cdefs.h:1123:33: note: in expansion of macro ‘RT_FALL_THROUGH’
 1123 | #define RT_FALL_THRU()          RT_FALL_THROUGH()
      |                                 ^~~~~~~~~~~~~~~
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c:812:17: note: in expansion of macro ‘RT_FALL_THRU’
  812 |                 RT_FALL_THRU();
      |                 ^~~~~~~~~~~~
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c: In function ‘vbglR0HGCMInternalPreprocessCall’:
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c:259:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
  259 |                 if (!VBGLR0_CAN_USE_PHYS_PAGE_LIST(/*a_fLocked =*/ true))
      |                    ^
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c:273:13: note: here
  273 |             case VMMDevHGCMParmType_LinAddr_In:
      |             ^~~~
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c: In function ‘vbglR0HGCMInternalInitCall’:
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c:539:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
  539 |                 if (!VBGLR0_CAN_USE_PHYS_PAGE_LIST(/*a_fLocked =*/ true))
      |                    ^
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c:547:13: note: here
  547 |             case VMMDevHGCMParmType_LinAddr_In:
      |             ^~~~
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c: In function ‘vbglR0HGCMInternalCopyBackResult’:
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c:807:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
  807 |                 if (!VBGLR0_CAN_USE_PHYS_PAGE_LIST(/*a_fLocked =*/ true))
      |                    ^
/tmp/vbox.0/VBoxGuestR0LibHGCMInternal.c:814:13: note: here
  814 |             case VMMDevHGCMParmType_LinAddr_Out:
      |             ^~~~
make[3]: *** [/usr/src/linux-headers-5.4.0-4-common/scripts/Makefile.build:271: /tmp/vbox.0/VBoxGuestR0LibHGCMInternal.o] Error 1
make[2]: *** [/usr/src/linux-headers-5.4.0-4-common/Makefile:1665: /tmp/vbox.0] Error 2
make[1]: *** [/usr/src/linux-headers-5.4.0-4-common/Makefile:179: sub-make] Error 2
make: *** [/tmp/vbox.0/Makefile.include.footer:100: vboxguest] Error 2

My compiler is:

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 9.2.1-30' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-mutex
Thread model: posix
gcc version 9.2.1 20200224 (Debian 9.2.1-30)
6
  • You should add more details to the question what "a minimal debian/testing" means. Did you install the kernel headers package matching your running kernel?
    – Bodo
    Feb 28, 2020 at 13:39
  • 1
    Look for those 2 files ( include/generated/autoconf.h, include/config/auto.conf) in /usr/src/linux-headers-5.4.0-4-amd64/ . Apparently they're reported missing ...
    – dragosht
    Feb 28, 2020 at 14:33
  • @dragosht they are there. The error message is an echo and not an actual(?!?) error. I am lost.
    – Vorac
    Feb 28, 2020 at 14:54
  • 1
    Any other failures in your log?
    – dragosht
    Feb 28, 2020 at 16:22
  • @dragosht on closer inspection, I discovered the line Could not find the X.Org or XFree86 Window System, skipping. and fixed it indirectly by installing a desktop environment. Because the compilation STILL fails, I am finally uploading the complete log.
    – Vorac
    Mar 2, 2020 at 9:59

3 Answers 3

16

The problem seems to be with the guest additions iso that come with the virtualbox installation. The best option is to download the guest additions from the repository.

  1. Run sudo apt install virtualbox-guest-additions-iso to get the latest repositories
  2. The guest iso will be downloaded inside /usr/share/virtualbox/VBoxGuestAdditions.iso
  3. Create a mount point and mount iso: sudo mkdir -p /mnt/cdrom && sudo mount /usr/share/virtualbox/VBoxGuestAdditions.iso /mnt/cdrom
  4. Navigate to iso and install: cd /mnt/cdrom && sudo sh ./VBoxLinuxAdditions.run --nox11
1
  • Thank goodness I found your answer. I was following all the steps in various links and nothing was working. I wish the folks either at VirtualBox or Ubuntu would add some kind of note or readme so we don't have thousands of programmer half-days wasted on this problem (not to mention the accompanying frustration)
    – Motorhead
    Jul 28, 2022 at 14:41
3

There seems to be a conflict between the macros related to the gcc fallthrough attribute in the virtual box guest addition drivers and the Linux kernel headers.

Specifically, the virtual box drivers define several such macros as:

root@vdebtest:/usr/src/vboxguest-5.1.38$ grep fallthrough -R
vboxvideo/include/iprt/cdefs.h:# define RT_FALL_THROUGH()      __attribute__((fallthrough))
vboxguest/include/iprt/cdefs.h:# define RT_FALL_THROUGH()      __attribute__((fallthrough))
vboxsf/include/iprt/cdefs.h:# define RT_FALL_THROUGH()      __attribute__((fallthrough))

But in the Linux kernel at include/linux/compiler_attributes.h, there's something like this:

/*
 * Add the pseudo keyword 'fallthrough' so case statement blocks
 * must end with any of these keywords:
 *   break;
 *   fallthrough;
 *   goto <label>;
 *   return [expression];
 *
 *  gcc: https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html#Statement-Attributes
 */
#if __has_attribute(__fallthrough__)
# define fallthrough                    __attribute__((__fallthrough__))
#else
# define fallthrough                    do {} while (0)  /* fallthrough */
#endif

Now, if I understand your build log correctly, I think those RT_FALL_THROUGHs would actually end up as __attribute__((__attribute__((__fallthrough__)))), messing up the code.

Could you try going in your /usr/src/vboxguest-x.y.z dir and replace all the __attribute__((fallthrough)) (they're only 3 of those on my setup) to __attribute__((__fallthrough__)) ? (Plain falthrough should also work, I guess) ...

Then rebuild all that by ./build_in_tmp .

Update: I see there were some complains some time ago on this topic here. And it seems to have already been fixed via this ticket.

3
  • What is supposed to be /usr/src/vboxguest-x.y.z? And is this on the host or slave? It seems that despite the failure, window resizing and shared folders work fine.
    – Vorac
    Mar 2, 2020 at 15:36
  • /usr/src/vboxguest-x.y.z stands for the location where the virtual box guest addition drivers end up when you run the ./VBoxLinuxAdditions.run. Those are built via dkms and, in your case the build for some kernel module fails.
    – dragosht
    Mar 2, 2020 at 15:40
  • 2
    I see newer VBoxGuestAddition packages are no longer creating the /usr/src/vboxguest stuff. They simply drop everything in /tmp and build everything from there. Anyway, those can still be extracted via ./VBoxLinuxAdditions.run --target <location> and then patched/built manually.
    – dragosht
    Mar 2, 2020 at 16:44
1

I finally get it sorted, spent 1 days to try multiple solutions. There was bug in VBoxLinuxAdditions.run 6.1.22, upgrade to Virtualbox 6.1.30 from your host, then repeat the same steps as many other posted.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .