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

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 Run this script (with root privilege).

sh /media/cdrom/


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: 124 Average: 4.7]

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

  • Priyanka Rai
    6 years 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

  • Ron Dsz
    6 years ago

    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 ./
    * apt-get install (installed — 2 additional packages — if prompted)
    * apt-get install build-essential module-assistant
    * m-a prepare
    * re-ran sh ./
    * 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/ 

    as outlined in the instructions above.

  • Leandro
    6 years ago

    Thanks. Solve my problem.

  • Jon Branch
    5 years ago

    I followed the instructions, and the terminal feedback matched what was expected. However, the VirtualBox additions are not working and I’m still stuck on 1024×768. i.e. window resizing does not work. Any thoughts?

  • Ferda Mravenec
    5 years ago

    Try to set Graphic Controller: VBoxSVGA (in VirtualBox tab Settings>Display).

  • Thank you. These steps work correctly for VirtualBox6 and Debian9

  • Thank you!

  • Ananthakrishnan
    5 years ago

    Thank you very much. It helped.

  • I had problems running the program from /media/cdrom until I changet the option for /media/cdrom0 in /etc/fstab, changing it from “user,noauto” to “user,exec,noauto”.

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.
  • Please use the community ( for questions unrelated to this article.
  • I don't have time to answer every question. Making a donation would incentivize me to spend more time answering questions.

The maximum upload file size: 2 MB. You can upload: image. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here