37

When ever i try to install GCC on my linux (centos) It comes back with missing

glibc-headers-2.5-58.el5_6.4.x86_64 from updates has depsolving problems --> Missing Dependency: kernel-headers is needed by package glibc-headers-2.5- 58.el5_6.4.x86_64 (updates) glibc-headers-2.5-58.el5_6.4.x86_64 from updates has depsolving problems -->

Missing Dependency: kernel-headers >= 2.2.1 is needed by package glibc-headers-2.5- 58.el5_6.4.x86_64 (updates)

Error: Missing Dependency: kernel-headers >= 2.2.1 is needed by package glibc-headers-2.5-58.el5_6.4.x86_64 (updates)

Error: Missing Dependency: kernel-headers is needed by package glibc-headers-2.5-58.el5_6.4.x86_64 (updates)


I try yum install kernel-header & kernel-devel but get back:

No package kernel-headers available.

Any suggestions?

Andrew Beals
  • 1,177
  • 8
  • 18
Stewart Dick
  • 381
  • 1
  • 3
  • 6

6 Answers6

107

Your system is probably configured to exclude the kernel packages.

try:

sudo vi /etc/yum.conf

then comment (or remove the 'kernel*' part):

#exclude=kernel*

Then you should be able to do:

sudo yum install kernel-headers

Edit: Or, as pointed by Andrew Beals, you can simply run:

yum install kernel-headers --disableexcludes=all
Community
  • 1
  • 1
xgMz
  • 3,334
  • 2
  • 30
  • 23
  • 5
    This pointed to the real problem for me. IT team excluded the kernel-headers to prevent automatic kernel updates in part of their roll out process. – Guerry Jan 19 '12 at 21:31
  • 1
    I'm voting this answer up since it put me on the right track. A comment in /etc/yum.conf referenced repo definition files and in one of those (/etc/yum.repos.d/reponame.repo) I found this exclusion. Thanks – phatblat Feb 02 '12 at 20:52
  • I found the offending references in some files in /etc/yum.repos.d/ . – runako Dec 14 '12 at 00:52
  • Thanks xgMz, just in case, FWIW, it helps to check this in as a deployment strategy / ansible task - do "sed -i 's/exclude/#exclude/g' /etc/yum.conf" nevertheless all credit xgMz saviour! – khanna Sep 11 '19 at 09:33
17

Yes, you could edit the yum.conf file, or you could simply do this:

yum install kernel-headers --disableexcludes=all

Do note that even if your admin is trying to install an excluded package from your RHN Satellite server via the normal process, it will still fail due to the local configuration.

(This holds for RHEL6 / cent6 (centos6) as well, of course.)

Andrew Beals
  • 1,177
  • 8
  • 18
  • 2
    +1: This is a better answer than editing `yum.conf` when you are installing a single package to fit a dependency, and want the previous exclusion rules to continue to apply for future `yum` commands. This is common on paravirtualized environments where kernel updates are disabled because that would break the system, since it is using a special kernel. Temporarily disabling this exclusion to get `kernel-headers` to satisfy the `gcc` dependency is harmless. – Warren Young Oct 31 '13 at 00:57
4

I ran into this issue trying to install VMWare Tools. It required gcc and kernel headers -> kernel headers were missing.

So on Redhat 7.4 I had to execute 'yum install kernel-devel'.

Benjamin Castor
  • 234
  • 3
  • 9
1

try

yum search kernel-headers

gives:

arm-gp2x-linux-kernel-headers.noarch : Kernel headers for Cross Compiling to
                                     : arm-gp2x-linux
kernel-headers.x86_64 : Header files for the Linux kernel for use by glibc
Will
  • 871
  • 6
  • 16
  • 1
    That Returns Warning: No matches found for: kernel-headers No Matches found – Stewart Dick Jun 29 '11 at 13:14
  • 2
    If the problem was the yum.conf file as you indicated in a follow-on comment, why did you mark this answer as correct instead of xgMz's answer below? – Guerry Jan 19 '12 at 21:30
0

If you installed from Cloudlinux ISO, you can't do anything until you activate your server against a license, it will throw above error on a VPS.

0

I had the same issue. It seems that I need to install the kernel-devel-xx.rpm (from kernel development package) to my custom kernel:

sudo yum install kernel-devel-xx.rpm

Then you should be able to run:

sudo yum install kernel-devel