what is the linux-kernel-devel equivalent in 12.04.2 LTS 3.5.0?

Solution 1:

Executive Summary

You probably want to install the package called linux-headers-generic.

If running uname -r gives you something other than generic after the version number, substitute that for generic in linux-headers-generic. (This might be server or generic-pae on some installations of some Ubuntu releases, and there are a few other occasional kernel "flavors.")

Since you most likely needs this so that you can build a driver (which might be automated, you might not be "building it yourself"), it's a good idea to install build-essential too to make it so you'll probably have all the necessary tools.

Full Explanation

To the best of my knowledge, no operating system has a package called Linux-kernel-devel. This is for two reasons:

  • Package names starting with capital letters are extremely rare, for any Unix-like OS.
  • GNU/Linux operating systems typically name their kernel-related packages so that the names contain the word kernel or the word linux, but not both. (On Ubuntu, it's the word linux.)

It's common for kernel-related packages on systems that use the Red Hat Package Manager (rpm) and related utilities to have kernel in the name of their packages. For example, Mageia has a number of packages whose names start with kernel and end in devel. These packages almost always (on Mageia and any OS that has them) provide the header files needed to build drivers from source for use with the kernel. They may also provide related utilities to facilitate. These packages:

  • do not provide the full source code of the kernel. That's provided by other packages.
  • do not provide a pre-compiled, usable kernel. That's provided by other packages.
  • do not provide a compiler or most other purpose build tools. Those, too, are provided by other packages.

In Ubuntu, as can be seen in the list here, the packages that provide kernel headers have names that start with linux-headers. Usually the correct package to install is linux-headers-generic. However, to be sure of what package to install to get headers that correspond to your currently running kernel, run:

uname -r

You'll get output that looks something like:

3.5.0-36-generic

That is, you'll have a version number (which will include . characters and usually at least one -), followed by a -, followed by one or more words indicating which kind of kernel you are running.

If you just want the headers for the specific version you happen to be running now, you could install the package whose name is linux-headers-* where * is replaced by the full output of uname -r. For example, on my system, I could run:

sudo apt-get update && sudo apt-get install linux-headers-3.5.0-36-generic

I could even automate it:

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

These approaches are equivalent, but they are not usually the best way to go.

Instead, you usually will want to install the metapackage that always provides the newest kernel headers as an update (by perpetually depending on whatever header package is newest). This parallels the way your compiled, running kernel is installed and gets updated. To do that, look just at the part of uname -r's output after the version number. That is, if uname -r gives you 3.5.0-36-generic, take just the generic part.

Then install the package called linux-headers-* where * is replaced by that part. So, on my system, it would be linux-headers-generic and one way I could install it would be to run:

sudo apt-get update && sudo apt-get install linux-headers-generic

For most people it is linux-headers-generic, but depending on what Ubuntu release you're running, what architecture and type of device you're running it on, and how it is installed and configured, other possibilities include generic-pae, highbank, omap, server, and virtual.

Related Packages

Header files facilitate developing and compiling/building software that uses facilities provided by the software whose header files are being used. The most common reason you might need kernel headers is if you are going to build a driver (a kernel module) from source code. Some applications, like VMware and VirtualBox, will sometimes require this, and will automate the build themselves.

In addition to header files, to build software a compiler and other tools are needed. To maximize the likelihood that you have the necessary tools, it's a good idea to install the build-essential package also.

It's uncommon for anyone to need the actual full kernel source code (unless, of course, you're planning on building your kernel from source). But if you do need that, you'll have to install another package too. In Ubuntu the package for full kernel source code is called linux-source. (This is in keeping with the Debian/Ubuntu convention of naming packages that provide substantive parts of the Linux kernel linux rather than kernel.)

If You Still Have Trouble

If you try to install any of these packages but experience problems, and you want help, then you will have to include the complete and exact text from the Terminal, including the lines where you typed commands. The best way to provide this is by editing your question, but if it is too long, you can paste it somewhere like http://paste.ubuntu.com and provide us with the URL where we can access it.

If you comment on this question, I'll be notified. You can edit your question and also comment here to call attention to the information you've provided in your question. (Important information is best kept in questions and answers.) Good luck!