thelinuxvault blog

Installing VirtualBox Guest Additions on Ubuntu 24.04: A Comprehensive Guide

If you’re running Ubuntu 24.04 as a virtual machine (VM) in Oracle VirtualBox, you’ve likely noticed limitations like poor screen resolution, slow performance, or lack of features like shared folders and clipboard integration. These issues stem from the absence of VirtualBox Guest Additions—a set of drivers and utilities designed to optimize the VM experience.

Guest Additions bridge the gap between your host OS (e.g., Windows, macOS, Linux) and the guest Ubuntu VM, enabling seamless interactions, improved graphics, and better resource utilization. In this guide, we’ll walk through installing Guest Additions on Ubuntu 24.04 step-by-step, ensuring you unlock all these benefits.

2026-02

Table of Contents#

Prerequisites#

Before starting, ensure you have the following:

  • A running Ubuntu 24.04 VM in VirtualBox (Desktop or Server edition).
  • Admin privileges on the Ubuntu VM (you’ll need sudo access).
  • An active internet connection (to download updates and dependencies).
  • VirtualBox 7.0 or newer (older versions may lack Ubuntu 24.04 compatibility; download the latest VirtualBox here).

Step 1: Update Ubuntu Packages#

First, update your Ubuntu VM’s package index and upgrade existing packages to their latest versions. This ensures compatibility with new software (like Guest Additions) and reduces the risk of conflicts.

Open a terminal in Ubuntu (press Ctrl + Alt + T for Desktop) and run:

sudo apt update && sudo apt upgrade -y
  • sudo apt update: Refreshes the list of available packages.
  • sudo apt upgrade -y: Upgrades installed packages (the -y flag auto-confirms prompts).

Step 2: Install Required Dependencies#

Guest Additions require tools to compile kernel modules and match your system’s kernel version. Install these dependencies:

sudo apt install -y build-essential dkms linux-headers-$(uname -r)

Let’s break down each package:

  • build-essential: Includes compilers (like gcc) and libraries needed to build software from source.
  • dkms (Dynamic Kernel Module Support): Ensures Guest Additions modules are automatically rebuilt when your Ubuntu kernel updates (critical for long-term stability).
  • linux-headers-$(uname -r): Installs kernel headers matching your running kernel (replace $(uname -r) with your kernel version, e.g., 6.8.0-31-generic).

Verify Kernel Headers Installation#

To confirm headers are installed, run:

dpkg -l linux-headers-$(uname -r)

If you see ii in the output (e.g., ii linux-headers-6.8.0-31-generic), headers are installed. If not, re-run the dependency command or check for kernel updates with sudo apt upgrade linux-image-$(uname -r).

Step 3: Insert the Guest Additions CD Image#

VirtualBox includes an ISO image with Guest Additions. To mount it:

  1. In the VirtualBox window, go to Devices > Insert Guest Additions CD Image (or press Host + D, where Host is usually Right Ctrl by default).

    • If the option is grayed out, VirtualBox may need to download the ISO first. Click Download when prompted (this takes ~50MB).
    • If the ISO is already downloaded, navigate to Devices > Optical Drives > Choose a disk file and select VBoxGuestAdditions.iso (usually stored in C:\Program Files\Oracle\VirtualBox\ on Windows or /usr/share/virtualbox/ on Linux hosts).

Step 4: Mount the CD and Run the Installer#

Ubuntu may auto-mount the Guest Additions CD, but if not, mount it manually:

Option 1: Auto-Mounted CD#

If a pop-up appears asking to “Run Software,” click Run (you may need to enter your sudo password).

Option 2: Manual Mount#

If auto-mount fails:

  1. Create a mount point (if needed):

    sudo mkdir -p /mnt/vboxadditions
  2. Mount the CD:

    sudo mount /dev/cdrom /mnt/vboxadditions
  3. Navigate to the mounted directory and run the installer:

    cd /mnt/vboxadditions
    sudo ./VBoxLinuxAdditions.run

What the Installer Does#

The VBoxLinuxAdditions.run script compiles and installs:

  • Kernel modules (e.g., vboxguest for core integration, vboxsf for shared folders).
  • Services for clipboard sharing and display resizing.
  • Utilities like VBoxControl for VM management.

The installation takes 1–2 minutes. Look for ... Installation successful in the output to confirm success.

Step 5: Reboot the VM#

Guest Additions require a reboot to load kernel modules. Reboot your Ubuntu VM:

sudo reboot

Step 6: Verify the Installation#

After rebooting, confirm Guest Additions are working with these checks:

1. Check Loaded Modules#

Run:

lsmod | grep vbox

You should see modules like vboxguest, vboxsf, and vboxvideo (e.g., vboxguest 401408 2 vboxsf).

2. Test Display Resizing#

Drag the VirtualBox window’s edge to resize it—the Ubuntu desktop should auto-adjust resolution.

3. Test Shared Clipboard#

  • Copy text from your host OS (e.g., “Hello from host”).
  • Paste it into an Ubuntu terminal or text editor (use Ctrl + Shift + V in the terminal).
  • Reverse the test (copy from Ubuntu, paste to host) to confirm bidirectional sharing.

4. Test Shared Folders (Optional)#

To set up a shared folder:

  1. In VirtualBox, go to Devices > Shared Folders > Shared Folders Settings.
  2. Click Add (+), select a host folder (e.g., C:\shared), check “Auto-mount,” and set a share name (e.g., host_shared).
  3. In Ubuntu, access the shared folder at /media/sf_host_shared (you may need to add your user to the vboxsf group first: sudo usermod -aG vboxsf $USER, then reboot).

Troubleshooting Common Issues#

Issue 1: “Kernel Headers Not Found”#

Cause: Missing or mismatched kernel headers.
Fix: Reinstall headers with sudo apt install linux-headers-$(uname -r). If that fails, upgrade your kernel:

sudo apt upgrade linux-image-generic
sudo reboot

Issue 2: “modprobe: FATAL: Module vboxguest not found”#

Cause: Installer failed to build modules (e.g., missing build-essential).
Fix: Reinstall dependencies and re-run the installer:

sudo apt install -y build-essential dkms
sudo /mnt/vboxadditions/VBoxLinuxAdditions.run  # Re-run from the CD mount point

Issue 3: Secure Boot Blocks Modules#

Cause: Ubuntu’s Secure Boot prevents unsigned kernel modules.
Fix: Disable Secure Boot in your VM’s BIOS (press F12 during boot in VirtualBox) or sign the modules manually (advanced users only).

Issue 4: CD Image Not Detected#

Cause: ISO not mounted or corrupted.
Fix: Re-download the Guest Additions ISO via Devices > Insert Guest Additions CD Image or manually download it from VirtualBox’s website.

Conclusion#

Installing VirtualBox Guest Additions on Ubuntu 24.04 transforms your VM from a sluggish, limited environment into a seamless extension of your host OS. With improved performance, shared resources, and auto-resizing displays, you’ll work more efficiently whether you’re developing, testing, or learning.

Remember to update Guest Additions whenever you upgrade VirtualBox (repeat Steps 3–5 with the new ISO) to ensure compatibility with the latest kernel and features.

References#