Table of Contents
- 1. Update packages
- 2. Install build dependencies for Guest Additions
- 3. Mount Guest Additions CD image
- 4. Build Guest Additions
- 5. Execution result
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.runVerifying archive integrity… All good.Uncompressing VirtualBox 5.0.40 Guest Additions for Linux…………VirtualBox Guest Additions installerRemoving 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-amd64update-initramfs: Generating /boot/initrd.img-4.9.0-kali4-amd64Copying additional installer modules …Installing additional modules …Removing existing VirtualBox non-DKMS kernel modules …done.Building the VirtualBox Guest Additions kernel modulesThe headers for the current running kernel were not found. If the followingmodule 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-amd64Doing 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 vboxvboxsf 40960 0vboxvideo 49152 2vboxguest 282624 3 vboxsf,vboxvideottm 98304 1 vboxvideodrm_kms_helper 155648 1 vboxvideodrm 360448 5 vboxvideo,ttm,drm_kms_helper
Display resolution supports all size. When you change VirtualBox window size, a resolution will be chagned automatically.