lavabit / robox

The tools needed to robotically create/configure/provision a large number of operating systems, for a variety of hypervisors, using packer.
627 stars 139 forks source link

VirtualBox Guest Additions outdated in ubuntu1804 #104

Closed felipecrs closed 4 years ago

felipecrs commented 4 years ago

Just tried a vagrant init generic/ubuntu1804 --box-version 2.0.6 and vagrant up,

==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default:
    default: Guest Additions Version: 5.2.32
    default: VirtualBox Version: 6.0

Below is a suggested script to fetch and install latest VirtualBox Guest Additions:

#!/bin/bash

set -ex
export DEBIAN_FRONTEND=noninteractive

# Install dependencies
sudo apt-get update
sudo apt-get install -y curl linux-headers-$(uname -r) build-essential dkms

## Fetch latest version
BASE_URL="https://download.virtualbox.org/virtualbox"
VERSION="$(curl -fsSL "${BASE_URL}/LATEST-STABLE.TXT")"

## Install
ADDITIONS_ISO="VBoxGuestAdditions_${VERSION}.iso"
ADDITIONS_PATH="/media/VBoxGuestAdditions"
wget --quiet "${BASE_URL}/${VERSION}/${ADDITIONS_ISO}"
sudo mkdir "${ADDITIONS_PATH}"
sudo mount -o loop,ro "${ADDITIONS_ISO}" "${ADDITIONS_PATH}"
# Return code when success is 2
sudo "${ADDITIONS_PATH}/VBoxLinuxAdditions.run" --nox11 || [ "$?" = 2 ] && true || false
rm "${ADDITIONS_ISO}"
sudo umount "${ADDITIONS_PATH}"
sudo rmdir "${ADDITIONS_PATH}"
timschumi commented 4 years ago

Those guest additions are installed from the Ubuntu 18.04 repository (at least in the case of the ubuntu1804 box). That saves from possible issues when compiling and installing manually.

Those guest additions being outdated is not an issue, the actual API hasn't been updated in a while. (As the script says: "In most cases this is fine, but in rare cases it can prevent things such as shared folders from working properly.")

If the warning itself annoys you, there is a Vagrantfile flag somewhere to disable that check.