Installing Guest Additions in a Kali Linux virtual machine
Problem
I needed to access a file located in my physical system from inside a Kali Linux VM, so I tried to enable Shared Folders.
However, I found out, much to my dismay, it wasn't possible.
I tried following the on-screen instructions but the installation failed every time with an error message, that suggested to check the file /var/log/vboxadd-install.log.
According to said log file, the installation failed because no Linux headers could be found for my distribution.
Solution
a) Preparation
The only solution to this problem is to run the following commands, in this order:
- (sudo) apt-get update
- (sudo) apt-get upgrade
- (sudo) apt-get dist-upgrade
In the screenshots below I didn't use sudo, as I logged in as root (notice the # sign in the prompt, instead of the usual $). You should never do it on a physical system, but I don't care for a virtual machine. If you're not logged in as root, you'll need sudo for you to run the above commands.
Afterward, I ran apt-get install linux-headers-$(uname -r) in order to grab the correct headers.
The second time around, it ran successfully (it had initially failed, as shown above).
b) Guest Additions re-install
- Insert the Install DVD (Devices/Insert Guest Addition CD Image)
- Mount the image to a temporary folder, called /mnt (mount /dev/cdrom /mnt).
- Move to such temporary folder (cd /mnt)
- Run the installation file with (sudo) ./VBoxLinuxAdditions.run.
Yay!
If this operation doesn't add a link to your physical system on your Kali Linux VM desktop (as shown in the video), you can create one yourself.
Add a new shared folder (from Devices/Shared Folders/Shared Folders Settings), if you don't have one already, then check the contents of the /media directory by running ls -l /media.
You should find a file called sf.yourname (yourname will be replaced by the username on your physical system. For example, if you're pointing shared folders to your physical username, called joe, the file will be named sf.joe).
At that point, move to your desktop (cd ./Desktop) and enter the following command:
ln -s /media/sf.myname .
It will add a symbolic link to that file on your desktop (. stands for your current directory).
If you double-click that file, you'll be able to access your physical operating system.
Add a new shared folder (from Devices/Shared Folders/Shared Folders Settings), if you don't have one already, then check the contents of the /media directory by running ls -l /media.
You should find a file called sf.yourname (yourname will be replaced by the username on your physical system. For example, if you're pointing shared folders to your physical username, called joe, the file will be named sf.joe).
At that point, move to your desktop (cd ./Desktop) and enter the following command:
ln -s /media/sf.myname .
It will add a symbolic link to that file on your desktop (. stands for your current directory).
If you double-click that file, you'll be able to access your physical operating system.
Comments
Post a Comment