Kernel headers not found Centos 6.7

Discussions related to using VirtualBox on Linux hosts.
Post Reply
gabrielk
Posts: 2
Joined: 16. Nov 2015, 11:44

Kernel headers not found Centos 6.7

Post by gabrielk »

Hello everybody!

I'm new to this forum.

I just wanted to install VirtualBox on a Centos 6.7 machine. However, I encountered the following problems:

Code: Select all

[root@aedb grub]# /etc/init.d/vboxdrv setup
Stopping VirtualBox kernel modules                         [  OK  ]
Uninstalling old VirtualBox DKMS kernel modules            [  OK  ]
Trying to register the VirtualBox kernel modules using DKMSError! echo
Your kernel headers for kernel 2.6.32-042stab094.8 cannot be found at
/lib/modules/2.6.32-042stab094.8/build or /lib/modules/2.6.32-042stab094.8/source.
                                                           [FAILED]
  (Failed, trying without DKMS)
Recompiling VirtualBox kernel modules                      [FAILED]
  (Look at /var/log/vbox-install.log to find out what went wrong)
I've already searched and tried around a little bit - the thread "Kernel headers not found CentOS 6.5" of this forum helped me a bit (I would like to include the link but as it is my first post I can't).

Nevertheless, I'm struggling. The system tells me that I have the following kernel:

Code: Select all

[root@aedb grub]# uname -r
2.6.32-042stab094.8
The kernel-devel and kernel-headers packages, however, seem to belong to another kernel:

Code: Select all

[root@aedb grub]# yum info kernel-headers
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.nextlayer.at
 * epel: mirror.vutbr.cz
 * extras: mirror.nextlayer.at
 * updates: mirror.nextlayer.at
Installed Packages
Name        : kernel-headers
Arch        : x86_64
Version     : 2.6.32
Release     : 573.8.1.el6
Size        : 2.6 M
Repo        : installed
From repo   : updates
Summary     : Header files for the Linux kernel for use by glibc
License     : GPLv2
Description : Kernel-headers includes the C header files that specify the interface
            : between the Linux kernel and userspace libraries and programs.  The
            : header files define structures and constants that are needed for
            : building most standard programs and are also needed for rebuilding the
            : glibc package.

[root@aedb grub]# yum info kernel-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.nextlayer.at
 * epel: mirror.vutbr.cz
 * extras: mirror.nextlayer.at
 * updates: mirror.nextlayer.at
Installed Packages
Name        : kernel-devel
Arch        : x86_64
Version     : 2.6.32
Release     : 573.8.1.el6
Size        : 25 M
Repo        : installed
From repo   : updates
Summary     : Development package for building kernel modules to match the kernel
License     : GPLv2
Description : This package provides kernel headers and makefiles sufficient to build modules
            : against the kernel package.
And now comes the stuff where I'm kind of lost. If I search all my packages for "kernel" I only get the following two:

Code: Select all

[root@aedb grub]# rpm -qa|grep kernel
kernel-devel-2.6.32-573.8.1.el6.x86_64
kernel-headers-2.6.32-573.8.1.el6.x86_64
I don't know - on the one hand the system seems to have a kernel. On the other hand I don't have any package called "kernel" :shock:

Now, if I do "yum install kernel" I get the following:

Code: Select all

[root@aedb grub]# yum install kernel
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: mirror.nextlayer.at
 * epel: mirror.vutbr.cz
 * extras: mirror.nextlayer.at
 * updates: mirror.nextlayer.at
