Skip to content

Instantly share code, notes, and snippets.

@Bubblemelon
Last active July 16, 2018 22:06
Show Gist options
  • Save Bubblemelon/5fe5b3773da4c55c058601feb8d9bda6 to your computer and use it in GitHub Desktop.
Save Bubblemelon/5fe5b3773da4c55c058601feb8d9bda6 to your computer and use it in GitHub Desktop.
Vagrant Error when Mounting NFS Shared Folders
==> default: Exporting NFS shared folders...
==> default: Preparing to edit /etc/exports. Administrator privileges will be required...
==> default: Mounting NFS shared folders...
#<Thread:0x0000559cdeada360@/usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/batch_action.rb:71 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
        52: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/batch_action.rb:82:in `block (2 levels) in run'
        51: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/machine.rb:188:in `action'
        50: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/machine.rb:188:in `call'
        49: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/environment.rb:592:in `lock'
        48: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/machine.rb:202:in `block in action'
        47: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/machine.rb:227:in `action_raw'
        46: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/runner.rb:66:in `run'
        45: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/util/busy.rb:19:in `busy'
        44: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/runner.rb:66:in `block in run'
        43: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/builder.rb:116:in `call'
        42: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
        41: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
        40: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
        39: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/builtin/call.rb:53:in `call'
        38: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/runner.rb:66:in `run'
        37: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/util/busy.rb:19:in `busy'
        36: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/runner.rb:66:in `block in run'
        35: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/builder.rb:116:in `call'
        34: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
        33: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
        32: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
        31: from /usr/share/vagrant/gems/gems/vagrant-libvirt-0.0.40/lib/vagrant-libvirt/action/set_name_of_domain.rb:35:in `call'
        30: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
        29: from /usr/share/vagrant/gems/gems/vagrant-libvirt-0.0.40/lib/vagrant-libvirt/action/handle_storage_pool.rb:52:in `call'
        28: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
        27: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/builtin/handle_box.rb:56:in `call'
        26: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
        25: from /usr/share/vagrant/gems/gems/vagrant-libvirt-0.0.40/lib/vagrant-libvirt/action/handle_box_image.rb:113:in `call'
        24: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
        23: from /usr/share/vagrant/gems/gems/vagrant-libvirt-0.0.40/lib/vagrant-libvirt/action/create_domain_volume.rb:82:in `call'
        22: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
        21: from /usr/share/vagrant/gems/gems/vagrant-libvirt-0.0.40/lib/vagrant-libvirt/action/create_domain.rb:308:in `call'
        20: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
        19: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/builtin/provision.rb:80:in `call'
        18: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
        17: from /usr/share/vagrant/gems/gems/vagrant-libvirt-0.0.40/lib/vagrant-libvirt/action/prepare_nfs_valid_ids.rb:12:in `call'
        16: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
        15: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/plugins/synced_folders/nfs/action_cleanup.rb:25:in `call'
        14: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
        13: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/builtin/synced_folder_cleanup.rb:28:in `call'
        12: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
        11: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/builtin/synced_folders.rb:90:in `call'
        10: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/builtin/synced_folders.rb:90:in `each'
         9: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/builtin/synced_folders.rb:93:in `block in call'
         8: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/plugins/synced_folders/nfs/synced_folder.rb:108:in `enable'
         7: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/guest.rb:43:in `capability'
         6: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/capability_host.rb:111:in `capability'
         5: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/capability_host.rb:111:in `call'
         4: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/plugins/guests/linux/cap/nfs.rb:17:in `mount_nfs_folder'
         3: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/plugins/guests/linux/cap/nfs.rb:17:in `each'
         2: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/plugins/guests/linux/cap/nfs.rb:31:in `block in mount_nfs_folder'
         1: from /usr/share/vagrant/gems/gems/vagrant-2.0.2/plugins/communicators/ssh/communicator.rb:267:in `sudo'
/usr/share/vagrant/gems/gems/vagrant-2.0.2/plugins/communicators/ssh/communicator.rb:257:in `execute': The following SSH command responded with a non-zero exit status. (Vagrant::Errors::VagrantError)
Vagrant assumes that this means the command failed!

mkdir -p /vagrant

Stdout from the command:



Stderr from the command:
mkdir: cannot create directory ‘/vagrant’: Permission denied
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mkdir -p /vagrant

Stdout from the command:



Stderr from the command:

mkdir: cannot create directory ‘/vagrant’: Permission denied
@Bubblemelon
Copy link
Author

Bubblemelon commented Jul 6, 2018

Collin got back to me and mentioned that the Permission denied error is caused by the ostree model, as it does not permit new top level directories. i.e. /vagrant

So to avoid having that error show up, disable the shared folder configuration in the Vagrantfile with the following edit:
config.vm.synced_folder ".", "/vagrant", disabled: true

It doesn't matter what the host and guest paths are in the above because config.vm.synced_folder will not setup during vagrant up

Info on disabled option

@Bubblemelon
Copy link
Author

Bubblemelon commented Jul 6, 2018

Additionally, I've tried running vagrant up with these configurations but get the following errors:

(1)

config.vm.synced_folder ".", "/home/vagrant/sync-file", create:true ,disabled:false, type: "nfs", nfs_version: 4, nfs_udp: false

==> default: Mounting NFS shared folders...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mount -o vers=4 192.168.121.1:/home/cherylfong/rhcos /home/vagrant/sync-file

Stdout from the command:



Stderr from the command:

mount.nfs: access denied by server while mounting 192.168.121.1:/home/cherylfong/rhcos

(2)

This config.vm.synced_folder ".", "/home/vagrant/sync-file", create:true ,disabled:false, type: "nfs" and config.vm.synced_folder ".", "/home/vagrant/sync-file", create:true ,disabled:false yielded the same output:

==> default: Mounting NFS shared folders...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mount -o vers=3,udp 192.168.121.1:/home/cherylfong/rhcos /home/vagrant/sync-file

Stdout from the command:



Stderr from the command:

mount.nfs: No route to host

Steps taken:

  1. some forums say disable/stop iptables service, but I didn't have this service unit to begin with.
  2. made sure nfs-server was running.
  3. running exportfs -a -v didn't help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment