1

I use apt when downloading packages from Ubuntu repositories. How can I check which kernel version was used when building package?
When it is important (kernel version of the build server vs. kernel version of the machine where package is installed)?

  • 1
    Why do you want to know? I can't think of a case where that could be relevant in any way. The compiler version, the versions of headers and libraries used for linking are relevant. But not the compiler version, or the hardware, or the age of the person who started the compilation command. – Gilles 'SO- stop being evil' May 12 '15 at 22:56
3

It's almost never important. If you're truly worried about the build system, you should consider the compiler, library and header versions before considering the kernel.

It is up to the code itself as to whether it 'remembers' the kernel version. Some packages store a string representing the compiler version, as this is far more important. In fact the kernel itself does this (see the contents of /proc/version).

  • What about graphics drivers (kernel build vs run environment) ? – Irbis May 12 '15 at 8:11
  • @Irbis the name of the kernel is encoded in the name of the kernel module if the graphics driver uses a kernel module. – Faheem Mitha May 12 '15 at 8:14
  • So when graphics driver uses a kernel module there is compatibility relation between them. – Irbis May 12 '15 at 12:19
  • @Irbis Correct, the only time this is really relevant is when you are dealing with kernel loadable modules. Otherwise this just doesn't matter. – Benjamin Leinweber May 13 '15 at 13:59
1

I will not add anything about importance or not of knowing that kernel version since the comments and the answer above is fully explained.

But as an answer for your comment in the answer above

What about graphics drivers (kernel build vs run environment) ?

What you must care is the gcc version that the kernel was compiled with so that you have to use same version with respect to your graphic drivers(Nvidia specially).

You need tocat the /proc/version file. This file identifies the kernel version that is currently running and gcc version used to build the kernel.

$ cat /proc/version
Linux version 3.2.0-23-generic (buildd@crested) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu4) ) #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012

So as example start building NVIDIA module using gcc-4.6:

$ export CC=/usr/bin/gcc-4.6
$ bash NVIDIA-Linux-***.run

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.