Using NFS with vagrant doesn't work

For Linux I do this in the host machine:

systemctl stop nfs-kernel-server.service
systemctl disable nfs-kernel-server.service
systemctl enable nfs-kernel-server.service
systemctl start nfs-kernel-server.service

It could happen due to host VirtualBox and Guest Additions version mismatch. In this case just before the error line in your boot log, you should be getting:

  ==> 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.26
  default: VirtualBox Version: 5.1

In my case updating VirtualBox to the newest version fixed the issue.

Alternatively you can make sure the correct Guest Addition version is installed using vbguest Vagrant plugin on your host machine:

vagrant plugin install vagrant-vbguest