VirtualBox

How to Install VirtualBox Guest Additions on Debian 12 Oracle VirtualBox Virtual Machines

VirtualBox Guest Additions enables the features like auto-resizing of the virtual machine screen, 2D/3D acceleration, shared clipboard, shared folder, and others on the VirtualBox virtual machine. These features improve the user experience of the VirtualBox virtual machines. For more information on VirtualBox Guest Additions, read this article.

In this article, we will show you how to install the VirtualBox Guest Additions on the Debian 12 Oracle VirtualBox virtual machines.

Topic of Contents:

  1. Installing the GCC and Linux Kernel Headers on the Debian 12 VirtualBox Virtual Machine
  2. Mounting the VirtualBox Guest Additions CD Image on the Debian 12 Virtual Machine
  3. Installing the VirtualBox Guest Additions on the Debian 12 VirtualBox Virtual Machine
  4. Verifying If the VirtualBox Guest Additions Is Installed Correctly on the Debian 12 Virtual Machine
  5. Conclusion

Installing the GCC and Linux Kernel Headers on the Debian 12 VirtualBox Virtual Machine

To build the VirtualBox Guest Additions kernel modules on Debian 12, you must have the GCC C/C++ compiler and Linux kernel headers installed on your Debian 12 system.

If you need any assistance in installing the GCC C/C++ compiler on your Debian 12 system, read the article on How to Install the GCC C/C++ Compiler on Debian 12.

If you need any assistance in installing the correct Linux kernel headers on your Debian 12 system, read the article on How to Install the Linux Kernel Headers on Debian 12.

Mounting the VirtualBox Guest Additions CD Image on the Debian 12 Virtual Machine

To mount the VirtualBox Guest Additions CD image on the Debian 12 VirtualBox virtual machine, run the Debian 12 VirtualBox virtual machine and click on Devices > Insert Guest Additions CD image as marked in the following screenshot:

A screenshot of a computer Description automatically generated

Once the VirtualBox Guest Additions CD image is inserted into the Debian 12 VirtualBox virtual machine, run the following command to mount the VirtualBox Guest Additions CD image on the “/mnt” directory of your Debian 12 virtual machine.

$ sudo mount /dev/sr0 /mnt

A screenshot of a computer Description automatically generated

Once the VirtualBox Guest Additions CD image is mounted, you can navigate to the “/mnt” directory and see the contents of the VirtualBox Guest Additions CD image.

$ cd /mnt

$ ls -lh

A screenshot of a computer Description automatically generated

Installing the VirtualBox Guest Additions on the Debian 12 VirtualBox Virtual Machine

To install the VirtualBox Guest Additions on the Debian 12 VirtualBox virtual machine, run the following command from the “/mnt” directory:

$ sudo ./VBoxLinuxAdditions.run

VirtualBox Guest Additions is being installed on the Debian 12 VirtualBox virtual machine. It takes a few seconds to complete.

A screenshot of a computer Description automatically generated

The VirtualBox Guest Additions should be installed on the Debian 12 VirtualBox virtual machine at this point.

A screenshot of a computer Description automatically generated

For the changes to take effect, reboot your Debian 12 VirtualBox virtual machine with the following command:

$ sudo reboot

Verifying If the VirtualBox Guest Additions Is Installed Correctly on the Debian 12 Virtual Machine

The easiest way to verify if the VirtualBox Guest Additions is working on the Debian 12 VirtualBox virtual machine is to resize the Debian 12 virtual machine window and see if the virtual machine screen is being resized automatically as well. If the screen auto-resizing works for the Debian 12 virtual machine, the VirtualBox Guest Additions is working on the Debian 12 VirtualBox virtual machine.

A screenshot of a computer Description automatically generated

Conclusion

We showed you how to install the VirtualBox Guest Additions on the Debian 12 Oracle VirtualBox virtual machines so that you will have a better Debian 12 user experience on the Oracle VirtualBox virtual machines.

About the author

Shahriar Shovon

Freelancer & Linux System Administrator. Also loves Web API development with Node.js and JavaScript. I was born in Bangladesh. I am currently studying Electronics and Communication Engineering at Khulna University of Engineering & Technology (KUET), one of the demanding public engineering universities of Bangladesh.