Installing the VirtualBox Guest Additions on Debian 8 (Jessie)
Disclaimer: this is a minimal approach bereft of automagic and thus likely not desirable for most users.
Establish a build environment
Let’s keep it clean and only install the bare minimum of required packages.
# as root apt-get install --no-install-recommends gcc make linux-headers-$(uname -r)
Mount the CD and run the installer
Insert the guest additions CD. From the “Devices” menu in the virtual machine’s menu bar, select the “Insert Guest Additions CD image” option. If you’re using a desktop environment, just ignore the subsequent prompt to manage the device.
# as root mount /media/cdrom0 cd /media/cdrom0 sh VBoxLinuxAdditions.run systemctl reboot
So why does “mount /media/cdrom0” work when omitting the device_file? Because the mount command will check /etc/fstab to find the missing argument:
# /etc/fstab /dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0
I believe the most frequent issue to be the following error: Could not mount the media/drive ‘/opt/VirtualBox/additions/VBoxGuestAdditions.iso’ (VERR_PDM_MEDIA_LOCKED).
Investigate the issue further by using the blkid command to list detailed information about the device.
# as root blkid -po udev /dev/sr0 # Output ID_FS_LABEL=alpine-virt_3.5.0_x86_64 ID_FS_LABEL_ENC=alpine-virt\x203.5.0\x20x86_64 ID_FS_TYPE=iso9660 ID_FS_USAGE=filesystem
Eject the offending iso image by issuing the command:
If you issue “blkid -po udev /dev/sr0 again“, the system should reply with “error: /dev/sr0: No medium found“. Inserting the guest additions CD should now work as expected.