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
  • 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, 2012 at 13:59
  • @foss Thanks for your input, I have updated my question.
    – Paolo
    Jan 25, 2012 at 14:08
  • @MihaiTodor the other question is a possible duplicate of mine, not vice versa as you said. Hint, have a look at the publication date. Regards.
    – Paolo
    Jun 8, 2015 at 21:24
  • Yeah, true. Sorry about that. Jun 8, 2015 at 23:05

14 Answers 14


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
  • This solved the problem for me too. Jan 3, 2013 at 20:15
  • 30
    Use the pacakge linux-headers-generic as it will always point to the latest kernel header package.
    – ortang
    May 29, 2013 at 8:37
  • 3
    updating to the latest VirtualBox is what solved it for me, for Ubuntu 13.10 instalation Oct 17, 2013 at 17:35
  • 7
    This shlould be the accepted answer, you have a server, why bother to install xorg??? install dkms and problem solved!!! Oct 23, 2014 at 0:46
  • 2
    sudo apt-get install --assume-yes build-essential dkms linux-headers-$(uname -r) and sudo ln -s /usr/src/linux-headers-$(uname -r)/include/generated/uapi/linux/version.h /usr/src/linux-headers-$(uname -r)/include/linux/version.h will sure help
    – user417498
    Jan 21, 2016 at 14:04

(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).

  • Correct. Actually, I've already run into "all of the above": missing kernel headers, obsolete kernel headers, missing dkms package and indeed, out-of-date VBox version.
    – youri
    Nov 29, 2014 at 17:28

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.


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.


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.


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.


  • 37
    This does not solve the problem in any way.
    – Sliq
    Aug 19, 2012 at 0:14
  • 11
    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, 2012 at 0:40
  • 3
    @Panique that solved the problem, otherwise I wouldn't have accepted this answer. I'm not an idiot.
    – Paolo
    Nov 28, 2012 at 20:19
  • 5
    The answer by dog should be the accepted answer; installing xorg is unnecessary.
    – Nathan
    Apr 20, 2015 at 15:37
  • 2
    -1 as this answer is misleading.
    – ortang
    Sep 11, 2015 at 16:25

I have tried ALL the above solution and I am pretty sure that I have installed the proper headers but still no luck !!!

root@test:~# dpkg --get-selections | grep linux-headers
linux-headers-4.0.0-kali1-amd64         install
linux-headers-4.0.0-kali1-common        install
linux-headers-amd64             install

And I have also installed latest version of Virtual Box as of today 5.0.4 but still I have the error when trying to install Guest Additions with error

The headers for the current running kernel were not found.

Solution :

In the end what solved my problem is running the VBoxLinuxAdditions.run from /root directory instead of other directory like /home/ !!!

I was originally running VBoxLinuxAdditions.run from /home/ directory and keeps having this dam error but after using command below from root directory, it's fine, problem solved!

cp /media/cd-rom/VBoxLinuxAdditions.run /root/
chmod 755 /root/VBoxLinuxAdditions.run
cd /root

After this you can simply use reboot, then you should have Guest Additional done properly and FULL Screen too ! YAY !!!

  • I tried this but still doesn't work . Hands up
    – yaochiqkl
    Feb 4, 2016 at 3:28
  • does not work for me. Apr 13, 2018 at 12:36

Usually i install the guest-additions directly via virtualbox (mount cdrom, sh ./VBoxLinuxGuestAddtions.run). However, most linux-distributions offer you a package which can be install via your package-manager. For me following command solved the issue:

sudo apt-get install virtualbox-guest-dkms
  • I tried all the other installation solutions and continued to have problems with the add-ins or the installation script. This solution solved the root problem directly. Thank you!
    – sadakatsu
    Apr 26, 2018 at 20:04

I think this error is cause by using an old version of Virtual Box or at least a old version of the Guest Additions ISO image.

I achieved success by downloading a new ISO of the VBox Guest Additions and running the VBoxLinuxAdditions.run script I went here Virtual Box download site and grabbed a new ISO.

For reasons (too dull to go into) I could not update my version of VirtualBox on the (Windows) host, but I could copy the new ISO file to a local place on the file-system.

Then, In the "Devices" menu on the VM window I chose a new virtual CD/DVD and picked the place where I downloaded the new ISO image.

Then inside the Debian VM I went to \media\cdrom and ran the new VBoxLinuxAdditions.run script as root. (I had already installed dkms, current kernel headers etc.) Then the script stopped falsely complaining about the missing headers (they were not missing) and built the kernel objects it needed.

The whole reason for doing this was so that X.org would give me additional display resolutions and I could run the VM at a higher res than the conservatively set defaults.


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

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

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.


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


The only solution that worked for me was removing Virtual Box and installing the latest version from the VirtualBox website (version: 4.3.10 (repo) vs. 4.3.22 (website)).

  1. sudo apt-get install --assume-yes build-essential dkms linux-headers-generic linux-headers-$(uname -r)
  2. sudo ln -s /usr/src/linux-headers-$(uname -r)/include/generated/uapi/linux/version.h /usr/src/linux-headers-$(uname -r)/include/linux/version.h

  1. sudo reboot

+ bonus: shared folders "secret" ;)

  1. sudo gpasswd -a <username> vboxsf
  2. sudo reboot
  3. done.

  4. ???
  5. profit ;)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .