sudo yum install kernel-devel-$(uname -r) kernel-headers-$(uname -r)

General support questions
Post Reply
chankim
Posts: 35
Joined: 2015/07/15 12:05:39

sudo yum install kernel-devel-$(uname -r) kernel-headers-$(uname -r)

Post by chankim » 2018/05/07 14:23:30

I am using centos 6.9 and uname -r shows
2.6.32-573.12.1.el6.x86_64
but I found my installed kernel headers are newer (2.6.32.696).
Then NVIDIA CUDA installation requires the same kernel header as the actual kernel,
so uninstalled the kernel header and tried to install the right kernel as told by the manual,
sudo yum install kernel-devel-$(uname -r) kernel-headers-$(uname -r)
But yum says
No package kernel-headers-2.6.32-573.12.1.el6.x86_64 available.
what is the correct proceduer to install the kernel for 2.6.32-573.12.1.el6.x86_64 ?

User avatar
TrevorH
Forum Moderator
Posts: 23213
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: sudo yum install kernel-devel-$(uname -r) kernel-headers-$(uname -r)

Post by TrevorH » 2018/05/07 14:37:29

Don't install that ancient kernel-devel package. What you should do is reboot into the latest kernel so that uname -r shows 2.6.32-696.23.1.el6.x86_64 and then install the matching kernel-devel package for that. 2.6.32-573 is not a 6.,9 kernel, it's from 6.7 and should not be used.
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

chankim
Posts: 35
Joined: 2015/07/15 12:05:39

Re: sudo yum install kernel-devel-$(uname -r) kernel-headers-$(uname -r)

Post by chankim » 2018/05/07 18:33:19

Hi, thanks,
I rebooted the computer but uname -r still shows
2.6.32-573.12.1.el6.x86_64
and 'cat /etc/centos-release' shows
CentOS release 6.9 (Final)

I soon remembered I have upgraded to 6.9 from 6.7 and blocked the first entry in grub.conf.
This is the current /boot/grub/grub.conf.
#title CentOS (2.6.32-696.23.1.el6.x86_64)
# root (hd0,2)
# kernel /boot/tboot.gz logging=vga,serial,memory
# module /boot/vmlinuz-2.6.32-696.23.1.el6.x86_64 ro root=UUID=b4c939f1-8d9f-45ad-b8db-ddfe4206afef intel_iommu=on rd_NO_LUKS LANG=ko_KR.UTF-8 rd_NO_MD crashkernel=128M KEYBOARDTYPE=pc KEYTABLE=us rd_NO_LVM rd_NO_DM rhgb quiet nouveau.modeset=0 rd.driver.blacklist=nouveau video=vesa:off vga=normal rdblacklist=nouveau
title CentOS (2.6.32-573.12.1.el6.x86_64)
root (hd0,2)
kernel /boot/tboot.gz logging=vga,serial,memory
module /boot/vmlinuz-2.6.32-573.12.1.el6.x86_64 ro root=UUID=b4c939f1-8d9f-45ad-b8db-ddfe4206afef intel_iommu=on rd_NO_LUKS LANG=ko_KR.UTF-8 rd_NO_MD crashkernel=128M KEYBOARDTYPE=pc KEYTABLE=us rd_NO_LVM rd_NO_DM rhgb quiet rd.driver.blacklist=nouveau video=vesa:off vga=normal nouveau.modeset=0 rdblacklist=nouveau
module /boot/initramfs-2.6.32-573.12.1.el6.x86_64.img
So I uncomment the first grub entry(real Centos6.9) and rebooted, but cannot connect to my machine :)
I reallize the reason the first grub entry didn't boot correct was maybe the entry corresponding to the
module /boot/initramfs-2.6.32-573.12.1.el6.x86_64.img
was missing. I don't remember if there was the initramfs file for 2.6.342.696 and will see it at work after booting with second entry.
What should I do if there is no initramfs file for 2.6.342.696?
(using console, I'm at home and can't use the console)

ADD : I found this post https://bugzilla.redhat.com/show_bug.cgi?id=1484430
it says if I run 'yum update kernel', the initramfs file is generated. Yes, I remember last time I did 'yum update -y' centos 6.7 was updated to 6.9 but the initramfs file was not generated, that's why I blocked the first grub entry. Now, I can only boot with the second entry, then, how can I upgrated to 6.9? run 'yum update -y' and run separate 'yum update kernel'? (while in centos 6.7?, in mycase seemingly in 6.9 but actually in 6.7).
Of course I will look into /boot/grub2 to see if the intramfs file is there when I'm at work in the morning.

chankim
Posts: 35
Joined: 2015/07/15 12:05:39

Re: sudo yum install kernel-devel-$(uname -r) kernel-headers-$(uname -r)

