Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RHEL: This system is currently not set up to build kernel modules

I am trying to install virtualbox5.2 on a RHEL 7 VM When I try to rebuild kernels modules I get the following error:

[root@myserver~]# /usr/lib/virtualbox/vboxdrv.sh setup
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
This system is currently not set up to build kernel modules.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
    kernel-devel kernel-devel-3.10.0-693.11.1.el7.x86_64

I tried install kernet-devel and got success message

Installed:
  kernel-devel.x86_64 0:3.10.0-693.21.1.el7                                     

Complete!

But still the setup fails.

Any idea what is missing here?

like image 938
codec Avatar asked Mar 19 '18 17:03

codec


2 Answers

sudo yum install -y "kernel-devel-$(uname -r)"

Substitute dnf on Fedora. I didn't need to do a reboot, but ymmv.

Edit for 2020:

Centos/RHEL 8 now also use dnf instead of yum. I haven't had occasion to test this on those distros, so the same YMMV disclaimer still applies.

like image 84
pyansharp Avatar answered Oct 21 '22 05:10

pyansharp


First run in terminal: uname -r then you will get name and information about current kernel (CURRENT_KERNEL).

Now you can install with command: yum install kernel-devel-CURRENT_KERNEL

Note: replace CURRENT_KERNEL with string you get from uname -r.

like image 44
Milan Rakos Avatar answered Oct 21 '22 05:10

Milan Rakos