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

9

11

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?

Fosterling answered 19/3, 2018 at 17:33 Comment(2)
For anyone having the same issue on a Debian-based distro, install missing packages with: sudo apt-get install -y linux-headers-amd64 linux-headers-$(uname -r)Jaggers
There is a guide for RHEL (I haven't tested for RHEL) that I successfully verified for Fedora 34.Gitt
A
16

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.

Adventuresome answered 29/7, 2018 at 17:11 Comment(0)
B
13

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.

Becerra answered 4/6, 2018 at 21:22 Comment(0)
M
3

The same message happened when I tried to upgrade VirtualBox 5.2.12 Guest Additions on my Kali Linux (GNU/Linux Rolling version). I fixed it by following steps:

  1. Do apt update/upgrade to keep your system up-to-date. Do not forget to reboot the system.
  2. Run "apt-get install linux-headers-$(uname -r)".
  3. Run VBoxLinuxAdditions.run from terminal, error message gone and Guest Additions will be installed successfully.
  4. Reboot system, Guest Additions works fine.
Marxism answered 22/6, 2018 at 2:9 Comment(0)
B
2

I got here looking for the same answer for CentOS 6, and the above answers worked with slight modification (so, for anyone else that lands here too)...

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

So, "yum" instead of "apt-get" Also, some Linux use "linux-headers" instead of "kernel-devel" but the principle seems to be the same.

Bimah answered 17/10, 2018 at 17:51 Comment(0)
O
2

The kernel your were using was kernel-devel-3.10.0-693.11.1.el7.x86_64 is slightly different with the one that you installed kernel-devel.x86_64 0:3.10.0-693.21.1.el7 . In my case, there are several different version installed on my OS, and "sudo yum install kernel-devel" always install the newest one for me. Then I work it out by setting my default kernel version as same as yum installed for me. You can check the kernel you have installed on your OS by following command:

sudo awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg

Then just set the kernel version you choose to use as same as yum choose for you,by following command:(notice that the number at last is pick up from preceding command result),

sudo grub2-set-default 0

generate the grub2 config with 'gurb2-mkconfig' command, and then reboot the server.

sudo grub2-mkconfig -o /boot/grub2/grub.cfg
sudo reboot
Organometallic answered 8/4, 2019 at 11:30 Comment(0)
I
1

Milan Rakos is right. Your installed kernel-devel must have suffix string exactly the same as the uname -r output. Besides, the logs during the vboxdrv.sh setup also shows the wanted version of the kernel-devel.

So to your case, You will run the command:sudo yum install kernel-devel-3.10.0-693.11.1.el7.x86_64

Irrelevancy answered 26/7, 2018 at 7:42 Comment(0)
C
1

to solve this problem I ran yum update -y. I think this is the fastest way to solve it. Another solution is to configure the repos with the installation DVD, so you can install the kernel-headers of your current version of CentOS.

My History:

  • yum install epel-release
  • yum install perl gcc dkms kernel-devel kernel-headers make bzip2
  • yum groupinstall "Development tools"
  • yum update -y
  • reboot

After that, I mount de VBoxGuestAdditions and I ran the process

Chemotherapy answered 9/6, 2020 at 0:17 Comment(0)
F
0

yum install kernel-devel-3.10.0-693.11.1.el7.x86_64 fixed the issue.

Fosterling answered 19/3, 2018 at 17:41 Comment(2)
No package kernel-devel-3.10.0-693.11.1.el7.x86_64 available.Bourbonism
@SzymonRoziewski you probably had openVZ installed, in that case you should add 'vz' to your kernel-devel package name: yum install vzkernel-devel-3.10.0-693.11.1.el7.x86_64Peekaboo
A
0

A little late to the party but I just ran into this problem myself and here's what I did to resolve the issue.

yum update -y
yum install -y redhat-lsb-core net-tools kernel-headers kernel-devel epel-release
yum groupinstall -y "Development Tools"
reboot

Ensure your system has been fully updated when you ran yum update -y before continuing!

Cheers

Arianism answered 25/10, 2022 at 9:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.