I was trying to install the VirtualBox Guest Additions in a Kali Linux virtual machine by following the steps here.

I ran: sudo apt-get update, sudo apt-get upgrade, sudo reboot (until truly all packages were upgraded) sudo apt-get install build-essential sudo apt-get install module-assistant, sudo m-a prepare

But when I ran sudo sh VBoxLinuxAdditions.run I got:

Installing additional modules ...
vboxadd.sh: Starting the VirtualBox Guest Additions.
Failed to set up service vboxadd, please check the log file

In the log file it says:

vboxadd.sh: failed: Look at /var/log/vboxadd-install.log to find out what went wrong.
vboxadd.sh: failed: modprove vboxgues failed.

Most likely this was due to not having the kernel headers installed.

Hence I ran sudo apt-get install linux-headers-$(uname-r) but then I get:

E: Unable to locate package linux-headers-4.9.0-kali3-amd64

apt-cache search linux-headers only shows:

linux-headers-4.12.0-kali1-all - [...]

My question is: why am I having this problem and how can it be solved?
(Could it be a problem with my host system, is it maybe a problem of having executed something in a wrong order, should I maybe reinsert Guest Additions iso somehow?)

  • Not the Debian tag then. "Questions specific to the Debian official distribution (stable, testing, or unstable); if you are using a derivative of Debian (e.g. Mint, Ubuntu, Kali, etc), then use that distribution’s tag instead."
    – user8779
    Sep 7 '17 at 15:03

The solution was simple. It worked with sudo apt-get install linux-headers-4.12.0-kali2-all. Use uname -r to find out which package you need. Also note that you may need to change permissions of VBoxLinuxAdditions: chmod 777 VBoxLinuxAdditions.run.

  • Glad to see you solved it. I have never had to change permissions to LinuxAdditions, for me cp VBoxLinuxAdditions.run /tmp then /tmp$VBoxLinuxAdditions.run just does it all the time.
    – Helio
    Mar 15 '18 at 18:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.