9
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CentOSでLinuxカーネルヘッダー違いでVirtualBox DKMS 起動がこける時の対応

Posted at

CentOS7にVirtualBoxを入れて起動しようとするとこういうエラーが出た

[root@~]#  service 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 3.10.0-229.el7.x86_64 cannot be found at
/lib/modules/3.10.0-229.el7.x86_64/build or /lib/modules/3.10.0-229.el7.x86_64/source.
                                                           [FAILED]
  (Failed, trying without DKMS)
Recompiling VirtualBox kernel modules                      [FAILED]
  (Look at /var/log/vbox-install.log to find out what went wrong)

どうやらカーネルのバージョンとカーネルヘッダーが違う!と起こってるらしいのだがバージョンはあってるのに、末尾が微妙に違う様子

unameのカーネル
[root]# uname -a Linux 157-7-109-110 3.10.0-229.el7.x86_64 #1 SMP Fri Mar 6 11:36:42 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

カーネルヘッダーの場所

[root]# ls /usr/src/kernels/3.10.0-229.4.2.el7.x86_64/ Kconfig Module.symvers arch crypto firmware include ipc lib net scripts sound usr vmlinux.id Makefile System.map block drivers fs init kernel mm samples security tools virt

  • unameカーネル 3.10.0-229.el7.x86_64
  • カーネルヘッダー 3.10.0-229.4.2.el7.x86_64

ln -s でカーネルヘッダーのショートカットを作ると解決できます

ln -s /usr/src/kernels/3.10.0-229.4.2.el7.x86_64 /usr/src/kernels/3.10.0-229.el7.x86_64

[root kernels]#  service vboxdrv setup
Stopping VirtualBox kernel modules                         [  OK  ]
Uninstalling old VirtualBox DKMS kernel modules            [  OK  ]
Trying to register the VirtualBox kernel modules using DKMS[  OK  ]
Starting VirtualBox kernel modules                         [  OK  ]
9
8
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?