Post by chankim » 2018/05/08 00:27:01

after booting using 2.6.32-573.12.1 (CentOS 6.7),
I looked for intramfs--2.6.32-696.23.1.el6.x86_64.img under /boot directory but it was not there.
I tried yum update kernel but it is not generated.

with a search, I found https://www.centos.org/forums/viewtopic.php?t=51911 and did
sudo dracut /boot/initramfs-2.6.32-696.23.1.el6.x86_64.img 2.6.32-696.23.1.el6.x86_64
and I now see initramfs-2.6.32-696.23.1.el6.x86_64.img under /boot.
But during the generation, I saw
egrep: /lib/modules/2.6.32-696.23.1.el6.x86_64//weak-updates/nvidia.ko: No such file or directory

I started the boot with the first grub entry and voila! it boots ok! The centos-release and uname-r matches now.

But still I see a problem.
I can use vnc again, but in the console, the boot process didn't go through and doesn't show the login in window.
(it used to go through before this work one or two days ago)

I reinstalled gcc, gcc-c++ and made symbolic link cuda to point cuda-7.5 under /usr/local/ (I don't know why it was removed)
and now can build a pgogram again using cuda and can execute it.

ADD : I later found the boot process stops after 'starting certmonger [OK]' so I went to /etc/X11 and found there is no xorg.conf file.
So I just copied a backed up file to xorg.conf and the boot process goes to the login window.
hope this can be of help to someone.
Last edited by chankim on 2018/05/09 05:50:24, edited 2 times in total.

User avatar
TrevorH
Forum Moderator
Posts: 23213
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: sudo yum install kernel-devel-$(uname -r) kernel-headers-$(uname -r)

Post by TrevorH » 2018/05/08 15:28:32

What does ls -la /etc/grub.cfg say? It should be a symlink to ../boot/grub/grub.conf.

If it is not then your /boot/grub/grub.conf will be out of date and the correct file will be /etc/grub.cfg. In that case you should copy /etc/grub.cfg to /boot/grub/grub.conf, remove /etc/grub.cfg and recreate it as a symlink to ../boot/grub/grub.conf
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

User avatar
jlehtone
Posts: 1959
Joined: 2007/12/11 08:17:33
Location: Finland

Re: sudo yum install kernel-devel-$(uname -r) kernel-headers-$(uname -r)

Post by jlehtone » 2018/05/08 19:44:09

TrevorH wrote:What does ls -la /etc/grub.cfg say? It should be a symlink to ../boot/grub/grub.conf.
Unless the system has EFI and GPT. Then the symlink's name is different (IMHO makes no sense) and points to another location.

yum update kernel
won't generate new initramfs if there is no new kernel to install. One can uninstall kernel versions that are not in use / don't function. Then there is something to install.

/etc/X11 does not need to have an xorg.conf -file. There is none by default. Installing NVidia driver RPM from ElRepo repository does add a minimal one. It just dictates to use X11 driver 'nvidia' instead of the system default (nouveau).

Installing CUDA RPM from NVidia's repository with yum should pull necessary dependencies. IIRC, you just need path/ld-path to see the CUDA; the RPM does not use "default locations". (Possibly to allow multiversioning, similarly to Software Collections / environment-modules ideology).

User avatar
TrevorH
Forum Moderator
Posts: 23213
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: sudo yum install kernel-devel-$(uname -r) kernel-headers-$(uname -r)

Post by TrevorH » 2018/05/08 19:45:36

Unless the system has EFI and GPT. Then the symlink's name is different (IMHO makes no sense) and points to another location.
That's true on CentOS 7 with grub2 but CentOS 6 has only limited (i.e. almost none) UEFI support and I am not sure if the same is true.
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

chankim
Posts: 35
Joined: 2015/07/15 12:05:39

Re: sudo yum install kernel-devel-$(uname -r) kernel-headers-$(uname -r)

Post by chankim » 2018/05/09 06:04:03

oh, the /etc/grub.conf was a symbolic link to /boot/grub/grub.conf all the time.
and yes, the /etc/X11/xorg.conf was generated by NVIDIA driver install.(it is written in the file)
I don't know why xorg.conf had been removed.

just for information for somebody later,
I initially thought higher version of clang is provided by llvm-devtoolset-7 and I thought I needed centos 7.0,
but later found otherwise,
and I have built clang 3.9 and almost built UnrealEngine 4.18 and CARLA simulator.(on Centos 6.9).
for building clang 3.9 I followed https://www.vultr.com/docs/how-to-insta ... n-centos-6.
I built gcc 5.1.0 during the processes (under /usr/local/)
and I also built mono 5.1.0 that was needed to build UnrealEngine following https://gist.github.com/andreazevedo/9479518.

Post Reply