23

I have a Debian 8.1 (headless) virtual machine (guest). How do I install the Virtual Box Guest Additions?

The question How can I install virtual box guest addition is answered for Ubuntu by

sudo apt-get install virtualbox-ose-guest-utils

but that doesn't work for me:

E: Unable to locate package virtualbox-ose-guest-utils
Gustave
  • 1,727

3 Answers3

38

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.

  1. 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.

  2. 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.

    Menu screenshot

  3. Mount the CD:

     # mount /dev/cdrom /media/cdrom
    
  4. cd into the mounted directory:

     # cd /media/cdrom
    
  5. Run the installer:

     # ./VBoxLinuxAdditions.run
    

Or alternatively, if you really want to install from repository:

# apt install virtualbox-guest-utils
gronostaj
  • 58,482
18

This works for me (Debian GNU/Linux 8 (Jessie) 64-bit):

  1. Login as root with terminal command su press Enter and then type your root password
  2. Update your APT database with apt-get update
  3. Install the latest security updates with apt-get upgrade
  4. Install required packages with apt-get install build-essential module-assistant
  5. Configure your system for building kernel modules by running m-a prepare
  6. Click on Install Guest Additions… from the VirtualBox Devices menu
  7. Run mount /dev/sr0 /media/cdrom
  8. Run sh /media/cdrom/VBoxLinuxAdditions.run, and follow the instructions on screen.
ifconfig
  • 697
menkow
  • 281
6

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.

simen
  • 61