If you run VirtualBox and Vagrant, you might have seen this error message:
default: No guest additions were detected on the base box for this VM! Guest
default: additions are required for forwarded ports, shared folders, host only
default: networking, and more. If SSH fails on this machine, please install
default: the guest additions and repackage the box to continue.
default:
default: This is not an error message; everything may continue to work properly,
default: in which case you may ignore this message.
default: No guest additions were detected on the base box for this VM! Guest
default: additions are required for forwarded ports, shared folders, host only
default: networking, and more. If SSH fails on this machine, please install
default: the guest additions and repackage the box to continue.
default:
default: This is not an error message; everything may continue to work properly,
default: in which case you may ignore this message.
After some Google searches, I found that it’s usually related to /etc/udev/rules.d/70-persistent-net.rules
. See https://github.com/mitchellh/vagrant/issues/997, https://github.com/mitchellh/vagrant/issues/3341. But that was not the case for me. Note: this only happens to me if I do vagrant reload
(or equivalently vagrant halt
and subsequently vagrant up
). It does not happen when i do vagrant up
for the first time or vagrant destroy
then vagrant up
.
Although it could not detect the VirtualBox guest, Vagrant still makes the SSH connection. After vagrant ssh
, I’m logged in on the VirtualBox guest. Doing a lsmod | grep vbox
yields nothing. So, I realized this happens to me because I ran yum update
, which updated the kernel. But the new kernel does not have the VirtualBox guest additions, so VirtualBox could not detect the guest after reboot.
In order to fix it, follow the instructions on https://docs.vagrantup.com/v2/virtualbox/boxes.html to reinstall VirtualBox guest additions.
wget http://download.virtualbox.org/virtualbox/5.0.12/VBoxGuestAdditions_5.0.12.iso
sudo mkdir /media/VBoxGuestAdditions
sudo mount -o loop,ro VBoxGuestAdditions_5.0.12.iso /media/VBoxGuestAdditions
sudo sh /media/VBoxGuestAdditions/VBoxLinuxAdditions.run
rm VBoxGuestAdditions_5.0.12.iso
sudo umount /media/VBoxGuestAdditions
sudo rmdir /media/VBoxGuestAdditions
If the installation failed, check if all the necessary packages are installed on the guest (Scientific Linux OS for me).
sudo yum -y install kernel-devel gcc make perl
sudo yum -y clean all