VirtualBox Guest Additions on Debian 7.1: the Linux Headers


A recurring issue I have when creating new Linux VMs under VirtualBox is to make the Guest Additions to work.

Some dependencies are straighforward:

# apt-get install build-essential module-assistant

But then, there is the linux-headers dependency:

# apt-get install linux-headers
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package linux-headers is a virtual package provided by:
  linux-headers-3.2.0-4-rt-amd64 3.2.46-1+deb7u1
  linux-headers-3.2.0-4-amd64 3.2.46-1+deb7u1
  linux-headers-rt-amd64 3.2+46
  linux-headers-amd64 3.2+46
You should explicitly select one to install.

E: Package 'linux-headers' has no installation candidate

How to find out which one? uname for the rescue:

# uname -a
Linux debian-xxxx 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1+deb7u1 x86_64 GNU/Linux

In my case 3.2.0-4-amd64, just append it to my last apt-get command:

# apt-get install linux-headers-3.2.0-4-amd64

Now installing the Guest Additions should work:

# cd /media/cdrom
# sh

Good luck!

Current rating: 5