Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 ./

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!
(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
@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 '15 at 21:24
Yeah, true. Sorry about that. – Mihai Todor Jun 8 '15 at 23:05

12 Answers 12

up vote 10 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 - ""

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.


share|improve this answer
This does not solve the problem in any way. – Sliq Aug 19 '12 at 0:14
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
@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
The answer by dog should be the accepted answer; installing xorg is unnecessary. – Nathan Burgess Apr 20 '15 at 15:37
-1 as this answer is misleading. – ortang Sep 11 '15 at 16:25

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
Use the pacakge linux-headers-generic as it will always point to the latest kernel header package. – ortang May 29 '13 at 8:37
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
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 '14 at 0:46
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 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: (at time of writing, this was 4.2.6 for Debian-based systems).

share|improve this answer
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 '14 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.

share|improve this answer
Installing dkms, reboot, and re-run the install script worked for me. Its also stated in the official doc: – resting Mar 21 '13 at 16:06
newer versions (of virtualbox are available as deb files from here: They also have the guest additions iso. Using the latest of that fixed things for me. – bacon Jan 26 at 22:04
Current official doc link: – Max Feb 12 at 18:23

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

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

share|improve this answer

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 from /root directory instead of other directory like /home/ !!!

I was originally running 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/ /root/
chmod 755 /root/
cd /root

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

share|improve this answer
I tried this but still doesn't work . Hands up – yaochiqkl Feb 4 at 3:28

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!

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:

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 ./
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
  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 ;)
share|improve this answer

Your Answer


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.