How to Install VirtualBox Guest Additions in Debian 9 Virtual Machine

This tutorial will show you how to install VirtualBox guest additions in a Debian 9 virtual machine. You need to have a Debian 9 guest OS installed inside VirtualBox to follow the instructions. The type of host OS doesn’t matter.

What is VirtualBox Guest Additions?

VirtualBox guest additions offer the following capabilities:

  1. Enable users to seamlessly move mouse pointer between host and guest.
  2. Allow guest OS to have read and write access to hard drives on the host OS.
  3. Power up the graphics ability of your guest machine. The screen resolution of guest machine can be automatically adjusted and 3D graphics can be accelerated.
  4. Enable bidirectional shared clipboard between host and guest.

How to Install VirtualBox Guest Additions in Debian 9

Boot up your Debian 9 virtual machine. Then switch to root with the following command:

su -

Next, update software.

apt update

apt upgrade

If a new Linux kernel is installed in the upgrade process, then you need to reboot Debian 9 VM. After that, run the following command to install required packages for building kernel modules.

apt install build-essential module-assistant dkms

Once the above packages are installed, prepare your Debian 9 system to build kernel module, which is done with the command below.

m-a prepare

Then in the VirtualBox window, select Devices > Insert Guest Additions CD image.

debian 9 virtualbox guest

You will be asked if you want to run the software. Select Run.

debian 9 stretch virtualbox guest additions

If your host OS doesn’t have the guest additions CD image, then it will ask you to click a button to download the CD image onto the host machine.You can manually download it from http://download.virtualbox.org/virtualbox.

Ubuntu-based Linux distro can also download the CD image with the following command (with root privilege).

apt-get install virtualbox-guest-additions-iso

Once you click the Run button, the CD image is mounted at /media/cdrom/ directory. Under /media/cdrom/ directory there’s a shell script named VboxLinuxAdditions.run. Run this script (with root privilege).

sh /media/cdrom/VBoxLinuxAdditions.run

Outputs:

install virtualbox guest additions in debian 9 stretch

Once guest additions is installed, restart your Debian 9 VM.

shutdown -r now

Now the resizeable display should be working and the resolution of Debian 9 VM will adjust with the size of VirtulBox window.  You can press right Ctrl and F keyboard shortcut to enter full-screen mode. You can now also configure shared folder and bidirectional shared clipboard.

debian stretch guest additions

That’s it! I hope this tutorial helped you install VirtualBox guest additions in Debian 9 Stretch.

Rate this tutorial
[Total: 108 Average: 4.6]

4 Responses to “How to Install VirtualBox Guest Additions in Debian 9 Virtual Machine

  • Priyanka Rai
    5 months ago

    I have problem with virtualbox-guest-addition-iso its showing that i have no virtualbox-guest-addition-iso package is not installed but i have manually downloaded that but i don’t know that after that what i have to do

  • Thanks your suggestions, it helped.

    Below are the step I had to go thru:
    * installed debian10 buster within virtualBox on windows10 laptop .
    * in virtualbox – choose -> debian 10 settings -> storage-> ControllerIDE -> chose guest editions iso when showing empty.
    * then chose start -> debian 10 to run the os.
    * once booted ; in virtual box menu; choose -> Devices -> Insert guest additions cd image.
    * login as root in debian OS
    * cd /media/cdrom0
    * sh ./VBoxLinuxAdditions.run
    * apt-get install (installed — 2 additional packages — if prompted)
    * apt-get install build-essential module-assistant
    * m-a prepare
    * re-ran sh ./VBoxLinuxAdditions.run
    * apt update
    * shutdown -f now

    restart the os and this should work

  • Please note:
    At least for my system, after the step
    Devices > Insert Guest Additions CD image.
    I got an error message about not finding the software. Don’t panic, just move on an run the script manually by opening a terminal by running the install.

     sh /media/cdrom/VBoxLinuxAdditions.run 

    as outlined in the instructions above.

  • Leandro
    1 month ago

    Thanks. Solve my problem.

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.