Unbork Vagrant after VirtualBox upgrade
If Virtualbox is upgraded after installing vagrant, then the virtualbox guest additions that vagrant inserts(?) into the VM will not match the running virtualbox. This causes vagrant to whinge and in some cases not run the defined provisioners.
The solution is to install the vagrant-vbguest plugin which will update the guest additions each time vagrant up is run. Install from same dir as vagrant file:
$ vagrant plugin install vagrant-vbguest Installing the 'vagrant-vbguest' plugin. This can take a few minutes... Installed the plugin 'vagrant-vbguest (0.9.0)'! $ vagrant up Bringing machine 'default' up with 'virtualbox' provider... [default] Importing base box 'ceph-swift'... [default] Matching MAC address for NAT networking... [default] Setting the name of the VM... [default] Clearing any previously set forwarded ports... [default] Creating shared folders metadata... [default] Clearing any previously set network interfaces... [default] Preparing network interfaces based on configuration... [default] Forwarding ports... [default] -- 22 => 2222 (adapter 1) [default] Booting VM... GuestAdditions versions on your host (4.3.2) and guest (4.2.0) do not match. stdin: is not a tty Reading package lists... Building dependency tree... Reading state information... The following extra packages will be installed: fakeroot linux-headers-3.2.0-23 make patch Suggested packages: make-doc diffutils-doc The following NEW packages will be installed: dkms fakeroot linux-headers-3.2.0-23 linux-headers-3.2.0-23-generic make patch 0 upgraded, 6 newly installed, 0 to remove and 66 not upgraded. Need to get 12.7 MB of archives. After this operation, 68.5 MB of additional disk space will be used. Get:1 http://us.archive.ubuntu.com/ubuntu/ precise/main make amd64 3.81-8.1ubuntu1 [118 kB] Get:2 http://us.archive.ubuntu.com/ubuntu/ precise/main patch amd64 2.6.1-3 [80.2 kB] Get:3 http://us.archive.ubuntu.com/ubuntu/ precise/main dkms all 184.108.40.206-1ubuntu3 [73.1 kB] Get:4 http://us.archive.ubuntu.com/ubuntu/ precise/main fakeroot amd64 1.18.2-1 [87.2 kB] Get:5 http://us.archive.ubuntu.com/ubuntu/ precise/main linux-headers-3.2.0-23 all 3.2.0-23.36 [11.4 MB] Get:6 http://us.archive.ubuntu.com/ubuntu/ precise/main linux-headers-3.2.0-23-generic amd64 3.2.0-23.36 [947 kB] dpkg-preconfigure: unable to re-open stdin: No such file or directory Fetched 12.7 MB in 8s (1,523 kB/s) Selecting previously unselected package make. (Reading database ... 51095 files and directories currently installed.) Unpacking make (from .../make_3.81-8.1ubuntu1_amd64.deb) ... Selecting previously unselected package patch. Unpacking patch (from .../patch_2.6.1-3_amd64.deb) ... Selecting previously unselected package dkms. Unpacking dkms (from .../dkms_220.127.116.11-1ubuntu3_all.deb) ... Selecting previously unselected package fakeroot. Unpacking fakeroot (from .../fakeroot_1.18.2-1_amd64.deb) ... Selecting previously unselected package linux-headers-3.2.0-23. Unpacking linux-headers-3.2.0-23 (from .../linux-headers-3.2.0-23_3.2.0-23.36_all.deb) ... Selecting previously unselected package linux-headers-3.2.0-23-generic. Unpacking linux-headers-3.2.0-23-generic (from .../linux-headers-3.2.0-23-generic_3.2.0-23.36_amd64.deb) ... Processing triggers for man-db ... Setting up make (3.81-8.1ubuntu1) ... Setting up patch (2.6.1-3) ... Setting up dkms (18.104.22.168-1ubuntu3) ... Setting up fakeroot (1.18.2-1) ... update-alternatives: using /usr/bin/fakeroot-sysv to provide /usr/bin/fakeroot (fakeroot) in auto mode. Setting up linux-headers-3.2.0-23 (3.2.0-23.36) ... Setting up linux-headers-3.2.0-23-generic (3.2.0-23.36) ... Examining /etc/kernel/header_postinst.d. run-parts: executing /etc/kernel/header_postinst.d/dkms 3.2.0-23-generic /boot/vmlinuz-3.2.0-23-generic Copy iso file /Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso stdin: is not a tty mount: warning: /mnt seems to be mounted read-only. Installing Virtualbox Guest Additions 4.3.2 - guest version is 4.2.0 stdin: is not a tty Verifying archive integrity... All good. Uncompressing VirtualBox 4.3.2 Guest Additions for Linux............ VirtualBox Guest Additions installer Removing installed version 4.2.0 of VirtualBox Guest Additions... Copying additional installer modules ... Installing additional modules ... 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. You should restart your guest to make sure the new modules are actually used Installing the Window System drivers ...fail! (Could not find the X.Org or XFree86 Window System.) An error occurred during installation of VirtualBox Guest Additions 4.3.2. Some functionality may not work as intended. stdin: is not a tty [default] Waiting for machine to boot. This may take a few minutes... [default] Machine booted and ready! [default] Setting hostname... [default] Mounting shared folders... [default] -- /vagrant [default] -- /tmp/vagrant-chef-1/chef-solo-1/cookbooks [default] Running provisioner: chef_solo... Generating chef JSON and uploading... Running chef-solo... stdin: is not a tty [2013-11-11T19:58:14+00:00] INFO: *** Chef 10.14.2 ***
It complained because my VM is non graphical, but the upgrade did actually succeed and the chef provisioner started.
Thanks to Kevin van Zonneveld for the tip.