Centos7 Guest Additions fails: kernel headers not found

Discussions about using Linux guests in VirtualBox.
Post Reply
Thales
Posts: 7
Joined: 31. Dec 2015, 06:55

Centos7 Guest Additions fails: kernel headers not found

Post by Thales »

Hello,

I just installed Centos 7 and I've been having a difficult time getting Guest Additions to install on my Centos 7 (Windows 10 host). I have VirtualBox version 6.0.4.

I've been following the instructions from this website: https://www.tecmint.com/install-virtual ... el-fedora/

When I run ./VBoxLinuxAdditions.run this error is returned:
kernel headers not found for target kernel
I have guest additions version 6.0.4

Now, I did run
yum install kernel-headers kernel-devel
as shown at the website above. Also, when I run them twice they claim they are already installed.

I also ran
/sbin/rcvboxadd setup
as suggested, and the same error crops up "kernel headers not found for target kernel"

Additional point: My mouse pointer has been *invisible* right from the start as Centos was being installed into VirtualBox. One guy on here, I noted, claimed he had the same problem and it became visible after he installed Guest Additions. So, I can't use the mouse for any of this, which is awkward.

If anyone has any ideas I would really appreciate feedback. The mouse cursor being invisible caused me to reinstall Centos 7, a slightly different version, and the invisible mouse persisted, but getting Guest Additions to work is the current problem I'm working on.

Thanks for any help!
...John
toracat
Posts: 87
Joined: 8. Dec 2018, 02:39
Primary OS: Linux other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: RHEL CentOS Scientific Linux
Location: California, USA
Contact:

Re: Centos7 Guest Additions fails: kernel headers not found

Post by toracat »

Regarding the Guest Addition installation problem, I suspect the version of kernel-devel does not match the version of your running kernel. You can check them by running uname -r and rpm -q kernel-devel. Do they match? If not I recommend you update the kernel to the latest.

Regarding the mouse problem, this is a known issue with RHEL//CentOS 7.6 kernels. Please see Mouse only usable within single application after mouse click on RHEL 7.6 (#18124) for details.
Beginning is easy – Continuing is hard.
Thales
Posts: 7
Joined: 31. Dec 2015, 06:55

Re: Centos7 Guest Additions fails: kernel headers not found

Post by Thales »

Thanks for the help. I posted this thread last night before bed, and was ready to apply your ideas today, when I noticed that on logging into Centos 7 that the mouse pointer was visible, and somehow guest additions had been installed (windows resizes). I don't get it, because running guest additions threw up those errors.

It's great to see it working, but I'm very confused as to why, since I did nothing.

Oh well. :?
Thales
Posts: 7
Joined: 31. Dec 2015, 06:55

Re: Centos7 Guest Additions fails: kernel headers not found

Post by Thales »

It looks like there is a problem again. The mouse cursor is visible this time, but it doesn't work, i.e. doesn't respond to clicks. I'm stuck in one Window.

I ran this:
You can check them by running uname -r and rpm -q kernel-devel. Do they match? If not I recommend you update the kernel to the latest.
and they do match. I believe they did not match earlier. Maybe this is because you have to reboot after an update to load the kernel to get them to match.

But, the fact is I was able to run Guest Additions without error. None the less, On rebooting things worked for a while, but then the mouse stopped working.

Does anyone have any idea what could be the problem? It seems I'm moving from problem to problem here.

Thanks!
...John
Thales
Posts: 7
Joined: 31. Dec 2015, 06:55

Re: Centos7 Guest Additions fails: kernel headers not found

Post by Thales »

I found a resolution to my mouse freeze problem:

From the link referenced by "toracat" in the post above, I found this advice:
Change Nickname wrote:
I encountered this mouse problem after getting past a GA build issue.
As posted there, I ran across other threads (see kus post here that points to ticket here (user michael was involved with that ticket)) that give a workaround until a fix is found: kill the VBoxClient --draganddrop processes (there should be 2).

