Skip to main content
Updated with testing and additional details to make it work for CentOS.
Source Link
Abraxas
  • 4.4k
  • 6
  • 30
  • 48

How to fix this but for Fedora/CentOS

First make sure that your installed packages (especially kernel) are up to date:

$ sudo yum update     

If it updates the kernel version, you will have to restart so uname -r matches the directory name in /usr/src/kernels/. Then

$ sudo yum install kernel-devel gcc
$ echo export KERN_DIR=/usr/src/kernels/`uname -r` >> ~/.bashrc
$ source ~/.bashrc     # to set the variable in your current shell
$ sudo echo $KERN_DIR  # verify the value is set
$ sudo ls $KERN_DIR    # verify the directory exists 

After this compiling VirtualBox kernel modules should works without any problems.

Sources:

How to fix this but for Fedora/CentOS

First make sure that your installed packages (especially kernel) are up to date:

$ sudo yum update     

If it updates the kernel version, you will have to restart so uname -r matches the directory name in /usr/src/kernels/. Then

$ sudo yum install kernel-devel gcc
$ echo export KERN_DIR=/usr/src/kernels/`uname -r` >> ~/.bashrc
$ source ~/.bashrc     # to set the variable in your current shell
$ sudo echo $KERN_DIR  # verify the value is set
$ sudo ls $KERN_DIR    # verify the directory exists 

After this compiling VirtualBox kernel modules should works without any problems.

Sources:

How to fix this for Fedora/CentOS

First make sure that your installed packages (especially kernel) are up to date:

$ sudo yum update     

If it updates the kernel version, you will have to restart so uname -r matches the directory name in /usr/src/kernels/. Then

$ sudo yum install kernel-devel gcc
$ echo export KERN_DIR=/usr/src/kernels/`uname -r` >> ~/.bashrc
$ source ~/.bashrc     # to set the variable in your current shell
$ sudo echo $KERN_DIR  # verify the value is set
$ sudo ls $KERN_DIR    # verify the directory exists 

After this compiling VirtualBox kernel modules should works without any problems.

Sources:

Updated with testing and additional details to make it work for CentOS.
Source Link

How to fix this but for Fedora/CentOS

First make sure that your installed packages (especially kernel) are up to date:

$ sudo yum update     

thenIf it updates the kernel version, you will have to restart so uname -r matches the directory name in /usr/src/kernels/. Then

$ sudo yum install kernel-devel gcc
$ echo export KERN_DIR=/usr/src/kernels/`uname -r` >> ~/.bashrc
$ source ~/.bashrc     # to set the variable in your current shell
$ sudo echo $KERN_DIR  # verify the value is set
$ sudo ls $KERN_DIR    # verify the directory exists 

After this compiling VirtualBox kernel modules should works without any problems.

Sources:

How to fix this but for Fedora

First make sure that your installed packages (especially kernel) are up to date:

$ sudo yum update

then

$ sudo yum install kernel-devel gcc
$ echo export KERN_DIR=/usr/src/kernels/`uname -r` >> ~/.bashrc

After this compiling VirtualBox kernel modules should works without any problems.

Sources:

How to fix this but for Fedora/CentOS

First make sure that your installed packages (especially kernel) are up to date:

$ sudo yum update     

If it updates the kernel version, you will have to restart so uname -r matches the directory name in /usr/src/kernels/. Then

$ sudo yum install kernel-devel gcc
$ echo export KERN_DIR=/usr/src/kernels/`uname -r` >> ~/.bashrc
$ source ~/.bashrc     # to set the variable in your current shell
$ sudo echo $KERN_DIR  # verify the value is set
$ sudo ls $KERN_DIR    # verify the directory exists 

After this compiling VirtualBox kernel modules should works without any problems.

Sources:

Source Link
user11153
  • 421
  • 1
  • 6
  • 10

How to fix this but for Fedora

First make sure that your installed packages (especially kernel) are up to date:

$ sudo yum update

then

$ sudo yum install kernel-devel gcc
$ echo export KERN_DIR=/usr/src/kernels/`uname -r` >> ~/.bashrc

After this compiling VirtualBox kernel modules should works without any problems.

Sources: