Debian & VirtualBox Guest Additions Redux

By Andy Barnes
Published

In my previous look at Debian & VirtualBox we looked at installing the Guest Additions from the CD image.

This time we look at enabling the backports in APT and installing it with the distributions package manager.

Housekeeping

As we are going to be playing with kernel's and their modules we want to make sure our system is up-to-date before we start. If you have a policy in place for a production system - you should follow it! We are going through the reboot to avoid issues with APT building VirtualBox kernel modules for a newer kernel than the one currently running.

On my test system, I'm using the quick & dirty method.

$ sudo apt clean && sudo apt update && sudo apt -y dist-upgrade && sudo apt -y autoremove && sudo apt -y autoclean && update-grub && reboot

Futzing with APT to enable backports with contrib

Ensure that the contrib repository is enabled in APT.

$ sudo vim /etc/apt/sources.list
+ deb http://ftp.uk.debian.org/debian/ stretch main contrib non-free

Then add the following to enable the stretch-backports.

+ # stretch-backports
+ deb http://ftp.uk.debian.org/debian/ stretch-backports main contrib

Installation

Now that backports/contrib have been enabled we can install the virtualbox-guest-utils with APT.

$ sudo apt update
$ sudo apt install build-essential module-assistant dkms virtualbox-guest-dkms virutalbox-guest-x11 virtualbox-guest-utils linux-headers-amd64

Module Assistant

Used if you want to install the VirtualBox Guest Utils from the ISO image.

$ sudo m-a prepare
$ sudo mount /media/cdrom
$ sudo sh /media/cdrom/VBoxLinuxAdditions.run

References