How to install Virtual Box Guest Additions on Debian?
From my experience Guest Additions that are bundled with VirtualBox work better. Here are steps to install them. All commands have to be executed as root.
-
Install kernel headers, build tools and DKMS:
# apt update # apt install build-essential dkms
DKMS isn't required, but it will keep Guest Additions working after kernel updates. Otherwise you'd have to reinstall them.
-
Insert the virtual CD using appropriate menu item in VirtualBox menu:
Please note that this is a host menu. It's not inside the Debian VM. In fullscreen you may have to move your mouse to the top of the screen to reveal it. If it's hidden in windowed mode, see this question.
-
Mount the CD:
# mount /dev/cdrom /media/cdrom
-
cd
into the mounted directory:# cd /media/cdrom
-
Run the installer:
# ./VBoxLinuxAdditions.run
Or alternatively, if you really want to install from repository:
# apt install virtualbox-guest-utils
This works for me (Debian GNU/Linux 8 (Jessie) 64-bit):
- Login as root with terminal command
su
press Enter and then type your root password - Update your APT database with
apt-get update
- Install the latest security updates with
apt-get upgrade
- Install required packages with
apt-get install build-essential module-assistant
- Configure your system for building kernel modules by running
m-a prepare
- Click on Install Guest Additions… from the VirtualBox Devices menu
- Run
mount /dev/sr0 /media/cdrom
- Run
sh /media/cdrom/VBoxLinuxAdditions.run
, and follow the instructions on screen.
I got permissions denied when I tried to run "VBoxLinuxAdditions.run" so I changed the file /etc/fstab
to user,exec
. Other than that the steps that gronostaj mentioned worked perfectly.
Explanation from virtualbox forum:
..the filesystem is mounted with the noexec option, so the execute permission bits on all files are ignored, and you cannot directly execute any program residing on this filesystem. Note that the noexec mount option is implied by the user option in /etc/fstab. ... If you use user and want to have executable files, use user,exec.