对与 Linux 标头/内核相关的 Virtualbox 共享文件夹进行故障排除

对与 Linux 标头/内核相关的 Virtualbox 共享文件夹进行故障排除

故障排除

主持人: Windows 7的

客人:Debian Linux

尝试过:安装 Guest Additions、安装标头、重新安装标头、安装 DKMS、创建 vboxsf 组/用户

问题:Guest Additions 似乎在标头或内核配置等方面存在问题……

Guest Additions 已插入安装多次,但在安装的共享文件夹部分始终失败。

问题似乎出在 Linux 标头上,尽管我已经安装、卸载并重新安装了看似正确的基于的标头uname -a

root@debian:/media# uname -a
Linux debian 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt20-1+deb8u3 (2016-01-17) x86_64 GNU/Linux
root@debian:/media# apt-get install linux-headers-3.16.0.4
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'linux-headers-3.16.0-4-all' for regex 'linux-headers-3.16.0.4'
Note, selecting 'linux-headers-3.16.0-4-amd64' for regex 'linux-headers-3.16.0.4'
Note, selecting 'linux-headers-3.16.0-4-common' for regex 'linux-headers-3.16.0.4'
Note, selecting 'linux-headers-3.16.0-4-all-amd64' for regex 'linux-headers-3.16.0.4'
linux-headers-3.16.0-4-amd64 is already the newest version.
linux-headers-3.16.0-4-common is already the newest version.
linux-headers-3.16.0-4-common set to manually installed.

成功安装标题后,我尝试安装 Guest Additions(共享文件夹支持):

root@debian:/media# sh /media/cdrom/VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 4.3.12 Guest Additions for Linux............
VirtualBox Guest Additions installer
Removing installed version 4.3.12 of VirtualBox Guest Additions...
Copying additional installer modules ...
Installing additional modules ...
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 ...done.
Building the shared folder support 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
Warning: unknown version of the X Window System installed.  Not installing
X Window System drivers.
 ...done.
Installing graphics libraries and desktop services components ...done.

因此,我查看了上面错误消息中提到的日志文件:

Uninstalling modules from DKMS
Attempting to install using DKMS

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

DKMS: add completed.

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area....
make KERNELRELEASE=3.16.0-4-amd64 -C /lib/modules/3.16.0-4-amd64/build M=/var/lib/dkms/vboxguest/4.3.12/build............(bad$
Error! Bad return status for module build on kernel: 3.16.0-4-amd64 (x86_64)
Consult /var/lib/dkms/vboxguest/4.3.12/build/make.log for more information.
Failed to install using DKMS, attempting to install without
grep: /lib/modules/3.16.0-4-amd64/build/include/linux/version.h: No such file or directory
make KBUILD_VERBOSE=1 CONFIG_MODULE_SIG= -C /lib/modules/3.16.0-4-amd64/build SUBDIRS=/tmp/vbox.0 SRCROOT=/tmp/vbox.0 modules
Makefile:10: *** mixed implicit and normal rules: deprecated syntax
make[1]: Entering directory `/usr/src/linux-headers-3.16.0-4-amd64'
make -C /usr/src/linux-headers-3.16.0-4-amd64 \
KBUILD_SRC=/usr/src/linux-headers-3.16.0-4-common \
KBUILD_EXTMOD="/tmp/vbox.0" -f /usr/src/linux-headers-3.16.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)
mkdir -p /tmp/vbox.0/.tmp_versions ; rm -f /tmp/vbox.0/.tmp_versions/*
make -f /usr/src/linux-headers-3.16.0-4-common/scripts/Makefile.build obj=/tmp/vbox.0
   gcc-4.8 -Wp,-MD,/tmp/vbox.0/.VBoxGuest-linux.o.d  -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/4.8/include -I/usr/src/$
  if [ "-pg" = "-pg" ]; then if [ /tmp/vbox.0/VBoxGuest-linux.o != "scripts/mod/empty.o" ]; then ./scripts/recordmcount  "/tm$
   gcc-4.8 -Wp,-MD,/tmp/vbox.0/.VBoxGuest.o.d  -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/4.8/include -I/usr/src/linux-$
/tmp/vbox.0/VBoxGuest.c: In function ‘VBoxGuestCommonGetHandledEventsLocked’:
/tmp/vbox.0/VBoxGuest.c:82:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     uint32_t u32AllowedGuestCaps = pSession->u32AquiredGuestCaps | (VMMDEV_EVENT_VALID_EVENT_MASK & ~pDevExt->u32AcquireMode$

我搜索了日志文件中的一个早期错误,发现了这个。不确定是否相关:

https://github.com/zfsonlinux/zfs/issues/3807

相关内容