How do I install linux headers when I am getting a "has no installation candidate" error

Primary Problem

I am unable to run any virtualization software. Namely Vmware or Virtualbox. Since both of them asks me to install (or produces some error which pints to ) installing build essentials and latest linux headers.

So my problem starts with the following problem

When I try to update using

sudo apt-get install linux-headers-`uname -r`

What I get is

Reading package lists... Done Building dependency tree
Reading state information... Done Package linux-headers-3.13.0-45-generic is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source

E: Package 'linux-headers-3.13.0-45-generic' has no installation candidate

Header mismatch

When I try to determine what I have by running

apt-cache search linux-headers-

I get

Avalibale headers

I have tried most of the things that I could find in Google and nothing quite helped. Hence hoped to find some solution here.


Solution 1:

13.13 seems to be an old kernel from trusty? Whereas 3.16 is the kernel shipped with utopic.

If you ran do-release-upgrade lately, and you still use the old kernel be advised that all your old repositories ( where the old kernel headers reside) are disabled/cleaned from /etc/apt.

Usually doing a release upgrade bumps the kernel minor by at least 2 versions ( from 3.13 to 3.16, and with vivi to 3.18).

You have 2 options at this point. Either go with the new kernel, and install the headers for that, and then rebuild missing drivers, or readd the repository list to apt from the old ubuntu distro, and install the missing headers.