The following Vagrantfile used to work, and now it doesn't.
This is an Ubuntu 20.04 install, and I'm using Virtualbox.
Vagrant.configure('2') do |config|
# Set Box
config.vm.box = "generic/ubuntu2004"
# Set hostname
config.vm.hostname = "xxx"
config.vm.define "xxx"
config.vm.provider :virtualbox do |vb|
vb.name = "xxx"
end
# Prevent vagrant-vbguests from being auto updated, this is time consuming and causes version mismatch with host
if Vagrant.has_plugin? "vagrant-vbguest"
config.vbguest.no_install = false
config.vbguest.auto_update = false
config.vbguest.no_remote = true
end
# Enable vagrant-bindfs support, if the plugin is installed
# see https://github.com/gael-ian/vagrant-bindfs for details
if Vagrant.has_plugin?("vagrant-bindfs")
# The bindfs option has one more option, and the /var/nfs
# is where the the folder is synced then it binds it to the
# guest_path after.
#
# Ubuntu 22.04 has UDP disabled for NFS mounts
# https://discourse.ubuntu.com/t/jammy-jellyfish-release-notes/24668
config.vm.synced_folder ".", "/var/nfs", type: "nfs", nfs_udp: false
# This uses uid and gid of the user that started vagrant.
config.nfs.map_uid = Process.uid
config.nfs.map_gid = Process.gid
config.bindfs.bind_folder "/var/nfs", "/vagrant",
perms: 'u=rwX:g=rwD',
u: 'vagrant',
g: 'www-data',
o: 'nonempty'
else
# Enable NFS file system
config.vm.synced_folder ".", "/vagrant", type: "nfs", nfs_udp: false
# This uses uid and gid of the user that started vagrant.
config.nfs.map_uid = Process.uid
config.nfs.map_gid = Process.gid
end
# This uses the vagrant-disksize support, if the plugin is installed
if Vagrant.has_plugin?("vagrant-disksize")
config.disksize.size = '20GB'
end
# Configure RAM
config.vm.provider "virtualbox" do |vb|
# Customize the amount of memory on the VM:
vb.memory = "4096"
vb.cpus = 2
end
# Specify private network
config.vm.network "private_network", ip: "192.168.56.10"
# Port requires for postgres
config.vm.network :forwarded_port, guest: 5432, host: 5432
config.vm.network :forwarded_port, guest: 80, host: 8080
# Enable provisioning with a shell script.
# config.vm.provision :shell, :path => "local/bootstrap.sh"
end
The error I get is:
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
mount -o vers=3 192.168.56.1:/home/steve/Projects/ze /var/nfs
Stdout from the command:
mount.nfs: requested NFS version or transport protocol is not supported
I always run vagrant destroy then vagrant up on each test. What I've done:
- Allowed the vbguests to run and update
- Tried NFS version 4
- Tried it without NFS (it completes but the installation doesn't work)
- Tried "192.168.56.1" as the host IP
- Initially on Vagrant 2.3.4, upgraded to 2.3.7 (and tried everything again)
- Tried to do the mount inside the VM, results typically this:
sudo mount -o vers=3 192.168.56.1:/home/steve/Projects/ze /var/nfs -v
mount.nfs: timeout set for Mon Jul 3 09:06:25 2023
mount.nfs: trying text-based options 'vers=3,addr=192.168.56.1'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: portmap query retrying: RPC: Program not registered
mount.nfs: prog 100003, trying vers=3, prot=17
mount.nfs: portmap query failed: RPC: Program not registered
mount.nfs: requested NFS version or transport protocol is not supported
I'm losing the will to live, so any help would be appreciated.