2

I am trying to install Virtualbox Guest Additions on a new Debian 9 installation and get an error when building modules. Packages build-essential, module-assistant, dpkg, linux-headers-4.0.3 are installed:

$ sudo apt install build-essential dpkg linux-headers-4.0.3-3
$ sudo apt build-dep -y linux

To install the Additions I run:

$ sudo mount -o remount,exec,ro /media/cdrom0
$ sudo /media/cdrom0/VBoxLinuxAddons.run

And get the error:

Verifying archive integrity... All good.
Uncompressing VirtualBox 5.1.6 Guest Additions for Linux...........
VirtualBox Guest Additions installer
Removing installed version 5.1.6 of VirtualBox Guest Additions...
Copying additional installer modules ...
Installing additional modules ...
vboxadd.sh: Building Guest Additions kernel modules.
Failed to set up service vboxadd, please check the log file
/var/log/VBoxGuestAdditions.log for details.
sergiy@debian-pc-1:~$

Log /var/log/VBoxGuestAdditions.log contains:

Created symlink /etc/systemd/system/multi-user.target.wants/vboxadd.service → /lib/systemd/system/vboxadd.service.
vboxadd.sh: failed: Look at /var/log/vboxadd-install.log to find out what went wrong.
vboxadd.sh: failed: Please check that you have gcc, make, the header files for your Linux kernel and possibly perl installed..
Created symlink /etc/systemd/system/multi-user.target.wants/vboxadd-service.service → /lib/systemd/system/vboxadd-service.service.
Created symlink /etc/systemd/system/multi-user.target.wants/vboxadd-x11.service → /lib/systemd/system/vboxadd-x11.service.

File /var/log/vboxadd-install.log contains:

grep: /lib/modules/4.9.0-3-amd64/build/include/linux/version.h: No such file or directory
make KBUILD_VERBOSE=1 CONFIG_MODULE_SIG= -C /lib/modules/4.9.0-3-amd64/build SUBDIRS=/tmp/vbox.0 SRCROOT=/tmp/vbox.0 -j1 modules
make -C /usr/src/linux-headers-4.9.0-3-amd64 KBUILD_SRC=/usr/src/linux-headers-4.9.0-3-common \
-f /usr/src/linux-headers-4.9.0-3-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-4.9.0-3-common/scripts/Makefile.build obj=/tmp/vbox.0
   gcc-6 -Wp,-MD,/tmp/vbox.0/.VBoxGuest-linux.o.d  -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/6/include -I/usr/src/linux-headers-4.9.0-3-common/arch/x86/
------------------------------------------------
In file included from /tmp/vbox.0/r0drv/linux/the-linux-kernel.h:98:0,
                 from /tmp/vbox.0/r0drv/linux/memobj-r0drv-linux.c:31:
/usr/src/linux-headers-4.9.0-3-common/include/linux/mm.h:1298:6: note: declared here
 long get_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm,
      ^~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
/usr/src/linux-headers-4.9.0-3-common/scripts/Makefile.build:298: recipe for target '/tmp/vbox.0/r0drv/linux/memobj-r0drv-linux.o' failed
make[4]: *** [/tmp/vbox.0/r0drv/linux/memobj-r0drv-linux.o] Error 1
/usr/src/linux-headers-4.9.0-3-common/Makefile:1507: recipe for target '_module_/tmp/vbox.0' failed
make[3]: *** [_module_/tmp/vbox.0] Error 2
Makefile:150: recipe for target 'sub-make' failed
make[2]: *** [sub-make] Error 2
Makefile:8: recipe for target 'all' failed
make[1]: *** [all] Error 2
/tmp/vbox.0/Makefile.include.footer:84: recipe for target 'vboxguest' failed
make: *** [vboxguest] Error 2
Creating user for the Guest Additions.
Creating udev rule for the Guest Additions kernel module.

Output uname -a:

Linux debian-pc-1 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2+deb9u1 (2017-06-18) x86_64 GNU/Linux

$ dpkg -l | grep virtualbox

Result of command dpkg -l | grep virtualbox on host Ubuntu 16.10:

ii  virtualbox                                  5.1.6-dfsg-2                                       amd64        x86 virtualization solution - base binaries
rc  virtualbox-5.1                              5.1.22-115126~Ubuntu~yakkety                       amd64        Oracle VM VirtualBox
ii  virtualbox-dkms                             5.1.6-dfsg-2                                       all          x86 virtualization solution - kernel module sources for dkms
ii  virtualbox-qt                               5.1.6-dfsg-2                                       amd64        x86 virtualization solution - Qt based user interface
ii  virtualbox-source                           5.1.6-dfsg-2                                       all          x86 virtualization solution - kernel module source

File /etc/apt/sources.list in Debian guest:

deb http://deb.debian.org/debian/ stretch-updates main contrib non-free
deb-src http://deb.debian.org/debian/ stretch-updates main contrib non-free

deb http://deb.debian.org/debian/ stretch main contrib non-free
deb-src http://deb.debian.org/debian/ stretch main contrib non-free

deb http://security.debian.org/ stretch/updates main contrib non-free

deb http://httpredir.debian.org/debian stretch-backports main contrib non-free
deb-src http://httpredir.debian.org/debian stretch-backports main contrib non-free

ISO with Virtualbox addons 5.1.6 was downloaded by VirtualBox from official site. What's wrong? How to fix it?

  • 1
    Try running with locale "C", which should return English output. Also, please include the output of uname -a in your question. Also, perhaps more pertinently, where did you get your VB Additions from? – Faheem Mitha Jul 19 '17 at 11:45
  • I added information about VirtualBox addons and uname, thanks. – Сергей Матийчук Jul 19 '17 at 14:02
  • You probably don't want to mix the versions in Debian with the versions from the Virtualbox web site. In particular, the Debian packages virtualbox-guest-additions-iso provides the Virtualbox Additions (not addons) that you are trying to install. Please include the output of dpkg -l | grep virtualbox in your question. – Faheem Mitha Jul 19 '17 at 15:04
  • command dpkg -l | grep virtualbox gets empty result, it is guest system, not host. – Сергей Матийчук Jul 20 '17 at 10:07
  • Run that command on the host, not the guest. – Faheem Mitha Jul 20 '17 at 10:23
4

The linux-headers-4.0.3-3 belong to Ubuntu . You should install the linux-headers-4.9.0-3-amd64 package on debian 9:

apt install linux-headers-4.9.0-3-amd64 

Install dkms and prepare the kernel to build the kernel module:

apt install dkms
m-a prepare

Run the VBoxLinuxAddons.run.

  • This one did it for me. I'd had additions working previously but I think there had been a kernel upgrade (or possibly even the whole move to squeeze) by the time I next tried to upgrade it. The installer's logs did include some mention it can't find the headers, but just installing/updating the linux-headers package alone didn't fix it... the dkms (and I also needed module-assistant) and m-a prepare were also needed. – timday Oct 11 '17 at 21:36
1

I had a similar setup to the OP. I even tried what @GAD3R suggested at one point.

In the end, I found the solution to be to install the latest version of VirtualBox (5.1.24) and download the guest additions separately from http://download.virtualbox.org/virtualbox/5.1.24/.

  • 1
    I installed newest version of Virtualbox - 5.1.26, and update addons, now it works. Thank you! – Сергей Матийчук Jul 28 '17 at 15:37
  • Glad it helped! – Rai Jul 28 '17 at 17:31
  • Indeed, this issue was fixed in later Additions. – Davor Josipovic Sep 14 '17 at 16:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.