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:
- Enable users to seamlessly move mouse pointer between host and guest.
- Allow guest OS to have read and write access to hard drives on the host OS.
- 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.
- 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.
You will be asked if you want to run the software. Select Run.
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:
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.
That’s it! I hope this tutorial helped you install VirtualBox guest additions in Debian 9 Stretch.
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.
as outlined in the instructions above.
Thanks. Solve my problem.
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?
Try to set Graphic Controller: VBoxSVGA (in VirtualBox tab Settings>Display).
Sorry VMSVGA is right 🙂
Thank you. These steps work correctly for VirtualBox6 and Debian9
Thank you!
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”.