Install VirtualBox Guest Additions

To install VirtualBox Guest Additions, follow these steps:

  • Stop the virtual machine.

  • Edit the virtual machine settings and from the “System” tab, add a new CD-ROM device to the machine.

  • Restart the virtual machine.

  • Check the current kernel version:

      $ uname -a
  • Install some needed dependencies as shown below. Remember to replace the VERSION placeholder with the kernel version from the previous command. packages with the proper kernel_version shown by the previous command:

      $ sudo apt-get -y install dkms build-essential linux-headers-VERSION
  • Restart the virtual machine:

      $ sudo reboot
  • From the virtual machine menu, select the “Devices -> CD/DVD Devices -> Choose a virtual CD/DVD disk file” option. Select the VBoxGuestAdditions.iso file. This action simulates inserting a CD-ROM that includes the tools.

    The VBoxGuestAdditions.iso file is usually located in the /usr/share/virtualbox/ directory on Linux, in the C:\Program Files\Oracle\VirtualBox directory on Windows and the Contents/MacOS directory of the VirtualBox package on Mac OS X.

  • Mount the CD-ROM and install the VirtualBox Guest Additions:

      $ sudo mkdir /mnt/cdrom
      $ sudo mount /dev/cdrom /mnt/cdrom
      $ cd /mnt/cdrom
      $ sudo sh ./ --nox11

    You can safely ignore the error below if it appears during the installation process:

      Installing the Window System drivers!
      (Could not find the X.Org or XFree86 Window System.)
  • Once the process is complete, check that the output resembles that shown below. If it does, the VirtualBox Guest Additions have been successfully installed.

      Verifying archive integrity... All good.
      Uncompressing VirtualBox 4.1.22 Guest Additions for Linux.........
      VirtualBox Guest Additions installer
      Removing existing VirtualBox DKMS kernel modules ...done.
      Removing existing VirtualBox non-DKMS kernel modules ...done.
      Building the VirtualBox Guest Additions kernel modules ...done.
      Doing non-kernel setup of the Guest Additions ...done.
Last modification September 5, 2018