Ubuntu 16, Unable to install guest additions.

Firewire Pro

Honorable
Jan 29, 2014
16
0
10,510
I just installed a virtual machine with Ubuntu 16 on my windows 10 pc using the newest version of virtualbox. I have tried several times to install guest additions but it keeps failing. I mounted the guest additions virtual disk and pressed "run program" after which I get:
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.0.28 Guest Additions for Linux............
VirtualBox Guest Additions installer
Removing installed version 5.0.28 of VirtualBox Guest Additions...
Removing existing VirtualBox DKMS kernel modules ...done.
Removing existing VirtualBox non-DKMS kernel modules ...done.
update-initramfs: Generating /boot/initrd.img-4.8.0-22-generic
update-initramfs: Generating /boot/initrd.img-4.8.0-26-generic
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 ...fail!
(Look at /var/log/vboxadd-install.log to find out what went wrong)
Doing non-kernel setup of the Guest Additions ...done.
Press Return to close this window...
This is the log file:
KMS: add completed.

Kernel preparation unnecessary for this kernel. Skipping...

Building module:
cleaning build area....
make KERNELRELEASE=4.8.0-22-generic -C /lib/modules/4.8.0-22-generic/build M=/var/lib/dkms/vboxguest/5.0.28/build............(bad exit status: 2)
ERROR (dkms apport): binary package for vboxguest: 5.0.28 not found
Error! Bad return status for module build on kernel: 4.8.0-22-generic (x86_64)
Consult /var/lib/dkms/vboxguest/5.0.28/build/make.log for more information.
Failed to install using DKMS, attempting to install without
grep: /lib/modules/4.8.0-22-generic/build/include/linux/version.h: No such file or directory
make KBUILD_VERBOSE=1 CONFIG_MODULE_SIG= -C /lib/modules/4.8.0-22-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)

I would really appreciate if you all could help solve this problem for me. I have looked all over YouTube and th internet and tried all the fixes I could...
 
Solution
As the message tells you, the kernel header files are not installed. These are needed to compile guest additions.

Try: sudo apt-get install linux-headers-$(uname -r)

Firewire Pro

