构建主要的 Guest Additions 模块...失败!

构建主要的 Guest Additions 模块...失败!

我的主机操作系统是 Windows 7 Professional。我在 Virualbox - 4.2.6 中安装了 Ubuntu 13.04。当我尝试安装 Ubuntu 的客户机附加组件时,我在终端中收到以下错误:

ranjeet@ringtail:/media/ranjeet/VBOXADDITIONS_4.2.6_82870$ sudo sh VBoxLinuxAdditions.run
[sudo] password for ranjeet: 
Verifying archive integrity... All good.
Uncompressing VirtualBox 4.2.6 Guest Additions for Linux..........
VirtualBox Guest Additions installer
Removing installed version 4.2.6 of VirtualBox Guest Additions...
Removing existing VirtualBox DKMS kernel modules ...done.
Removing existing VirtualBox non-DKMS kernel modules ...done.
Building the VirtualBox Guest Additions kernel modules
The headers for the current running kernel were not found. If the following
module compilation fails then this could be the reason.

Building the main Guest Additions module ...fail!
(Look at /var/log/vboxadd-install.log to find out what went wrong)

Doing non-kernel setup of the Guest Additions ...done.
Installing the Window System drivers
Installing X.Org Server 1.13 modules ...done.
Setting up the Window System to use the Guest Additions ...done.
You may need to restart the hal service and the Window System (or just restart
the guest system) to enable the Guest Additions.

Installing graphics libraries and desktop services components ...done.
ranjeet@ringtail:/media/ranjeet/VBOXADDITIONS_4.2.6_82870$ 

日志如下。

-----------vboxadd-install.log-------------------

Uninstalling modules from DKMS
Attempting to install using DKMS

Creating symlink /var/lib/dkms/vboxguest/4.2.6/source ->
                 /usr/src/vboxguest-4.2.6

DKMS: add completed.

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area....
make KERNELRELEASE=3.8.0-19-generic -C /lib/modules/3.8.0-19-generic/build M=/var/lib/dkms/vboxguest/4.2.6/build....(bad exit status: 2)
Traceback (most recent call last):
  File "/usr/share/apport/package-hooks/dkms_packages.py", line 22, in <module>
    import apport
ImportError: No module named apport
Error! Bad return status for module build on kernel: 3.8.0-19-generic (x86_64)
Consult /var/lib/dkms/vboxguest/4.2.6/build/make.log for more information.
Failed to install using DKMS, attempting to install without
grep: /lib/modules/3.8.0-19-generic/build/include/linux/version.h: No such file or directory
make KBUILD_VERBOSE=1 CONFIG_MODULE_SIG= -C /lib/modules/3.8.0-19-generic/build SUBDIRS=/tmp/vbox.0 SRCROOT=/tmp/vbox.0 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)
mkdir -p /tmp/vbox.0/.tmp_versions ; rm -f /tmp/vbox.0/.tmp_versions/*
make -f scripts/Makefile.build obj=/tmp/vbox.0
  gcc -Wp,-MD,/tmp/vbox.0/.VBoxGuest-linux.o.d  -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/4.7/include  -I/usr/src/linux-headers-3.8.0-19-generic/arch/x86/include -Iarch/x86/include/generated  -Iinclude -I/usr/src/linux-headers-3.8.0-19-generic/arch/x86/include/uapi -Iarch/x86/include/generated/uapi -I/usr/src/linux-headers-3.8.0-19-generic/include/uapi -Iinclude/generated/uapi -include /usr/src/linux-headers-3.8.0-19-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 -mno-sse -mpreferred-stack-boundary=3 -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-19-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
/tmp/vbox.0/VBoxGuest-linux.c:199:49: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘g_VBoxGuestPciId’
/tmp/vbox.0/VBoxGuest-linux.c:328:21: error: ‘g_VBoxGuestPciId’ undeclared here (not in a function)
/tmp/vbox.0/VBoxGuest-linux.c:209:1: error: ‘__mod_pci_device_table’ aliased to undefined symbol ‘g_VBoxGuestPciId’
make[2]: *** [/tmp/vbox.0/VBoxGuest-linux.o] Error 1
make[1]: *** [_module_/tmp/vbox.0] Error 2
make: *** [vboxguest] Error 2
Creating user for the Guest Additions.
Creating udev rule for the Guest Additions kernel module.

答案1

Guest Additions 可能无法在比其设计时更新的 Linux 内核上编译。因此,旧版本的 VirtualBox 无法运行具有较新内核的客户端的情况并不罕见。

很少几个这些不兼容问题已得到修复在最近的版本中。

为了利用这一点,并能够运行 Ubuntu 13.04(或更高版本)升级你的虚拟盒建议使用软件。您可以从此处下载最新版本:

答案2

只需在终端中运行一个简单的命令 -

sudo apt-get install virtualbox-guest-x11

完成后,重新启动虚拟盒。

答案3

未找到当前正在运行的内核的标头。如果以下模块编译失败,则这可能是原因。

使用

sudo apt-get install linux-generic

linux-generic是一个依赖于最新内核映像和头文件的元包。因此,它将安装编译 VirtualBox 附加内核模块所需的包。

答案4

我的设置

运行 Windows 7 的东芝笔记本电脑上的适用于 Windows 的 Oracle Virtualbox v4.2.8 r83876。Virtualbox 中的客户操作系统是 Lubuntu 13.10(32 位)。

解决方案

我只是要列出我运行的最终解决问题的命令(屏幕分辨率不使用整个显示屏、鼠标滚轮不工作、双向复制和粘贴(剪贴板)不工作。

一些 apt-get 命令后有几段输出摘录。

每次执行完sudo apt-get install ...命令后我都会重新启动我的 Lubuntu 客户操作系统。

脚步

1)关闭 Lubuntu 客户操作系统

2)安装 Virtualbox Guest Additions iso。

3)在 Virtualbox 管理器中,右键单击 Lubuntu 客户操作系统 > 设置 > 存储 > 右键单击​​ IDE > 添加 CD/DVD 设备 > 导航到 Windows 上包含VBoxGuestAdditions.iso(例如\Program Files\Oracle\Virtualbox)的文件夹

4) 从 Virtualbox Manager 中启动 Lubuntu 客户操作系统。

5)从 Lubuntu 客户操作系统中启动 LXTerminal

6)在LXTerminal中,

cd /media/$USER/VBOXADDITIONS_4.2.8_83876
sudo ./VBoxLinuxAdditions.run

笔记:您的附加版本号可能有所不同。

对我来说,这个命令输出是

...The make utility was not found. If the following module compilation fails then
this could be the reason and you should try installing it.

The gcc utility was not found. If the following module compilation fails then
this could be the reason and you should try installing it.

Building the main Guest Additions module ...fail!
...
Warning: unknown version of the X Window System installed.  Not installing
X Window System drivers.

如果你得到相同的输出,运行:

sudo apt-get update
sudo apt-get install dkms build-essential virtualbox-guest-x11 linux-headers-generic linux-headers-virtual

所有问题都应得到解决。(您可能需要重新启动虚拟机。)

相关内容