virtualbox 게스트 추가: 오류: 잘못된 커널 구성

virtualbox 게스트 추가: 오류: 잘못된 커널 구성

내가 뭘 한거지:

  1. 최소한의 데비안 테스트 설치
  2. 빌드 필수, dkms, linux-headers-$(uname -r) 설치
  3. virtualbox를 설치하고 "장치" -> "게스트 추가 CD 삽입"을 클릭하세요.
  4. 달리기m-a prepare
  5. /dev/sr0어딘가에 설치되어 있습니다 cd../VBoxLinuxAdditions.run

내가 얻는 것:

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

로그 내용:

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

내가 조사한 내용:

    $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

호스트 운영 체제는 Ubuntu 18입니다.

편집: Openbox에서 로그는 다음과 같습니다.

# 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

내 컴파일러는 다음과 같습니다

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

답변1

문제는 virtualbox 설치와 함께 제공되는 게스트 추가 iso에 있는 것 같습니다. 가장 좋은 방법은 저장소에서 게스트 추가 항목을 다운로드하는 것입니다.

  1. sudo apt install virtualbox-guest-additions-iso최신 저장소를 얻으려면 실행하세요 .
  2. 게스트 ISO가 내부에 다운로드됩니다./usr/share/virtualbox/VBoxGuestAdditions.iso
  3. 마운트 지점을 생성하고 iso를 마운트합니다. sudo mkdir -p /mnt/cdrom && sudo mount /usr/share/virtualbox/VBoxGuestAdditions.iso /mnt/cdrom
  4. iso로 이동하여 다음을 설치하십시오. cd /mnt/cdrom && sudo sh ./VBoxLinuxAdditions.run --nox11

답변2

fallthrough가상 머신 게스트 추가 드라이버와 Linux 커널 헤더 파일의 gcc 속성과 관련된 매크로 간에 충돌이 있는 것으로 보입니다.

특히 Virtual Box 드라이버는 다음과 같은 여러 매크로를 정의합니다.

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

하지만 리눅스 커널에서는/linux/compiler_attributes.h를 포함합니다., 다음과 같은 것이 있습니다.

/*
 * 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

이제 빌드 로그를 올바르게 이해하면 이러한 RT_FALL_THROUGHs가 실제로 __attribute__((__attribute__((__fallthrough__))))코드를 엉망으로 만들 것이라고 생각합니다.

/usr/src/vboxguest-x.y.z귀하의 디렉토리 로 가서 __attribute__((fallthrough))모든 항목(내 설정에는 3개만 있음)을 로 바꿔주 시겠습니까 __attribute__((__fallthrough__))? ( falthrough일반도 효과적일 것 같아요)...

그런 다음 그들 모두를 다시 구축함으로써 ./build_in_tmp.

고쳐 쓰다: 얼마 전에 이 주제에 대한 불만 사항을 봤습니다.여기. 이것으로 해결된거 같습니다티켓.

답변3

마침내 문제를 해결했고, 여러 솔루션을 시도하면서 하루를 보냈습니다. VBoxLinuxAdditions.run 6.1.22에 버그가 있습니다. 호스트에서 Virtualbox 6.1.30으로 업그레이드하고 다른 많은 게시물과 동일한 단계를 반복하세요.

관련 정보