Honorable
Jan 29, 2014
16
0
10,510
I tried what you said and I got this.
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-image-generic thermald
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
linux-headers-4.8.0-26
The following NEW packages will be installed:
linux-headers-4.8.0-26 linux-headers-4.8.0-26-generic
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 11.0 MB of archives.
After this operation, 80.7 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu yakkety-updates/main amd64 linux-headers-4.8.0-26 all 4.8.0-26.28 [10.2 MB]
Get:2 http://us.archive.ubuntu.com/ubuntu yakkety-updates/main amd64 linux-headers-4.8.0-26-generic amd64 4.8.0-26.28 [809 kB]
Fetched 11.0 MB in 30min 44s (5,978 B/s)
Selecting previously unselected package linux-headers-4.8.0-26.
(Reading database ... 173364 files and directories currently installed.)
Preparing to unpack .../0-linux-headers-4.8.0-26_4.8.0-26.28_all.deb ...
Unpacking linux-headers-4.8.0-26 (4.8.0-26.28) ...
Selecting previously unselected package linux-headers-4.8.0-26-generic.
Preparing to unpack .../1-linux-headers-4.8.0-26-generic_4.8.0-26.28_amd64.deb ...
Unpacking linux-headers-4.8.0-26-generic (4.8.0-26.28) ...
Setting up linux-headers-4.8.0-26 (4.8.0-26.28) ...
Setting up linux-headers-4.8.0-26-generic (4.8.0-26.28) ...
Examining /etc/kernel/header_postinst.d.
run-parts: executing /etc/kernel/header_postinst.d/dkms 4.8.0-26-generic /boot/vmlinuz-4.8.0-26-generic
ERROR (dkms apport): binary package for vboxguest: 5.0.28 not found
Error! Bad return status for module build on kernel: 4.8.0-26-generic (x86_64)
Consult /var/lib/dkms/vboxguest/5.0.28/build/make.log for more information.
This is what the log file said:
DKMS make.log for vboxguest-5.0.28 for kernel 4.8.0-26-generic (x86_64)
Wed Nov 2 21:43:58 EDT 2016
make: Entering directory '/usr/src/linux-headers-4.8.0-26-generic'
LD /var/lib/dkms/vboxguest/5.0.28/build/built-in.o
LD /var/lib/dkms/vboxguest/5.0.28/build/vboxguest/built-in.o
CC [M] /var/lib/dkms/vboxguest/5.0.28/build/vboxguest/VBoxGuest-linux.o
CC [M] /var/lib/dkms/vboxguest/5.0.28/build/vboxguest/VBoxGuest.o
CC [M] /var/lib/dkms/vboxguest/5.0.28/build/vboxguest/GenericRequest.o
CC [M] /var/lib/dkms/vboxguest/5.0.28/build/vboxguest/HGCMInternal.o
CC [M] /var/lib/dkms/vboxguest/5.0.28/build/vboxguest/Init.o
CC [M] /var/lib/dkms/vboxguest/5.0.28/build/vboxguest/PhysHeap.o
CC [M] /var/lib/dkms/vboxguest/5.0.28/build/vboxguest/SysHlp.o
CC [M] /var/lib/dkms/vboxguest/5.0.28/build/vboxguest/VMMDev.o
CC [M] /var/lib/dkms/vboxguest/5.0.28/build/vboxguest/r0drv/alloc-r0drv.o
CC [M] /var/lib/dkms/vboxguest/5.0.28/build/vboxguest/r0drv/initterm-r0drv.o
CC [M] /var/lib/dkms/vboxguest/5.0.28/build/vboxguest/r0drv/memobj-r0drv.o
CC [M] /var/lib/dkms/vboxguest/5.0.28/build/vboxguest/r0drv/mpnotification-r0drv.o
CC [M] /var/lib/dkms/vboxguest/5.0.28/build/vboxguest/r0drv/powernotification-r0drv.o
CC [M] /var/lib/dkms/vboxguest/5.0.28/build/vboxguest/r0drv/linux/alloc-r0drv-linux.o
CC [M] /var/lib/dkms/vboxguest/5.0.28/build/vboxguest/r0drv/linux/assert-r0drv-linux.o
CC [M] /var/lib/dkms/vboxguest/5.0.28/build/vboxguest/r0drv/linux/initterm-r0drv-linux.o
CC [M] /var/lib/dkms/vboxguest/5.0.28/build/vboxguest/r0drv/linux/memobj-r0drv-linux.o
CC [M] /var/lib/dkms/vboxguest/5.0.28/build/vboxguest/r0drv/linux/memuserkernel-r0drv-linux.o
CC [M] /var/lib/dkms/vboxguest/5.0.28/build/vboxguest/r0drv/linux/mp-r0drv-linux.o
CC [M] /var/lib/dkms/vboxguest/5.0.28/build/vboxguest/r0drv/linux/mpnotification-r0drv-linux.o
CC [M] /var/lib/dkms/vboxguest/5.0.28/build/vboxguest/r0drv/linux/process-r0drv-linux.o
CC [M] /var/lib/dkms/vboxguest/5.0.28/build/vboxguest/r0drv/linux/semevent-r0drv-linux.o
CC [M] /var/lib/dkms/vboxguest/5.0.28/build/vboxguest/r0drv/linux/semeventmulti-r0drv-linux.o
CC [M] /var/lib/dkms/vboxguest/5.0.28/build/vboxguest/r0drv/linux/semfastmutex-r0drv-linux.o
CC [M] /var/lib/dkms/vboxguest/5.0.28/build/vboxguest/r0drv/linux/semmutex-r0drv-linux.o
CC [M] /var/lib/dkms/vboxguest/5.0.28/build/vboxguest/r0drv/linux/spinlock-r0drv-linux.o
CC [M] /var/lib/dkms/vboxguest/5.0.28/build/vboxguest/r0drv/linux/thread-r0drv-linux.o
CC [M] /var/lib/dkms/vboxguest/5.0.28/build/vboxguest/r0drv/linux/thread2-r0drv-linux.o
CC [M] /var/lib/dkms/vboxguest/5.0.28/build/vboxguest/r0drv/linux/time-r0drv-linux.o
CC [M] /var/lib/dkms/vboxguest/5.0.28/build/vboxguest/r0drv/linux/timer-r0drv-linux.o
/var/lib/dkms/vboxguest/5.0.28/build/vboxguest/r0drv/linux/timer-r0drv-linux.c: In function ‘rtTimerLnxStartSubTimer’:
/var/lib/dkms/vboxguest/5.0.28/build/vboxguest/r0drv/linux/timer-r0drv-linux.c:364:13: error: implicit declaration of function ‘mod_timer_pinned’ [-Werror=implicit-function-declaration]
mod_timer_pinned(&pSubTimer->u.Std.LnxTimer, pSubTimer->u.Std.ulNextJiffies);
^~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
scripts/Makefile.build:289: recipe for target '/var/lib/dkms/vboxguest/5.0.28/build/vboxguest/r0drv/linux/timer-r0drv-linux.o' failed
make[2]: *** [/var/lib/dkms/vboxguest/5.0.28/build/vboxguest/r0drv/linux/timer-r0drv-linux.o] Error 1
scripts/Makefile.build:440: recipe for target '/var/lib/dkms/vboxguest/5.0.28/build/vboxguest' failed
make[1]: *** [/var/lib/dkms/vboxguest/5.0.28/build/vboxguest] Error 2
Makefile:1489: recipe for target '_module_/var/lib/dkms/vboxguest/5.0.28/build' failed
make: *** [_module_/var/lib/dkms/vboxguest/5.0.28/build] Error 2
make: Leaving directory '/usr/src/linux-headers-4.8.0-26-generic'
 

sdecman

Commendable
Nov 5, 2016
1
0
1,510
I have the same problem. Ubuntu 16.10, Virtualbox 5.0.28, Windows 10. The problem is in the function mod_timer_pinned which is dropped from kernel 4.8. Bad luck, new Ubuntu uses that kernel and Guest Additions are not yet adapted to that change. No known solution or workaround at this point - or at least I haven't found it. See here: https://www.virtualbox.org/ticket/15695.

P.S.: I tried upgrading Virtualbox to 5.1.8 but things are only worse. Looks like I'll wait a couple of months for Oracle to release a new 5.0.32 (?) version.