Ctrl-Alt-F2 (or Fn) to get to a console login if needed.
ps aux | grep VBoxClient
kill (only) those processes with the --draganddrop option.
This solved my problem. Although it is a Band-Aid, because you have to do it every time you login, apparently. So, maybe those working at VirtualBox should be alerted to this bug.
JeanR
Posts: 19
Joined: 3. Mar 2017, 18:52
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Linux(Fedora, CentOS)

Re: Centos7 Guest Additions fails: kernel headers not found

Post by JeanR »

From the thread you mentioned above it should be clear that this is NOT a Virtualbox problem, instead volunteers of this forum have helped identify the problem in the PS/2 mouse driver introduced with kernel 3.10.0-957.1.3 (and still existing in 3.10.0-957.5.1) and filed a bugreport to both RedHat and CentOS.

The workaround with Ctrl-Alt-F2, Ctrl-Alt-F1 is not a fix. If you want a fix you have currently three options:
  1. stay with kernel-3.10.0-862-14.4 or earlier (that doesn't show the bug), then wait for c)
  2. use a patched kernel kindly provided by toracat (3.10.0-957.5.1.bug15570.plus.el7 see mentioned thread)
  3. wait for RedHat/CentOS to provide a kernel with the fix (we're already waiting about 6 weeks for this..)
I would recommend b)
Thales
Posts: 7
Joined: 31. Dec 2015, 06:55

Re: Centos7 Guest Additions fails: kernel headers not found

Post by Thales »

Thanks, Jean.

Do I use
yum install kernel-3.10.0-957.1.3.bug15570.plus.el7.x86_64.rpm

to apply the patch? This didn't work for me. It couldn't find the package to download.

I'm green at this.
JeanR
Posts: 19
Joined: 3. Mar 2017, 18:52
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Linux(Fedora, CentOS)

Re: Centos7 Guest Additions fails: kernel headers not found

Post by JeanR »

yes that's the one I mean. The download link is in the mentioned thread "Mouse only usable within single application after mouse click on RHEL 7.6 (#18124)" viewtopic.php?f=3&t=90267 (you need to skip to the end, page 7, I guess, look for toracat's post as of 30.Jan), but for your convenience here is the link again:

https://people.centos.org/toracat/kerne ... g15570new/

download the kernel-3.10.0-957.1.3.bug15570.plus.el7.x86_64.rpm package
and do a 'sudo yum localinstall kernel-3.10.0-957.1.3.bug15570.plus.el7.x86_64.rpm'

I would also recommend reading through the complete thread, even if you don't understand everything.. at least the posts from toracat and nixuser :wink:
Thales
Posts: 7
Joined: 31. Dec 2015, 06:55

Re: Centos7 Guest Additions fails: kernel headers not found

Post by Thales »

Okay, that has worked thus far.

I should warn people to download both the kernel and kernel-devel patches and then install both before rebooting.

I'd love to read the whole thread, Jean, but I have so little time. :-(

Thanks a million for the help!
AndrewOfC
Posts: 1
Joined: 11. Nov 2019, 18:39

Re: Centos7 Guest Additions fails: kernel headers not found

Post by AndrewOfC »

Setting up a 'compute node' (headless) this has worked for me

On Host machine (Centos7)

Code: Select all

$ scp /usr/share/virtualbox/VBoxGuestAdditions.iso root@<guestipaddr>:
On Guest(Centos7) as root

Code: Select all

$ yum install -y gcc perl kernel-headers kernel-devel
$ mount -t auto -o loop /root/VBoxGuestAdditions.iso /mnt
$ cd /mnt
$ ./VBoxLinuxAdditions.run --nox11
ccan
Posts: 2
Joined: 19. Jan 2020, 17:12

Re: Centos7 Guest Additions fails: kernel headers not found

Post by ccan »

You can find possible problems and their answers below
https://www.youtube.com/watch?v=NHGXkuzUBzE

Problems and solutions of:
1-Kernel headers not found for target kernel 4.18.0-147
2-Please install the gcc make perl packages from your distribution
3-Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y; installing elfutils-libelf-devel

Clear Installation...
Post Reply