How to Install VirtualBox Guest Additions in Debian

In this guide, we will optimize the performance of Debian 9, 10, 11 & 12 virtual machines running on Oracle VM VirtualBox software. When we talk about performance, we will actually install Guest Additions, which are a basic need.

In fact, by installing drivers for the VM, we exploit the full potential of the host hardware in the virtual environment. In particular, you can maximize the capabilities of your Debian virtual machine. So, let’s examine how to install additional packages on a Debian guest machine!

Installing VirtualBox Guest Additions in Debian

Why Should I Install Guest Additions on Debian?

In Oracle VM VirtualBox, you should add Guest Additions to your Debian virtual machine. This lets you use your host computer’s hardware.

For example, you can use your USB devices or webcam. This setup makes your virtual machine work much better.

So, install Guest Additions on your Debian virtual machine. This will quickly make it run faster. You can also use the whole screen with the right screen size.

First, you need to install the Guest Additions in your VirtualBox machine. Then, you can share files between your real computer and your virtual machine.

If you use an old version of Debian, you might have problems here. But if you have a new version like Debian 11, the driver is usually already there. So, I always say to use the latest version.

How to Install Guest Additions on Debian 9, 10, 11 & 12

The installation process for the guest package remains consistent, regardless of your version of Debian. Essential for Linux distributions, the main benefits of this software are:

  • Enhanced graphics experience.
  • File sharing between the host and the VM.
  • Advanced mouse cursor integration.
  • Better compatibility with host computer hardware.
  • Ability to use various devices, such as audio support.

1. Add Guest Additions CD Image

Step 1

If you make your Debian virtual machine full screen, you will see a problem. The picture will not fit your screen correctly. This happens mainly because the Guest Additions are not installed. You need these add-ons for the screen to work right.

Low Screen Resolution of Virtual Machine

Step 2

Now, let’s install the software to make your Linux virtual machine better. First, click on ‘Devices’ in the VirtualBox menu.

Then click on the Insert Guest Additions CD image option from the options that open.

VirtualBox / Devices / Insert Guest Additions CD image

Step 3

Carefully read the warning in the “VBox_GAs” window. Then, if you trust the software, click the Run button.

Starting the Guest Additions Installation

Step 4

As in the image below, you may get the error that the CD image of the guest package could not be started automatically after mounting it to the system.

This error is due to not finding the required autorun program on your system. Click the OK button of the “Error autorunning software” error window.

Error Autorunning software

Step 5

To view the contents of the CD image, open File Manager, click VBox_GAs, and then Right-Click / Open as Root in the directory.

Run as Root

Step 6

Type your Root password and click Authenticate to confirm that the directory is opened with administrator rights.

Authenticating Your Account

Step 7

When you view the CD-ROM as Root, click the correct button again and select Open in Terminal.

Right-Click / Open in Terminal

Step 8

After opening the terminal, you can confidently use the “ls” command to check all the files currently stored in the media easily and quickly. In /media/cdrom0#, type “sh VBoxLinuxAdditions.run,” and press Enter.

ls
sh VBoxLinuxAdditions.run

sh VBoxLinuxAdditions.run

2. Install Kernel Packages for Debian

Step 1

Based on the image below, some packages are missing from your virtual system, preventing the successful installation of Guest Additions. To proceed with the installation, kindly ensure all necessary packages are installed.

Installing Additional Packages

Step 2

Now, on your guest machine, open the terminal in the desktop location.

Open in Terminal

Step 3

Add the image file to the virtual drive to find and install the necessary packages from the Debian ISO file without an Internet connection.

Adding the Debian ISO File

Step 4

Execute the “su -” command on the terminal, type your Root password, and press Enter. Next, execute the “sudo apt update” command.

su -
sudo apt update

In the image below, you need to attach the ISO image!

sudo apt update

Step 5

After executing the “sudo apt upgrade” command, press the Yes (Y) key on the line explaining that additional space is needed for the installation, then press Enter.

sudo apt upgrade

sudo apt upgrade

Step 6

Wait while new versions of existing packages are installed from the ISO file.

Installing Guest Additions

Step 7

After preparing your system, type the “sudo apt install build-essential module-assistant dkms” command and press Enter.

sudo apt install build-essential module-assistant dkms

sudo apt install build-essential module-assistant dkms

Step 8

To continue installing the Linux kernel packages, type Y and press Enter.

Confirming Disk Space Usage

Step 9

Be patient and wait while the kernel packages are being installed.

Setting up gcc

Step 10

And finally, execute the “m-a prepare” command to compile and install the Linux kernel modules.

m-a prepare

m-a prepare

Step 11

You can install virtual machine drivers after installing the necessary packages for your virtual system.

Guest Additions Installed

3. Try Reinstalling Guest Additions

Step 1

Display cdrom0 as Root and open the terminal again.

Rerunning Terminal in Directory

Step 2

Run the “sudo sh VBoxLinuxAdditions.run” command in the terminal to install Debian guest machine drivers.

sudo sh VBoxLinuxAdditions.run

sh VBoxLinuxAdditions.run

Step 3

After installing and preparing the necessary packages from the CD image, you will see that the Guest Additions have been successfully installed.

VirtualBox Guest Additions: Starting

4. Test Virtual Hardware

Step 1

To ensure that the settings you have made are adequate, execute the “shutdown -r now” command in the terminal to restart your Debian virtual computer.

shutdown -r now

shutdown -r now

Step 2

After the reboot, you can now change or resize the screen resolution of your Linux virtual operating system as you wish.

Ability to Adjust Virtual Machine Size

Step 3

You can also operate your system in Full mode using the View tab from the VirtualBox tool menu.

Virtual PC Full Screen

Video

Conclusion

As a result, you should increase the functionality of your Debian virtual machine running on Oracle VM. To do this, you must install Guest Additions on your Debian PC. So you can start using your host PC’s hardware effectively.

Thanks to all the methods I discussed in our article, you can improve the graphics experience of your Debian VM. As a result, you can enable file sharing between the host and VM. Plus, of course, you get more advanced mouse cursor integration.

2 Comments

Add a Comment

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