Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm trying to install the Guest Additions in VirtualBox 4.04. Host OS is Ubuntu desktop 11.04 64bit, guest OS is Ubuntu server 11.10 64bit.

$ sudo ./VBoxLinuxAdditions.run

After some output this line is printed:

The headers for the current running kernel were not found.

But the headers are installed, at least accordingly to dpkg:

$ dpkg --get-selections | grep linux-headers
linux-headers-3.0.0-12            install
linux-headers-3.0.0-12-server     install
linux-headers-server              install

The running kernel is:

$ uname -a
Linux foobar 3.0.0-12-server #20-Ubuntu SMP Fri Oct 7 16:36:30 UTC 2011 x86_64 x86_64 X86_64 GNU/Linux

How do I fix things so that Guest Additions installer is able to find kernel headers?

Update: added full output.

The headers for the current running kernel were not found. If the 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)
Installing the Window System drivers ...fails!
(Could not find the X.Org or XFree86 Window System).

I don't care for fail #2, because that's a server and I don't need X server. But I need shared folder support.

Some further detail:

$ tail /val/log/vboxadd-install.log
..........
cc1: some warnings being treated as errors
make[2]: *** [/tmp/vbox.0/vfsmod.o] Error 1
make[1]: *** [_module_/tmp/vbox.0] Error 2
make: *** [vboxsf] Error 2
share|improve this question
    
This is a standard output for Vboxguest additions - are there any other errors indicating that the vbox kernel modules were not correctly compiled? –  fossfreedom Jan 25 '12 at 13:59
    
@foss Thanks for your input, I have updated my question. –  Paolo Jan 25 '12 at 14:08

9 Answers 9

up vote 11 down vote accepted

To get a VirtualBox ubuntu server guest to correctly accept a guest-additions install you will need to have a minimal xorg package install:

sudo apt-get install xserver-xorg xserver-xorg-core

By doing this, you will have the shared-folder support.

As you have found, the guest additions is one very large script - "VBoxLinuxAdditions.run"

You may be able to unpick this file - I wouldnt recommend it, because as newer versions of virtualbox is released, the version of guest-additions is usually bumped as well.

In addition, I would recommend (if you haven't already), install dkms. When newer ubuntu kernels are updated, the guest-additions kernel modules will be automatically compiled. Without dkms you will lose your shared-folder support when a kernel update is made.

source

share|improve this answer
7  
This does not solve the problem in any way. –  Sliq Aug 19 '12 at 0:14
3  
I strongly recommend against installing these packages. They will bloat your server install and do not solve the problem. You won't get an error message about X11 any more but that's about the only benefit. –  dwurf Nov 14 '12 at 0:40
1  
@Panique that solved the problem, otherwise I wouldn't have accepted this answer. I'm not an idiot. –  Paolo Nov 28 '12 at 20:19
    
@Guandalino - it's most likely that the xserver-xorg package installed additional packages that were the ones you need. It's like using a chainsaw to cut a blade of grass - it works, just a bit overkill :) –  Martin Konecny Jul 14 at 16:24

The message is misleading.

In my case it was actually missing dkms so before you install the addition run

sudo apt-get install build-essential linux-headers-`uname -r` dkms
share|improve this answer
    
This solved the problem for me too. –  Nick Retallack Jan 3 '13 at 20:15
11  
Use the pacakge linux-headers-generic as it will always point to the latest kernel header package. –  ortang May 29 '13 at 8:37
1  
updating to the latest VirtualBox is what solved it for me, for Ubuntu 13.10 instalation –  Răzvan Panda Oct 17 '13 at 17:35
1  
This shlould be the accepted answer, you have a server, why bother to install xorg??? install dkms and problem solved!!! –  Frederic Yesid Peña Sánchez Oct 23 at 0:46

I fixed this error by installing dkms and upgrading my version of VirtualBox. Turns out old versions of the VirtualBox guest additions often won't work with the latest kernels.

share|improve this answer
3  
Installing dkms, reboot, and re-run the install script worked for me. Its also stated in the official doc: virtualbox.org/manual/ch04.html#idp11274368 –  resting Mar 21 '13 at 16:06

(Even though this question has an accepted answer, I'm adding this answer in case it helps somebody else out...)

Although I had identical symptoms, I tried out every suggestion to this question, and yet nothing worked. I finally found this thread suggesting it's the VirtualBox version not being up to date with the Linux kernel version.

So, if nothing works for you, try installing the latest version from: http://download.virtualbox.org/virtualbox/ (at time of writing, this was 4.2.6 for Debian-based systems).

share|improve this answer

The answer about you needing X to use guest additions is just ridiculus. The reason it works after installing X is that it pulls libglib as a dependency, but it would be really unnesessary to install the entire X server just to get the additions running.

All the packages you need are the following:

  • build-essential
  • linux-headers-`uname-r`
  • libglib2.0-0

Obviously it's only part of build-essential and libglib that you need, but rather than investigating exactly which packages are necessary it's easier to just let them pull their dependencies.

A sidenote is that these are exactly the same packages that you need for the vmware equivalent "VMware Tools" on a vmware machine.

share|improve this answer

After installing the suggested packages with the following command:

sudo apt-get install build-essential linux-headers-`uname -r` dkms

I upgraded my version of VirtualBox as suggested by dwurf. That fixed it for me.

share|improve this answer

I was getting the same errors as OP when trying to compile the VirtualBox Guest Additions v4.1.12 in various flavours of K/Ubuntu 13.04 guests.

Building the shared folder support module ...fail!

This is due to bugs (or unmet expectations) of the VirtualBox Guest Additions against various parts of the linux source (in the GUEST). Unfortunately Oracle chooses to link the VirtualBox Host version very closely to the VirtualBox Guest Additions version, so if there's a bug in the Guest Additions then you have to upgrade the Host at the same time.

I had the following virtualbox versions installed on the Ubuntu 12.04 LTS host:

virtualbox       4.1.12-dfsg-2ubuntu0.3
virtualbox-dkms  4.1.12-dfsg-2ubuntu0.3
virtualbox-qt    4.1.12-dfsg-2ubuntu0.3

As per instructions at: http://www.ubuntuupdates.org/ppa/virtualbox?dist=precise

I upgraded to 4.2.10-dfsg-0ubuntu2~ubuntu12.04.1~ppa1 using:

sudo add-apt-repository ppa:debfx/virtualbox
sudo apt-get update
sudo apt-get install virtualbox virtualbox-dkms virtualbox-qt
cd ~/.VirtualBox
http://download.virtualbox.org/virtualbox/4.2.10/VBoxGuestAdditions_4.2.10.iso

Now the K/Ubuntu 13.04 guests can build and install their VirtualBox Guest Additions:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install make gcc build-essential linux-headers-`uname -r` dkms
cd /media/VBOXADDITIONS_4.2.10_81404
sudo ./VBoxLinuxAdditions.run
sudo shutdown -r 0
share|improve this answer

I think that you are missing something. Try to install

  • linux-headers-3.14-kali1-common
  • linux-headers-3.14-kali1-amd64
  • linux-source-3.14
  • libdw1
  • libunwind7

For me is kali linux with 3.14

Best Regards.

share|improve this answer

I was experiencing this problem and fixed it by running these commands:

sudo apt-get remove dkms build-essential linux-headers-*
sudo apt-get install dkms build-essential linux-headers-$(uname -r)

More Info

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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