Contents

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:

1
2
3
└─$ systemd-analyze time                                                           
Startup finished in 34.355s (kernel) + 1min 42.261s (userspace) = 2min 16.617s 
graphical.target reached after 1min 42.261s in userspace.

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:

1
2
3
└─$ systemd-analyze time 
Startup finished in 33.464s (kernel) + 12.934s (userspace) = 46.398s 
graphical.target reached after 12.934s in userspace.

We start by executing the systemd-analyze blame command, which will sort the services/inits according to their start time in descending order:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
└─$ systemd-analyze blame 
10.850s vboxadd.service
10.593s plymouth-quit-wait.service
  569ms thin.service
  470ms dev-sda1.device
  287ms networking.service
  246ms NetworkManager.service
  241ms user@143.service
  219ms user@1001.service
  162ms accounts-daemon.service
  126ms polkit.service
  120ms upower.service
[..]

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.

1
2
3
4
5
6
7
8
└─$ sudo journalctl -b -p3 | grep -i vbox                    
Apr 13 13:46:33 kalipen (udev-worker)[822]: vboxguest: /etc/udev/rules.d/60-vboxadd.rules:1 Only network interfaces can be renamed, ignoring NAME="vboxguest".
Apr 13 13:46:33 kalipen (udev-worker)[828]: vboxuser: /etc/udev/rules.d/60-vboxadd.rules:2 Only network interfaces can be renamed, ignoring NAME="vboxuser".
Apr 13 13:46:34 kalipen (udev-worker)[1292]: vboxguest: /etc/udev/rules.d/60-vboxadd.rules:1 Only network interfaces can be renamed, ignoring NAME="vboxguest".
Apr 13 13:46:34 kalipen (udev-worker)[1306]: vboxuser: /etc/udev/rules.d/60-vboxadd.rules:2 Only network interfaces can be renamed, ignoring NAME="vboxuser".
Apr 13 13:46:34 kalipen kernel: vboxsf: Unknown parameter 'tag'
Apr 13 13:46:34 kalipen kernel: vboxsf: Unknown parameter 'tag'
Apr 13 13:46:44 kalipen systemd[1]: Failed to start vboxadd.service.

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.
  • 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:

1
2
sudo apt update
apt-cache show virtualbox-guest-x11 

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/)

1
2
3
4
5
6
7
8
9
└─$ sudo apt update && apt-cache show virtualbox-guest-x11                                         
Package: virtualbox-guest-x11
Source: virtualbox
Version: 7.0.20-dfsg-1.2
Installed-Size: 765
Maintainer: Debian Virtualbox Team <team+debian-virtualbox@tracker.debian.org>
Architecture: amd64
Replaces: virtualbox-guest-x11-hwe (<< 7.0.16-dfsg-5)
Provides: xorg-driver-video

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:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#prepare and install latest updates
sudo apt update && sudo apt full-upgrade -y

#install Linux headers and dependencies for building VirtualBox modules
sudo apt install -y linux-headers-$(uname -r) build-essential dkms

#install Guest Additions
cd /media/cdrom/
sudo sh ./VBoxLinuxAdditions.run

#finish
sudo reboot

After this procedure, we finally obtain an acceptable loading time!

1
2
3
└─$ systemd-analyze time                                
Startup finished in 3.217s (kernel) + 3.031s (userspace) = 6.249s 
graphical.target reached after 3.030s in userspace.