Monday, 1 May 2017

Win10 Host, Virtualbox, Kali Guest, and Virtualbox Guest Addition Foo

What a pain. I received a new disk from work and so I decided to reinstall virtualbox and guest additions and start a new Kali guest VM. A fresh start.

I add the guest additions so I can have an adjustable screen size for the VM. I am a visual learner so deal with it.

So when I install Virtualbox it asks if I want the updated guest additions and I say yes which causes it to install in c:\Program Files\Oracle\Virtualbox\VBoxGuestAdditions.iso.

My Kali virtual box needs two things at this point:


  1. A cd-rom device enabled. So it can insert the guest additions into it from the Devices menu.
  2. No images associated with that CD rom otherwise when you attempt to insert the guest additions it will error as busy.
Once your VM boots, and you select Devices->Insert Guest Additions CD image... you should see a VBOXADDITIONS... CD icon on your desktop.

But your quest has a few pitfalls remaining.

So crack open a bash terminal in Kali and change directory /media/cdrom.

Then attempt to run (as root) VBoxLinuxAdditions.run. It will fail with a you do not have permissions. The image has been mounted without the ability to run anything.

To fix this:


  • cd /etc
  • vi fstab
  • change the line for /media/cdrom0 and replace "noauto" with exec


The line should now look like:

/dev/sr0        /media/cdrom0   udf,iso9660 user,exec     0       0

Then perform a:

umount /media/cdrom0
mount /media/cdrom0

You should now be able to run VBoxLinuxAdditions.run

However that in itself might fail with:

Building the main Guest Additions module ...fail!
(Look at /var/log/vboxadd-install.log to find out what went wrong)

The reason for this is that it is attempting to compile something and it does not have headers to compile with.

apt-get update
apt-get install linux-headers-`uname -r`

Then try again with VBoxLinuxAdditions.run

References:

  1. https://forums.kali.org/showthread.php?18973-Issues-installing-VirtualBox-Guest-Additions
  2. https://forums.virtualbox.org/viewtopic.php?f=3&t=58799