Resolving Dependencies
--> Running transaction check
---> Package kernel.x86_64 0:2.6.32-573.8.1.el6 will be installed
--> Processing Dependency: kernel-firmware >= 2.6.32-573.8.1.el6 for package: kernel-2.6.32-573.8.1.el6.x86_64
--> Processing Dependency: grubby >= 7.0.4-1 for package: kernel-2.6.32-573.8.1.el6.x86_64
--> Processing Dependency: dracut-kernel >= 004-388.el6 for package: kernel-2.6.32-573.8.1.el6.x86_64
--> Processing Dependency: /sbin/new-kernel-pkg for package: kernel-2.6.32-573.8.1.el6.x86_64
--> Processing Dependency: /sbin/new-kernel-pkg for package: kernel-2.6.32-573.8.1.el6.x86_64
--> Running transaction check
---> Package dracut-kernel.noarch 0:004-388.el6 will be installed
--> Processing Dependency: dracut = 004-388.el6 for package: dracut-kernel-004-388.el6.noarch
---> Package grubby.x86_64 0:7.0.15-7.el6 will be installed
---> Package kernel-firmware.noarch 0:2.6.32-573.8.1.el6 will be installed
--> Running transaction check
---> Package dracut.noarch 0:004-388.el6 will be installed
--> Processing Dependency: plymouth >= 0.8.0-0.2009.29.09.19.1 for package: dracut-004-388.el6.noarch
--> Processing Dependency: plymouth-scripts for package: dracut-004-388.el6.noarch
--> Processing Dependency: kbd for package: dracut-004-388.el6.noarch
--> Processing Dependency: dash for package: dracut-004-388.el6.noarch
--> Running transaction check
---> Package dash.x86_64 0:0.5.5.1-4.el6 will be installed
---> Package kbd.x86_64 0:1.15-11.el6 will be installed
--> Processing Dependency: kbd-misc = 1.15-11.el6 for package: kbd-1.15-11.el6.x86_64
---> Package plymouth.x86_64 0:0.8.3-27.el6.centos.1 will be installed
--> Processing Dependency: plymouth-core-libs = 0.8.3-27.el6.centos.1 for package: plymouth-0.8.3-27.el6.centos.1.x86_64
--> Processing Dependency: libply.so.2()(64bit) for package: plymouth-0.8.3-27.el6.centos.1.x86_64
--> Processing Dependency: libply-splash-core.so.2()(64bit) for package: plymouth-0.8.3-27.el6.centos.1.x86_64
---> Package plymouth-scripts.x86_64 0:0.8.3-27.el6.centos.1 will be installed
--> Running transaction check
---> Package kbd-misc.noarch 0:1.15-11.el6 will be installed
---> Package plymouth-core-libs.x86_64 0:0.8.3-27.el6.centos.1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================================================================================
 Package                                                Arch                                       Version                                                   Repository                                   Size
===============================================================================================================================================================================================================
Installing:
 kernel                                                 x86_64                                     2.6.32-573.8.1.el6                                        updates                                      30 M
Installing for dependencies:
 dash                                                   x86_64                                     0.5.5.1-4.el6                                             base                                         74 k
 dracut                                                 noarch                                     004-388.el6                                               base                                        125 k
 dracut-kernel                                          noarch                                     004-388.el6                                               base                                         26 k
 grubby                                                 x86_64                                     7.0.15-7.el6                                              base                                         43 k
 kbd                                                    x86_64                                     1.15-11.el6                                               base                                        264 k
 kbd-misc                                               noarch                                     1.15-11.el6                                               base                                        923 k
 kernel-firmware                                        noarch                                     2.6.32-573.8.1.el6                                        updates                                      18 M
 plymouth                                               x86_64                                     0.8.3-27.el6.centos.1                                     base                                         89 k
 plymouth-core-libs                                     x86_64                                     0.8.3-27.el6.centos.1                                     base                                         88 k
 plymouth-scripts                                       x86_64                                     0.8.3-27.el6.centos.1                                     base                                         31 k

Transaction Summary
===============================================================================================================================================================================================================
Install      11 Package(s)

Total download size: 50 M
Installed size: 163 M
Is this ok [y/N]: n
Exiting on user Command
Your transaction was saved, rerun it with:
 yum load-transaction /tmp/yum_save_tx-2015-11-16-10-27OR2vON.yumtx
As the server has not been set up by myself I'm not quite sure if I can just install the "kernel" package without crashing the whole system. I do also not have physical access to the server which could be another problem - I don't know.

I would be very grateful for any hints or suggestions. Thank you very much!
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Kernel headers not found Centos 6.7

Post by Perryg »

The easiest way to install matching headers is to use the wildcard -$(uname -r).
  • yum install kernel-headers-$(uname -r)
    yum install kernel-devel-$(uname -r)
Notification: This is not actually a VirtualBox issue and only provided as a convenience. You should always check this for accuracy and validity from the OS support people.
Martin
Volunteer
Posts: 2561
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: XP, Win7, Win10, Linux, OS/2

Re: Kernel headers not found Centos 6.7

Post by Martin »

Your main problam started because 2.6.32-042stab094.8 is not a standard Centos kernel.
It looks like your hoster deployed a non standard kernel. This version number appears on Google for OpenVZ / Virtuozzo environments.
gabrielk
Posts: 2
Joined: 16. Nov 2015, 11:44

Re: Kernel headers not found Centos 6.7

Post by gabrielk »

Perryg wrote:The easiest way to install matching headers is to use the wildcard -$(uname -r).
  • yum install kernel-headers-$(uname -r)
    yum install kernel-devel-$(uname -r)
Notification: This is not actually a VirtualBox issue and only provided as a convenience. You should always check this for accuracy and validity from the OS support people.
Thank you Perryg. Unfortunately, that doesn't help.

Thank you Martin - you got the point!

I've also aked in CentOS forum. There I got the answer that the reason for my problem is that my CentOS 6.7 is hosted by OpenVZ - indicated by the kernel version containing "stab". Thus, I'll have to talk to my hoster.

I'll add information once I have resolved the problem.
Post Reply