Quickly Install VirtualBox Guest Additions on Debian 12 VM

This tutorial servers a guide to quickly install VirtualBox Guest Additions on Debian 12. VirtualBox Guest Additions are designed to be installed inside a virtual machine after the guest operating system has been installed. They consist of device drivers and system applications that optimize the guest operating system for better performance and usability.

Quickly Install VirtualBox Guest Additions on Debian 12 VM

If you are installing Debian 12 on VirtualBox, then VirtualBox 7 support unattended guest installation which also includes an option to install VirtualBox guest additions automatically;

Install VirtualBox Guest Additions on Debian 12

Anyways, if you missed that, then this guide will help you.

Install Required Packages

To begin, run the command below to install required packages;

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

Once the installation completes, reboot the system;

systemctl reboot -i

Ensure the installed linux headers and system kernel release version matches;

uname -r

Output;

6.1.0-9-amd64

Check kernel release version;

sudo dpkg -l | grep linux-headers

Sample output;

ii  linux-headers-6.1.0-9-amd64             6.1.27-1                                      amd64        Header files for Linux 6.1.0-9-amd64
ii  linux-headers-6.1.0-9-common            6.1.27-1                                      all          Common header files for Linux 6.1.0-9
ii  linux-headers-amd64                     6.1.27-1                                      amd64        Header files for Linux amd64 configuration (meta-package)

ii means installed.

Install/Inset VirtualBox Guest Additions ISO on Debian 12

So, you can install VirtualBox guest additions;

  • by inserting guest additions ISO file from VirtualBox VM menu or
  • by installing guest additions ISO from the system repositories.

Install Guest Additions ISO from System Repos

The quickest way to insert the guest additions ISO file is to install from the default Debian 12 repositories.

The packages usually provided the guest additions ISO for the currently installed version of VirtualBox on your host.

To confirm the same, run the command below on the host to check the currently installed version of VirtualBox;

vboxmanage --version

Sample output;

7.0.8r156879

Then, on the Debian 12 virtual machine, check the available version of Guest Additions iso;

apt-cache policy virtualbox-guest-additions-iso

As of this writing, this packaege is not available on Debian 12 repos.

virtualbox-guest-additions-iso:
  Installed: (none)
  Candidate: (none)
  Version table:

If it is available, then you can install Guest Additions ISO by running the command below;

apt install virtualbox-guest-additions-iso -y

Install/Insert Guest Additions ISO file from VM Menu

From the VM menu, click Devices > Insert Guest Additions CD Image…

Before you insert, ensure you have an empty IDE controller under storage settings.

Install VirtualBox Guest Additions on Debian 12

Install VirtualBox Guest Additions on Debian 12 VM

Once the insertion of Guest Additions ISO file is done, proceed to install VirtualBox Guest Additions on Debian 12 VM.

Mount the ISO file (for the ISO installed from APT repos);

mount -o loop /usr/share/virtualbox/VBoxGuestAdditions.iso /mnt

For the ISO inserted from the VM menu, mount it as follows;

/mount -o loop /dev/cdrom /mnt

Install VirtualBox Guest Additions on Debian 12 VM;

/mnt/VBoxLinuxAdditions.run

Sample installation output;

Verifying archive integrity...  100%   MD5 checksums are OK. All good.
Uncompressing VirtualBox 7.0.8 Guest Additions for Linux  100%  
VirtualBox Guest Additions installer
Copying additional installer modules ...
Installing additional modules ...
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Setting up modules
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel 
modules.  This may take a while.
VirtualBox Guest Additions: To build modules for other installed kernels, run
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup 
VirtualBox Guest Additions: or
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup all
VirtualBox Guest Additions: Building the modules for kernel 6.1.0-9-amd64.
update-initramfs: Generating /boot/initrd.img-6.1.0-9-amd64
VirtualBox Guest Additions: Running kernel modules will not be replaced until 
the system is restarted or 'rcvboxadd reload' triggered
VirtualBox Guest Additions: reloading kernel modules and services
VirtualBox Guest Additions: kernel modules and services 7.0.8 r156879 reloaded
VirtualBox Guest Additions: NOTE: you may still consider to re-login if some 
user session specific services (Shared Clipboard, Drag and Drop, Seamless or 
Guest Screen Resize) were not restarted automatically

Pay attention to the last message;

NOTE: you may still consider to re-login if some user session specific services (Shared Clipboard, Drag and Drop, Seamless or Guest Screen Resize) were not restarted automatically

Either way, let’s reboot the system;

systemctl reboot -i

Upon login, the screen should at least auto-resize.

If it don’t auto-resize automatically, you need toggle Auto-resize Guest Display Off and On by navigating to the VM menu, click View > Auto-resize Guest Display.

Install VirtualBox Guest Additions on Debian 12

And that is it on how to Quickly install VirtualBox Guest Additions on Debian 12 VM.

Other Tutorials

Install Ubuntu 22.04 Desktop on VirtualBox

Install Ubuntu 21.04 Desktop on VirtualBox

Install Debian 11 Bullseye on VirtualBox

Founder of itnixpro.com|Linux Engineer|Author at Itnixpro.com

Leave a Comment