The following happened to me with Vagrant 2.0 and VirtualBox 5.1.28, though I expect that it affects earlier versions of Vagrant, too.
When using DHCP with NFS, your initial vagrant up
might like this:
[...]
==> 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.0.18_Ubuntu r106667
default: VirtualBox Version: 5.1
==> default: Configuring and enabling network interfaces...
NFS requires a host-only network to be created.
Please add a host-only network to the machine (with either DHCP or a
static IP) for NFS to work.
Note message about version of Guest Addtions and VirtualBox not matching. Turns out the command line tools in VirtualBox 5.1 have trouble reading the values of a VM with the 5.0 additions. I discovered this after much digging around in the debug logs (enabled via VAGRANT_LOG=debug vagrant up
).
With the VM left in this half-configured state, you can see that vagrant was having issues retrieving the IP address:
$ VBoxManage list vms
"test_default_1507227139063_25909" {fa3f0bd6-c8ee-4e27-915d-2fe4358dab9f}
$ VBoxManage guestproperty get fa3f0bd6-c8ee-4e27-915d-2fe4358dab9f /VirtualBox/GuestInfo/Net/1/V4/IP
No value set!
$ VBoxManage guestproperty enumerate fa3f0bd6-c8ee-4e27-915d-2fe4358dab9f
Name: /VirtualBox/HostInfo/GUI/LanguageID, value: ru_RU, timestamp: 1461332937725676000, flags:
Name: /VirtualBox/HostInfo/VBoxVerExt, value: 5.1.28, timestamp: 1507227141332377000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/HostGuest/SysprepExec, value: , timestamp: 1507227141331830000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/HostGuest/SysprepArgs, value: , timestamp: 1507227141331897000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/HostInfo/VBoxRev, value: 117968, timestamp: 1507227141332412000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/HostInfo/VBoxVer, value: 5.1.28, timestamp: 1507227141332326000, flags: TRANSIENT, RDONLYGUEST
Notice the lack of properties -- specifically, the IP address for the host-only network adapter (/VirtualBox/GuestInfo/Net/1/V4/IP
)iwe're looking for is missing.
Sensing a issue between VBoxManage
and VBoxService
in the VM, I decided to install the vagrant-vbguest plugin, which handles auto-updating the guest additions so that they match the VirtualBox version:
vagrant plugin install vagrant-vbguest
Now vagrant destroy -f && vagrant up
:
[...]
[default] GuestAdditions versions on your host (5.1.28) and guest (5.0.18) do not match.
[...whole bunch of linux package updates...]
Installing Virtualbox Guest Additions 5.1.28 - guest version is 5.0.18
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.1.28 Guest Additions for Linux...........
VirtualBox Guest Additions installer
Copying additional installer modules ...
Installing additional modules ...
vboxadd.sh: Starting the VirtualBox Guest Additions.
Could not find the X.Org or XFree86 Window System, skipping.
An error occurred during installation of VirtualBox Guest Additions 5.1.28. Some functionality may not work as intended.
In most cases it is OK that the "Window System drivers" installation failed.
Unmounting Virtualbox Guest Additions ISO from: /mnt
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims: 5.0.18
VBoxService inside the vm claims: 5.1.28
Going on, assuming VBoxService is correct...
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims: 5.0.18
VBoxService inside the vm claims: 5.1.28
Going on, assuming VBoxService is correct...
==> 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.0.18_Ubuntu r106667
default: VirtualBox Version: 5.1
==> default: Configuring and enabling network interfaces...
NFS requires a host-only network to be created.
Please add a host-only network to the machine (with either DHCP or a
static IP) for NFS to work.
Seems that VirtualBox and VBoxService disagree about what the active version is. A vagrant reload
will fix that:
[...]
[default] GuestAdditions 5.1.28 running --- OK.
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
==> default: Installing NFS client...
==> default: Exporting NFS shared folders...
==> default: Preparing to edit /etc/exports. Administrator privileges will be required...
Password:
==> default: Mounting NFS shared folders...
[...]
Now that's it's booted, let's check things out:
$ VBoxManage list vms
"test_default_1507227533358_16521" {4ea7d516-a7b8-4df5-98fc-63026e879bc0}
$ VBoxManage guestproperty get 4ea7d516-a7b8-4df5-98fc-63026e879bc0 /VirtualBox/GuestInfo/Net/1/V4/IP
Value: 172.28.128.5
$ VBoxManage guestproperty enumerate 4ea7d516-a7b8-4df5-98fc-63026e879bc0
Name: /VirtualBox/GuestInfo/OS/Product, value: Linux, timestamp: 1507227708972450000, flags:
Name: /VirtualBox/GuestInfo/Net/0/V4/IP, value: 10.0.2.15, timestamp: 1507227708975021000, flags:
Name: /VirtualBox/HostInfo/GUI/LanguageID, value: ru_RU, timestamp: 1461332937725676000, flags:
Name: /VirtualBox/GuestInfo/Net/0/MAC, value: 08002755129D, timestamp: 1507227708975320000, flags:
Name: /VirtualBox/GuestInfo/OS/ServicePack, value: , timestamp: 1507227708973070000, flags:
Name: /VirtualBox/HostInfo/VBoxVerExt, value: 5.1.28, timestamp: 1507227695329077000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/GuestInfo/Net/1/Status, value: Up, timestamp: 1507227718977258000, flags:
Name: /VirtualBox/GuestInfo/Net/1/V4/Broadcast, value: 172.28.128.255, timestamp: 1507227708975690000, flags:
Name: /VirtualBox/GuestInfo/Net/0/V4/Netmask, value: 255.255.255.0, timestamp: 1507227708975233000, flags:
Name: /VirtualBox/GuestInfo/Net/1/V4/Netmask, value: 255.255.255.0, timestamp: 1507227708975802000, flags:
Name: /VirtualBox/GuestInfo/Net/1/MAC, value: 0800275E2C63, timestamp: 1507227708975912000, flags:
Name: /VirtualBox/GuestInfo/OS/Version, value: #40-Ubuntu SMP Thu May 12 22:03:46 UTC 2016, timestamp: 1507227708972678000, flags:
Name: /VirtualBox/GuestInfo/Net/2/V4/Netmask, value: 255.255.255.0, timestamp: 1507227708976394000, flags:
Name: /VirtualBox/GuestAdd/VersionExt, value: 5.1.28, timestamp: 1507227708973395000, flags:
Name: /VirtualBox/GuestAdd/Revision, value: 117968, timestamp: 1507227708973486000, flags:
Name: /VirtualBox/HostGuest/SysprepExec, value: , timestamp: 1507227695328832000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/GuestInfo/OS/LoggedInUsers, value: 0, timestamp: 1507227708974910000, flags: TRANSIENT, TRANSRESET
Name: /VirtualBox/GuestInfo/Net/0/Status, value: Up, timestamp: 1507227708975409000, flags:
Name: /VirtualBox/GuestInfo/Net/2/MAC, value: 080027C6A75F, timestamp: 1507227708976500000, flags:
Name: /VirtualBox/GuestInfo/Net/2/V4/IP, value: 192.168.121.20, timestamp: 1507227708976217000, flags:
Name: /VirtualBox/GuestInfo/Net/2/V4/Broadcast, value: 192.168.121.255, timestamp: 1507227708976297000, flags:
Name: /VirtualBox/GuestInfo/Net/0/Name, value: eth0, timestamp: 1507227708975508000, flags:
Name: /VirtualBox/HostGuest/SysprepArgs, value: , timestamp: 1507227695328861000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/GuestAdd/Version, value: 5.1.28, timestamp: 1507227708973306000, flags:
Name: /VirtualBox/HostInfo/VBoxRev, value: 117968, timestamp: 1507227695329094000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/GuestInfo/Net/0/V4/Broadcast, value: 10.0.2.255, timestamp: 1507227708975146000, flags:
Name: /VirtualBox/HostInfo/VBoxVer, value: 5.1.28, timestamp: 1507227695329056000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/GuestInfo/Net/1/V4/IP, value: 172.28.128.5, timestamp: 1507227708975597000, flags:
Name: /VirtualBox/GuestInfo/Net/2/Status, value: Up, timestamp: 1507227708976596000, flags:
Name: /VirtualBox/GuestInfo/Net/1/Name, value: eth1, timestamp: 1507227708976114000, flags:
Name: /VirtualBox/GuestInfo/Net/Count, value: 3, timestamp: 1507227738978748000, flags:
Name: /VirtualBox/GuestInfo/OS/Release, value: 4.4.0-22-generic, timestamp: 1507227708972576000, flags:
Name: /VirtualBox/GuestInfo/OS/NoLoggedInUsers, value: true, timestamp: 1507227708974953000, flags: TRANSIENT, TRANSRESET
Name: /VirtualBox/GuestInfo/Net/2/Name, value: eth2, timestamp: 1507227708976702000, flags:
Ahhh... much better!
it works! thanks