Kali Linux Long Term Usage Part 3: VirtualBox Guest Additions
I use Kali Linux on a regular basis inside a virtual machine (VirtualBox) and I have maintained my image for a couple of years.
Over the last months and years, the booting time got worse and worse, until it reached the following startup time:
|
|
In the first and second parts of the series, we covered some optimizations with regard to disk usage and potential problems with non-existing partitions.
Root cause analysis
After cleaning up the system, deleting invalid partition entries in /etc/fstab
and setting up the swap file, the startup time is still too long and makes every start of the VM quite tedious:
|
|
We start by executing the systemd-analyze blame
command, which will sort the services/inits according to their start time in descending order:
|
|
Apparently, there are issues with the vboxadd.service
.
What is the vboxadd Service?
The vboxadd
service is part of Oracle VirtualBox Guest Additions, a set of drivers and system applications installed on a guest operating system (VM) to improve performance and integration with the host. Specifically, the vboxadd
service manages kernel modules (vboxguest
, vboxsf
, vboxvideo
) that enable features like:
- Shared folders: Allows file exchange between host and guest.
- Seamless mouse integration: Smooth cursor movement between host and guest.
- Dynamic screen resizing: Adjusts guest resolution to match the VM window.
- Time synchronization: Keeps guest and host clocks aligned.
- Graphics acceleration: Enhances 2D/3D performance (via vboxvideo).
- Clipboard sharing: Enables copy-paste between host and guest.
The vboxadd
service runs in the background on the guest OS to load and manage these kernel modules, ensuring the Guest Additions function correctly.
VirtualBox Guest Additions Errors
We continue and search for more detailed error messages with the journalctl
command, which will print log entries from the systemd journal.
The systemd journal logs detailed startup events, including timeouts and failures.
|
|
Indeed, there is a problem with the vboxadd.service
, although the Guest Additions did not cause any noticeable problem: Shared clipboard, folders and dynamic screen resizing of the guest VM were all functional.
Possibly, the Guest Additions are broken because of a recent Linux kernel update.
Installing VirtualBox Guest Additions manually
It is important to keep in mind that the Guest Additions have to be reinstalled each time:
- After a Linux kernel upgrade:
- Kali Linux, being a rolling distribution, frequently updates its kernel. Guest Additions rely on kernel modules (
vboxguest
,vboxsf
,vboxvideo
), which must be recompiled for the new kernel.
- Kali Linux, being a rolling distribution, frequently updates its kernel. Guest Additions rely on kernel modules (
- After updating VirtualBox to a new version:
- A VirtualBox update on the host may introduce new Guest Additions with improved features or compatibility fixes. You’ll need to install the matching Guest Additions version in the Kali VM to ensure full functionality.
Usually, the module virtualbox-guest-x11
in the apt repository is outdated and does not match the Virtualbox version you have installed.
We can quickly verify this with:
|
|
In our case (April 2025), the installed VirtualBox version is the latest available one (7.1.6), but the Guest Additions in the repository is quite outdated (July 2024). (Note that there are no further instructions on the Kali website, see https://www.kali.org/docs/virtualization/install-virtualbox-guest-additions/)
|
|
Therefore, we decide to install the VirtualBox Guest Additions manually, which requires us to compile them for our installed Linux kernel. For this purpose, we insert the VirtualBox Guest Additions media and make it available to the guest Kali machine. Afterwards, we follow this procedure:
|
|
After this procedure, we finally obtain an acceptable loading time!
|
|