Solucionando problemas de pastas compartilhadas do Virtualbox no que se refere aos cabeçalhos / kernel do Linux

1

Trouableshoot

Anfitrião : Windows 7

Convidado : Debian Linux

Tentei : instalando adições de convidados, instalando cabeçalhos, reinstalando cabeçalhos, instalando DKMS, criando grupos / usuários vboxsf

Problema : o Guest Additions parece ter problemas com os cabeçalhos ou a configuração do kernel ou algo assim ...

As Adições de Convidado foram instaladas várias vezes, mas continuam falhando na seção Pastas Compartilhadas da instalação.

O problema parece estar com os cabeçalhos do Linux, embora eu tenha instalado, desinstalado e reinstalado o que parecem ser os cabeçalhos corretos com base 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.

após a instalação bem-sucedida dos cabeçalhos, tento instalar as Adições de Convidado (suporte para Pastas Compartilhadas):

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.

Então, dei uma olhada no arquivo de log mencionado na mensagem de erro acima:

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$

Eu procurei em um dos primeiros erros no arquivo de log e encontrei isso. Não tenho certeza se está relacionado:

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

Hack-R
fonte
comece aqui: virtualbox.org/manual/ch04.html#idp46457703730512, certifique-se de instalar o DKMS antes de executar a instalação, os cabeçalhos e eu normalmente instalo build-essentialtambém para garantir que os requisitos do gcc sejam atendidos. Não tive muitos problemas ao instalar as adições de convidados no Wheezy ou Jessie.
Frank Thomas
@FrankThomas Thanks. O DKMS está definitivamente instalado. Vou verificar o gcc e o build-essential.
Hack-R
@FrankThomas Não fez o truque: /
Hack-R