How to install Guest additions on Debian 11 (Bullseye) running in VirtualBox

botond published March 2022, 04, Thu - 21:17 time

Content

 

Introductory

Ha VirtualBox, it is advisable to install the integration services (Guest Additions) on the guest system, which provides a higher degree of compatibility with virtual hardware, thus the guest system will be able to make better use of the available hardware resources.

I've made a description before that I have installed guest integration services on a Debian 9 minimal server, and in this description, it is running in a VirtualBox 6.1 Debian 11 (Bullseye) for systems with a KDE desktop environment we will put the Guest Additions package.

Benefits of the Guest Additions package

Installing the package provides the following additional features:

  • Mouse integration
  • Shared directories between host and client machines
  • Improve and enhance video performance
  • Sophisticated desktop integration
  • Generic host-to-guest communication channels that allow guest execution to be managed and controlled.
  • Host-guest time synchronization
  • Split clipboard between host and guest machine
  • Automated entries

 

 

Installing Guest Additions

Start the Debian 11 (Bullseye) guest operating system, then open a terminal and log in as root:

Debian 11 (Bullseye) - Root terminal

Update repositories and packages

First update the our luggage and packages:

apt-get update
apt-get upgrade

Debian 11 (Bullseye) - Updating repositories and packages

Install required packages

A prerequisite for installing Guest Additions is that you have some packages that you can install with the following command:

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

This installs a total of 59,5 MB packages for me:

Debian 11 (Bullseye) - Install required packages

Features of installed packages:

  • dkms: A dkms package is a framework that allows kernel modules to be updated without changing the entire kernel. Rebuilding modules when upgrading kernels is also very easy.
  • linux-headers-xxx: Suitable for our system kernel meta packages.
  • build-essential: A build-essential package provides the additional basic packages needed to build Debian packages

So we need to install these to continue.

Integration Services Insert and mount an ISO file

First, make sure that the virtual machine's CD / DVD drive is empty. You can also do this when configuring the virtual machine on the fly:

Check virtual machine CD / DVD drive

Here you can see that there is currently no ISO file in it, or you can see the same in the top menu of the running virtual machine window with Tools menu - Optical drives also in the submenu where you can see if an ISO file is inserted.

 

 

If there is nothing in it, it is at the top Tools menu at the bottom Installation of integration services Use the menu item to insert the ISO file. The desktop environment then tells us the presence of the new block device:

Debian 11 (Bullseye) - Integration Services ISO file inserted

What is already available between our block devices, so just install:

mount /dev/sr0 /mnt

Here I have the cdrom a / dev / sr0 is available as a device name, which may be different elsewhere, so you can use "universal" instead. / dev / cdrom symbolic link is:

mount /dev/cdrom /mnt

So the two commands do the same thing.

Temporarily a / Mnt We have mounted the contents of the ISO CD in a directory where it does not interfere. Then entering the / Mnt directory, you can also see the contents of the CD:

Debian 11 (Bullseye) - Contents of a mounted ISO file

Once we're done, we just need to run the appropriate boot file.

Start the Integration Services Installer

Run the boot file:

sh ./VBoxLinuxAdditions.run

The installer will then make the necessary kernel changes and other steps:

Debian 11 (Bullseye) - Guest Additions installation is complete

And in the end it tells us that the new kernel modules will be loaded after reboot, so reboot the Debian 11 virtual machine accordingly.

You can also do this from the menu or by issuing the following command:

shutdown -r now

 

Machine restart and check

The first time you restart the machine, the system will start up a little slower. After logging in, open a terminal and check for the presence of the new VirtualBox kernel module in your system:

lsmod | grep vboxguest

Debian 11 (Bullseye) - Checking the VirtualBox kernel module

What may be apparent first is that the bidirectional clipboard works, you can choose from several resolutions in the settings, and so on.

 

 

Conclusion

Installing VirtualBox Guest Additions is a very simple operation, so it's a good idea to do it if you use our virtual machines often. With the services, we can enjoy a higher degree of hardware support, resulting in a faster and more stable guest operating system.