ubuntu – 无法在3.8内核上编译Vagrant VirtualBox Guest Additions

前端之家收集整理的这篇文章主要介绍了ubuntu – 无法在3.8内核上编译Vagrant VirtualBox Guest Additions前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
使用VirtualBox 4.3.4和Vagrant 1.3.5.运行带有3.8内核的Ubuntu 12.04.3盒子:
  1. # uname -a
  2. Linux precise64 3.8.0-34-generic #49~precise1-Ubuntu SMP Wed Nov 13 18:05:00 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

尝试编译客户添加失败:

  1. # /etc/init.d/vBoxadd setup
  2. Removing existing VirtualBox DKMS kernel modules ...done.
  3. Removing existing VirtualBox non-DKMS kernel modules ...done.
  4. Building the VirtualBox Guest Additions kernel modules
  5. The headers for the current running kernel were not found. If the following
  6. module compilation fails then this could be the reason.
  7.  
  8. Building the main Guest Additions module ...fail!
  9. (Look at /var/log/vBoxadd-install.log to find out what went wrong)
  10. Doing non-kernel setup of the Guest Additions ...done.

该日志指向缺少的version.h文件

  1. # cat /var/log/vBoxadd-install.log
  2. grep: /lib/modules/3.8.0-34-generic/build/include/linux/version.h: No such file or directory
  3. make KBUILD_VERBOSE=1 CONFIG_MODULE_SIG= -C /lib/modules/3.8.0-34-generic/build SUBDIRS=/tmp/vBox.0 SRCROOT=/tmp/vBox.0 modules
  4. test -e include/generated/autoconf.h -a -e include/config/auto.conf || ( \
  5. echo >&2; \
  6. echo >&2 " ERROR: Kernel configuration is invalid."; \
  7. echo >&2 " include/generated/autoconf.h or include/config/auto.conf are missing.";\
  8. echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \
  9. echo >&2 ; \
  10. /bin/false)
  11. mkdir -p /tmp/vBox.0/.tmp_versions ; rm -f /tmp/vBox.0/.tmp_versions/*
  12. make -f scripts/Makefile.build obj=/tmp/vBox.0
  13. gcc -Wp,-MD,/tmp/vBox.0/.VBoxGuest-linux.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/4.6/include -I/usr/src/linux-headers-3.8.0-34-generic/arch/x86/include -Iarch/x86/include/generated -Iinclude -I/usr/src/linux-headers-3.8.0-34-generic/arch/x86/include/uapi -Iarch/x86/include/generated/uapi -I/usr/src/linux-headers-3.8.0-34-generic/include/uapi -Iinclude/generated/uapi -include /usr/src/linux-headers-3.8.0-34-generic/include/linux/kconfig.h -Iubuntu/include -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -O2 -m64 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -fstack-protector -DCONFIG_X86_X32_ABI -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -Wframe-larger-than=1024 -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -pg -mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -DCC_HAVE_ASM_GOTO -include /tmp/vBox.0/include/VBox/VBoxGuestMangling.h -I/lib/modules/3.8.0-34-generic/build/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 -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(VBoxGuest_linux)" -D"KBUILD_MODNAME=KBUILD_STR(vBoxguest)" -c -o /tmp/vBox.0/.tmp_VBoxGuest-linux.o /tmp/vBox.0/VBoxGuest-linux.c
  14. /tmp/vBox.0/VBoxGuest-linux.c:199:49: error: expected ‘=’,‘,’,‘;’,‘asm’ or ‘__attribute__’ before ‘g_VBoxGuestPciId’
  15. /tmp/vBox.0/VBoxGuest-linux.c:328:21: error: ‘g_VBoxGuestPciId’ undeclared here (not in a function)
  16. /tmp/vBox.0/VBoxGuest-linux.c:209:1: error: ‘__mod_pci_device_table’ aliased to undefined symbol ‘g_VBoxGuestPciId’
  17. make[2]: *** [/tmp/vBox.0/VBoxGuest-linux.o] Error 1
  18. make[1]: *** [_module_/tmp/vBox.0] Error 2
  19. make: *** [vBoxguest] Error 2
  20. Creating user for the Guest Additions.
  21. Creating udev rule for the Guest Additions kernel module.
这对我有用:
  1. vagrant plugin install vagrant-vbguest

完整输出如下:

  1. $vagrant plugin install vagrant-vbguest
  2. $vagrant up
  3. Bringing machine 'default' up with 'virtualBox' provider...
  4. [default] Clearing any prevIoUsly set forwarded ports...
  5. [default] Creating shared folders Metadata...
  6. [default] Clearing any prevIoUsly set network interfaces...
  7. [default] Preparing network interfaces based on configuration...
  8. [default] Forwarding ports...
  9. [default] -- 22 => 2222 (adapter 1)
  10. [default] Booting VM...
  11. GuestAdditions versions on your host (4.3.4) and guest (4.2.0) do not match.
  12. stdin: is not a tty
  13. Reading package lists...
  14. Building dependency tree...
  15. Reading state information...
  16. linux-headers-3.8.0-34-generic is already the newest version.
  17. The following NEW packages will be installed:
  18. dkms
  19. 0 upgraded,1 newly installed,0 to remove and 0 not upgraded.
  20. Need to get 73.2 kB of archives.
  21. After this operation,348 kB of additional disk space will be used.
  22. Get:1 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main dkms all 2.2.0.3- 1ubuntu3.1 [73.2 kB]
  23. dpkg-preconfigure: unable to re-open stdin: No such file or directory
  24. Fetched 73.2 kB in 0s (145 kB/s)
  25. Selecting prevIoUsly unselected package dkms.
  26. (Reading database ... 84686 files and directories currently installed.)
  27. Unpacking dkms (from .../dkms_2.2.0.3-1ubuntu3.1_all.deb) ...
  28. Processing triggers for man-db ...
  29. Setting up dkms (2.2.0.3-1ubuntu3.1) ...
  30. Copy iso file /Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso into the Box /tmp/VBoxGuestAdditions.iso
  31. stdin: is not a tty
  32. mount: block device /tmp/VBoxGuestAdditions.iso is write-protected,mounting read-only
  33. Installing VirtualBox Guest Additions 4.3.4 - guest version is 4.2.0
  34. stdin: is not a tty
  35. Verifying archive integrity... All good.
  36. Uncompressing VirtualBox 4.3.4 Guest Additions for Linux............
  37. VirtualBox Guest Additions installer
  38. Removing installed version 4.2.0 of VirtualBox Guest Additions...
  39. Copying additional installer modules ...
  40. Installing additional modules ...
  41. Removing existing VirtualBox DKMS kernel modules ...done.
  42. Removing existing VirtualBox non-DKMS kernel modules ...done.
  43. Building the VirtualBox Guest Additions kernel modules ...done.
  44. Doing non-kernel setup of the Guest Additions ...done.
  45. Starting the VirtualBox Guest Additions ...done.
  46. Installing the Window System drivers ...fail!
  47. (Could not find the X.Org or XFree86 Window System.)
  48. An error occurred during installation of VirtualBox Guest Additions 4.3.4. Some functionality may not work as intended.
  49. stdin: is not a tty
  50. [default] Waiting for machine to boot. This may take a few minutes...
  51. [default] Machine booted and ready!
  52. [default] Setting hostname...
  53. [default] Mounting shared folders...
  54. [default] -- /vagrant

猜你在找的Ubuntu相关文章