Install Guest Additions on Debian

Introduction

In this guide I will be showing you the process for installing VirtualBox Guest Additions on Debian 10. This will include the following

  • Installing packages required for building Guest Additions
  • Building and installing Guest Additions

Install Prerequisites

In order to build and install Guest Additions, you will require the following packages.

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

Install Guest Additions

Now, you will need to make sure that you have mounted the Guest Additions CD. This can be done from within VirtualBox by going to Devices -> Install Guest Additions CD image. If you have done this, great, you're done! If you did this previously and it is already mounted, you can use this command to install it.

sudo /media/cdrom0/VBoxLinuxAdditions.run

If you get the following error
sudo: unable to execute /media/cdrom0/VBoxLinuxAdditions.run: Permission denied then you will need to copy this to another folder and execute it from there.

cp /media/cdrom0/VBoxLinuxAdditions.run .
chmod +x VBoxLinuxAdditions.run
sudo ./VBoxLinuxAdditions.run

After installing, you can remove the file again and reboot

rm ./VBoxLinuxAdditions.run

After a reboot, your VM should now have Guest Additions installed!