How To Install VirtualBox Guest Additions in Fedora 23/24
This tutorial will show you how to install VirtualBox guest additions in Fedora. Before you follow the steps in this tutorial, you need to have a Fedora guest OS installed inside VirtualBox. The type of OS on the host doesn’t matter.
VirtualBox Guest Additions offer the following features:
- Enable users to seamlessly move mouse pointer between host and guest. Users don’t have to press the Host key (right Ctrl) to free the mouse pointer from being captured by the guest OS.
- Enable the guest OS to have read and write access to a folder on the host OS.
- Power up the graphics ability of your guest machine. The screen resolution of guest can be automatically adjusted and 3D graphics can be accelerated. This is a must have for the unity desktop of Ubuntu.
- Enable bidirectional shared clipboard between host and guest.
Basic Idea Behind Installing Guest Additions
The guest additions are a set of device drivers (graphics and mouse drivers) and system applications that is going to be installed in the guest OS. One of them is a VirtualBox kernel module. This kernel module must be compiled in the guest OS.
So the installing process is as follows:
- Install development tools on the guest OS to enable us to compile kernel module.
- Download the guest addition ISO file on the host and insert it to the guest’s virtual CD-ROM drive
- Compile and install it on the guest OS.
Q & A
1. Why Do I need to compile VirtualBox Guest Additions kernel module?
The binary compatibility of kernel module depends on the API of Linux Kernel. Since the API of each version of Linux kernel might be different, it’s better to compile the kernel module rather than providing a bog-standard kernel module binary.
2. Why can’t I just download guest additions onto the hard disk of guest machine and compile it?
The VirtualBox Guest Additions are provided as a single CD-ROM image file which is called VBoxGuestAdditions.iso.
Step 1: Prepare Fedora Guest System for Compiling software
Fully update Fedora guest.
sudo dnf update && sudo dnf upgrade
Install DKMS, GNU C compiler, kernel-headers and kernel-devel. They are required if you compile Linux kernel modules. dkms enables automatic re-compiling when a new kernel is installed.
sudo dnf install dkms gcc kernel-devel kernel-headers
Reboot Fedora guest.
sudo shutdown -r now
Step 2: Insert Virtualbox Guest Additions ISO file to Virtual CD-ROM Drive
In the VirtualBox window, select Devices > Insert Guest Additions CD image.
A window will pop-up asking if you want to run the VirtualBox Guest Additions installer, click Run button.
Some version of VirtualBox may prompt you to download the VirtualBox Guest additions ISO. In my case, my VirtualBox comes with an ISO file already.
Then enter your password and the compilation and installation process will begin.
The status must be [OK]
indicating the installation is successful. Restart Fedora guest machine. Now the screen resolution will adjust with the window size and you can go full screen mode and set up shared folders.
You may need to manually adjust screen resolution if the default value is low.
The above method also works on Fedora-based Linux distributions like Network Security Toolkit.