Tell me more ×
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. – Guandalino Jan 25 '12 at 14:08

6 Answers

up vote 6 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
2  
This does not solve the problem in any way. – Panique Aug 19 '12 at 0:14
2  
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. – Guandalino Nov 28 '12 at 20:19

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 at 20:15

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
1  
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 at 16:06

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:

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

(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

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.