Home Tech How to Install VirtualBox Guest Additions on Ubuntu & Rocky Linux – A Step‑by‑Step Guide
TechVirtualBox

How to Install VirtualBox Guest Additions on Ubuntu & Rocky Linux – A Step‑by‑Step Guide

Share
How to Install VirtualBox Guest Additions on Ubuntu & Rocky Linux – A Step by Step Guide
How to Install VirtualBox Guest Additions on Ubuntu & Rocky Linux – A Step by Step Guide
Share

How to Install VirtualBox Guest Additions on Ubuntu & Rocky Linux – A Step‑by‑Step Guide

Keywords: VirtualBox Guest Additions, Ubuntu, Rocky Linux

 

Introduction

Running a Linux VM in Oracle VirtualBox is a fantastic way to experiment, develop, or host services without touching your host OS. Yet, out of the box the guest feels a little “flat”: the mouse pointer may lag, screen resolution stays stuck, shared folders are inaccessible, and clipboard synchronization doesn’t work.

All of these limitations disappear the moment you install VirtualBox Guest Additions – a small collection of drivers and utilities that bridge the gap between host and guest. In this post we’ll walk through the complete installation process for two of the most popular distros you’ll encounter in the field: Ubuntu (the Debian‑based workhorse) and Rocky Linux (the enterprise‑grade RHEL fork).

Who is this guide for?
Anyone who already has a functional Ubuntu or Rocky Linux VM running in VirtualBox and wants a smoother, more integrated experience – from developers and sysadmins to students and hobbyists.

 

Table of Contents

  1. Prerequisites
  2. Preparing the Ubuntu Guest
    • 2.1 Update the system
    • 2.2 Install required packages
    • 2.3 Mount the Guest Additions ISO
    • 2.4 Run the installer
    • 2.5 Verify the installation
  3. Preparing the Rocky Linux Guest
    • 3.1 Update the system
    • 3.2 Install required packages (kernel‑devel, gcc, make, …)
    • 3.3 Mount the Guest Additions ISO
    • 3.4 Run the installer
    • 3.5 Verify the installation
  4. Common Post‑Installation Tweaks
  5. Troubleshooting FAQ
  6. Wrap‑Up & Next Steps

 

  1. Prerequisites
Item Why it matters
VirtualBox Version Guest Additions must match the host’s VirtualBox version. Use the same major release (e.g., 7.0.x).
Internet Access Required to pull package updates, kernel headers, and dependencies.
Kernel Headers / Development Packages The Guest Additions compile a kernel module (vboxguest) that must match the running kernel.
Sufficient Disk Space The build process needs ~200 MB of temporary space.
Root (sudo) Access Installation touches system directories (/usr/lib/, /etc/, /opt/).

Tip: If you clone the VM from a snapshot taken before installing Guest Additions, you’ll need to repeat the process on each clone, because the kernel modules are tied to the specific kernel version stored in the snapshot.

 

  1. Installing Guest Additions on Ubuntu

Ubuntu works out of the box for most users, but the official Guest Additions still give you the full feature set (dynamic resizing, 3D acceleration, shared folders, etc.).

2.1 Update the System

sudo apt update && sudo apt full-upgrade -y

sudo reboot

Explanation: A fully up‑to‑date kernel ensures the headers you install later will match the runtime kernel.

2.2 Install Required Packages

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

  • build-essential → gcc, make, libc6-dev
  • dkms → automatically rebuilds the Guest Additions modules when the kernel updates
  • linux-headers-$(uname -r) → exact header version for the running kernel

2.3 Mount the Guest Additions ISO

  1. In the VirtualBox window, go to Devices → Insert Guest Additions CD image…
  2. Ubuntu will typically auto‑mount the ISO under /media/$USER/VBox_GAs_x.x.x. If not, mount manually:

sudo mount /dev/cdrom /mnt

2.4 Run the Installer

cd /mnt

sudo sh ./VBoxLinuxAdditions.run

You’ll see a series of compilation messages. At the end you should see:

The X11 video driver is the default driver.

modprobe: ERROR: could not insert ‘vboxvideo’: Operation not permitted

If you get the “Operation not permitted” error, it’s usually caused by Secure Boot on EFI‑based installations. See the troubleshooting section below.

2.5 Verify the Installation

lsmod | grep vbox

You should see vboxguest, vboxsf, and possibly vboxvideo.
Now try:

  • Resize the VM window – the guest should automatically adjust its resolution.
  • Shared Folders – enable a folder via Devices → Shared Folders → Shared Folders Settings… and mount it:

sudo mkdir -p /mnt/shared

sudo mount -t vboxsf <folder_name> /mnt/shared

If everything works, you’re done! 🎉

 

  1. Installing Guest Additions on Rocky Linux

Rocky Linux mirrors the stability of RHEL, so the process is similar to CentOS/Fedora but with dnf as the package manager.

3.1 Update the System

sudo dnf update -y

sudo reboot

3.2 Install Required Packages

