KaliLinux 2017.1: Install VirtualBox Guest Additions on KaliLinux 2017.1 on VirtualBox

This article will describe installing Guest Additions.

1 Update packages

Update packages including kernel.

$ sudo apt update -y
$ sudo apt upgrade -y
$ sudo reboot

2 Install build dependencies for Guest Additions

Install kernel header and build dependencies for kernel.

$ sudo sed -e 's/^# deb-src/deb-src/g' -i /etc/apt/sources.list
$ sudo apt update -y
$ sudo apt install -y linux-headers-amd64
$ sudo apt build-dep -y linux-image-amd64

3 Mount Guest Additions CD image

Insert iso file of VirtualBox Guest Additions from window menu of VirtualBox.

Devices -> Insert Guest Additions CD image

If an automount is running, an automount will mount CD image to /media/<username>/<virtualbox> automatically. If an automount is not running, mount CD image manually.

sudo mount -t iso9660 /dev/sr0 /media/cdrom

4 Build Guest Additions

Run VBoxLinuxAdditions.run.

$ cd /media/cdrom
$ sudo sh ./VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.0.40 Guest Additions for Linux............
VirtualBox Guest Additions installer
Removing installed version 5.0.40 of VirtualBox Guest Additions...
Removing existing VirtualBox non-DKMS kernel modules ...done.
update-initramfs: Generating /boot/initrd.img-4.9.0-kali3-amd64
update-initramfs: Generating /boot/initrd.img-4.9.0-kali4-amd64
Copying additional installer modules ...
Installing additional modules ...
Removing existing VirtualBox non-DKMS kernel modules ...done.
Building the VirtualBox Guest Additions kernel modules
The headers for the current running kernel were not found. If the following
module compilation fails then this could be the reason.

Building the main Guest Additions module ...done.
Building the shared folder support module ...done.
Building the graphics driver module ...done.
update-initramfs: Generating /boot/initrd.img-4.9.0-kali4-amd64
Doing non-kernel setup of the Guest Additions ...done.
Starting the VirtualBox Guest AdditionsInstalling the Window System drivers
 ...done.
Installing graphics libraries and desktop services components ...done.
 ...done.

Reboot virtual machine.

$ sudo reboot

5 Execution result

Check whether driver which has a vbox prefix is loaded.

$ lsmod | grep vbox
vboxsf                 40960  0
vboxvideo              49152  2
vboxguest             282624  3 vboxsf,vboxvideo
ttm                    98304  1 vboxvideo
drm_kms_helper        155648  1 vboxvideo
drm                   360448  5 vboxvideo,ttm,drm_kms_helper

Display resolution supports all size. When you change VirtualBox window size, a resolution will be chagned automatically.

0001_DisplayResolution.png