linux command "file" shows "for GNU/Linux 2.6.24" linux command "file" shows "for GNU/Linux 2.6.24" linux linux

linux command "file" shows "for GNU/Linux 2.6.24"


The kernel version displayed by file on an executable has nothing to do with the kernel installed on your system. It matches the C library the program was linked with at build time.

Your C compiler targets a specific C library (usually glibc). In turn, the C library targets a kernel API (i.e. the C library is built for a specific kernel). That is the version displayed by file.

You don't have to worry about the mimatch between the kernel version displayed by file and the kernel version installed on your machine.

@REALFREE: you can try the following experiment. Maybe it willhelp you get a grasp of what's going on:

$ uname -r3.10-2-amd64$ gcc -Wall -Werror hello.c -o hello$ readelf --notes ./helloDisplaying notes found at file offset 0x0000021c with length 0x00000020:  Owner                 Data size       Description  GNU                  0x00000010       NT_GNU_ABI_TAG (ABI version tag)    OS: Linux, ABI: 2.6.32

The information about the ABI tag is contained in an elfsegment called NOTE. This information is written by the linkerwhen the program is compiled. It matches the ABI tag of the C library.

$ ldd ./hello        linux-vdso.so.1 (0x00007fffd31fe000)        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f5f1a465000)        /lib64/ld-linux-x86-64.so.2 (0x00007f5f1a827000)$ readelf --notes /lib/x86_64-linux-gnu/libc.so.6Displaying notes found at file offset 0x00000294 with length 0x00000020:  Propriétaire        Taille des données        Description  GNU                  0x00000010       NT_GNU_ABI_TAG (étiquette de version ABI)    OS: Linux, ABI: 2.6.32

In order to build the C library, you have to select a kernelversion. Here, the C library was compiled for a 2.6.32 kernel butit also works with more recent kernels. However, if the programis run on a kernel older than 2.6.32, a kernel too old warningis displayed.


That version number refers to the kernel headers from which the glibc C library was built on the host that the compiler was run on. Broadly, it shows the level of kernel that the executable will be expected to support.