sudo dnf install -y gcc make perl kernel-devel kernel-headers dkms

  • kernel-devel provides the exact sources needed to compile the module.
  • dkms works the same way as on Ubuntu, automatically rebuilding modules after kernel updates.

3.3 Mount the Guest Additions ISO

From the VirtualBox GUI: Devices → Insert Guest Additions CD image…

If the ISO doesn’t auto‑mount:

sudo mkdir /mnt/cdrom

sudo mount /dev/cdrom /mnt/cdrom

3.4 Run the Installer

cd /mnt/cdrom

sudo sh ./VBoxLinuxAdditions.run

You’ll see a similar compilation log. Watch for:

Successfully installed the VirtualBox Guest Additions.

If you encounter gcc version mismatches, install the exact version used by the distro:

sudo dnf install gcc-toolset-12

scl enable gcc-toolset-12 bash

Then re‑run the installer.

3.5 Verify the Installation

lsmod | grep vbox

Typical output:

vboxvideo              98304  0

vboxsf                102400  0

vboxguest             614400  2 vboxsf,vboxvideo

Test the features:

  • Dynamic Resizing – drag the VM window edge.
  • Shared Clipboard – copy/paste between host and guest.
  • Shared Folders – create a host folder, add it through the VirtualBox UI, then mount:

sudo mkdir -p /mnt/hostshare

sudo mount -t vboxsf MyShare /mnt/hostshare

That’s it – Rocky Linux now enjoys the full VirtualBox experience.

 

  1. Common Post‑Installation Tweaks
Tweaks Commands / Steps
Enable Seamless Mode In the VirtualBox menu, select View → Seamless Mode (host key + L).
Auto‑Mount Shared Folders Add a line to /etc/fstab:
MyShare /mnt/hostshare vboxsf defaults 0 0
Adjust DPI Scaling for Hi‑DPI Screens Edit /etc/X11/xorg.conf.d/20-vboxvideo.conf and add:
Option “Scale” “2.0”
Keep Guest Additions Updated Use sudo dnf upgrade or sudo apt upgrade. DKMS will rebuild automatically on kernel changes.
Disable 3D Acceleration if you encounter glitches In VirtualBox settings → Display, uncheck Enable 3D Acceleration.

 

  1. Troubleshooting FAQ
Problem Likely Cause Fix
modprobe: ERROR: could not insert ‘vboxvideo’: Operation not permitted Secure Boot refuses unsigned kernel modules. 1. Disable Secure Boot in the VM’s EFI firmware (VirtualBox → Settings → System → Motherboard → Enable EFI).
2. Or sign the modules manually – beyond the scope of this guide.
vboxsf mount fails with “operation not permitted” Guest Additions not loaded for the current user. Add your user to the vboxsf group:
sudo usermod -aG vboxsf $USER → log out/in.
Shared Clipboard not working Guest Additions version mismatch. Ensure the Guest Additions ISO matches the host VirtualBox version (Help → About VirtualBox).
Kernel headers not found (/lib/modules/$(uname -r)/build missing) Kernel version updated but headers not installed. Re‑install linux-headers-$(uname -r) (Ubuntu) or kernel-devel-$(uname -r) (Rocky) and re‑run the installer.
Screen flickers after enabling 3D acceleration Incompatible graphics driver or low video memory. Increase Video Memory in the VM settings (≥128 MB) or disable 3D acceleration.

 

  1. Wrap‑Up & Next Steps

You now have a fully integrated Ubuntu or Rocky Linux guest, complete with dynamic display resizing, shared folders, clipboard sync, and (if you enabled it) 3D acceleration.

What’s next?

  1. Snapshot your VM – After confirming everything works, take a snapshot. Restoring to a clean state becomes a breeze.
  2. Automate with Vagrant – Use Vagrant to spin up reproducible VirtualBox VMs that already contain Guest Additions.
  3. Explore Guest Services – Install additional Guest Additions services like vboxguest-utils for time synchronization, or vboxsf for NFS‑style file sharing.

Enjoy the smoother, more native feel of a properly “guest‑ified” VirtualBox VM!

 

Hashtags

#VirtualBox #GuestAdditions #Ubuntu #RockyLinux #LinuxVM #DevOps #SysAdmin

 

Disclaimer

The steps outlined in this article are accurate as of the latest VirtualBox 7.x releases and the current Ubuntu 24.04 LTS and Rocky Linux 9 releases. System configurations, security policies (e.g., Secure Boot), and package versions can vary; always verify compatibility with your specific environment before applying changes. The author and publisher assume no liability for data loss, system damage, or other consequences resulting from the use of the information provided herein.

 

Share

Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Articles

PenNews Theme v6.7.5 – The Ultimate Deep‑Dive Review

PenNews Theme v6.7.5 – The Ultimate Deep‑Dive Review By [Krishnan] – Professional Blog...

7 Essential AnyDesk Security Settings You Must Enable Today

7 Essential AnyDesk Security Settings You Must Enable Today Published on June 9 2026 |...

Secret Link