Anyone who has installed Oracle’s VirtualBox virtualization software inevitably encounters a few vexing problems.
The main problem is that your monitor settings (screen resolution) will be off and the desktop will not occupy the full screen.
Plus, there are usually issues with your mouse with the guest OS.
Here’s where the concept of Guest Additions comes into the picture.
Unless you install Guest Additions, you’ll continue to have problems with your installation of the guest OS under VirtualBox.
So what exactly are Guest Additions?
Guest Additions are basically drivers for the guest OS and enabled shared folders.
Before installing Guest Additions, you must install a few prerequisites.
If you’re running CentOS, run the below command as root or sudo to install prerequisites like Dynamic Kernel Module Support, GNU Compiler Collection, etc on the guest OS.
# yum install gcc g++ dkms kernel-devel
Once the installation of dkms, gcc, etc is complete, open the VirtualBox VM for the guest OS, then select Devices tab in the top row, scroll down and pick the Insert Guest Additions option.
What happens now is that the Guest Additions ISO is mounted in the virtual CD drive of the virtual machine (guest OS).
In a few seconds, a dialog-box will open and prompt you to autorun the CD. Go ahead and click the Run button.
Next you’ll be prompted for your root password.
Once the installation is complete, reboot the guest OS.
Verify Guest Additions
Just to be sure that the Guest Additions kernel modules are loaded, run the below command.
$ lsmod | grep -i vbox vboxsf 39725 0 vboxguest 269488 6 vboxsf vboxvideo 12658 1 drm 311588 3 vboxvideo
In the above output, the presence of vboxguest module shows that Virtualbox Guest Additions kernel module is loaded and working.
You’ll notice that the desktop now fully fits the screen size and the mouse issue too has disappeared.