Issue
I'm using yum as a package manager since I'm on Centos. I'm working with kernel header and devel packages, and noticed some peculiar behavior that I haven't been able to find information out via googling:
Currently I have headers and devel packages installed for the current kernel, however whenever I execute a yum command to install these locally (I have the RPM's), I get differing behavior:
(note: I'm working on automating the installation, so I'm aware that doing this on my current environment is worthless. I'm just looking for some understanding of this inconsistency)
[root@host mydir]# rpm -qa | grep kernel
kernel-headers-2.6.32-573.7.1.el6.x86_64
kernel-2.6.32-504.el6.x86_64
kernel-2.6.32-573.7.1.el6.x86_64
kernel-devel-2.6.32-573.7.1.el6.x86_64
libreport-plugin-kerneloops-2.0.9-25.el6.centos.x86_64
kernel-2.6.32-573.3.1.el6.x86_64
kernel-firmware-2.6.32-573.22.1.el6.noarch
abrt-addon-kerneloops-2.0.8-34.el6.centos.x86_64
dracut-kernel-004-388.el6.noarch
The two packages in question are installed (devel and headers for kernel-2.6.32-573.7.1.el6.x86_64
[root@host mydir]# ver=`uname -r`
Attempt to install headers:
[root@host mydir]# yum install kernel-header-${ver}
Loaded plugins: fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
Nopackage kernel-header-2.6.32-573.7.1.el6.x86_64 available.
Error: Nothing to do
[root@host mydir]# echo $?
1
Exits with an error, however when I try the same thing for the devel package...
[root@host mydir]# yum install kernel-devel-${ver}
Loaded plugins: fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
Nothing to do
[root@host mydir]# echo $?
0
Solution
Simple : No old packages are available with yum. The only available "kernel-headers package" is the latest CentOS 6.8 update = kernel-headers-2.6.32-642.1.1.el6
Besides that, the kernel-headers ( /usr/include/* ) do not really have to follow the kernel version : They are meant for building applications. The two packages which must have a match are kernel, kernel-devel.
Updates http://mirror.centos.org/centos/6.8/updates/
Release http://mirror.centos.org/centos/6.8/os/
Answered By - Knud Larsen Answer Checked By - David Marino (WPSolving Volunteer)