hashicorp/vagrant · error · Vagrant::Errors::NFSDupePerms
You have attempted to export the same nfs host path at %{hos
Error message
You have attempted to export the same nfs host path at %{hostpath} with
different nfs permissions. Please pick one permission and reload your guest. What it means
Vagrant::Errors::NFSDupePerms raised at plugins/hosts/linux/cap/nfs.rb:151. While collapsing synced folders that share a hostpath (group_by on :hostpath), the Linux cap checks that every group member has identical linux__nfs_options; /etc/exports cannot carry two permission sets for one directory, so a mismatch raises naming the path. Comparison is plain array equality — element order matters.
Source
Thrown at plugins/hosts/linux/cap/nfs.rb:151
# Takes a hash of folders and removes any duplicate exports that
# share the same hostpath to avoid duplicate entries in /etc/exports
# ref: GH-4666
def self.folder_dupe_check(folders)
return_folders = {}
# Group by hostpath to see if there are multiple exports coming
# from the same folder
export_groups = folders.values.group_by { |h| h[:hostpath] }
# We need to check that each group key only has 1 value,
# and if not, check each nfs option. If all nfs options are the same
# we're good, otherwise throw an exception
export_groups.each do |path,group|
if group.size > 1
# if the linux nfs options aren't all the same throw an exception
group1_opts = group.first[:linux__nfs_options]
if !group.all? {|g| g[:linux__nfs_options] == group1_opts}
raise Vagrant::Errors::NFSDupePerms, hostpath: group.first[:hostpath]
else
# if they're the same just pick the first one
return_folders[path] = group.first
end
else
# just return folder, there are no duplicates
return_folders[path] = group.first
end
end
return_folders
end
def self.nfs_cleanup(remove_ids)
return if !File.exist?(NFS_EXPORTS_PATH)
editor = Vagrant::Util::StringBlockEditor.new(nfs_exports_content)
remove_ids = Array(remove_ids)
View on GitHub (pinned to 35f3160f4a)
Solutions
- Make linux__nfs_options identical — same elements in the same order — for every synced folder sharing that host path
- Or consolidate to a single synced_folder entry for the shared directory
- Run `vagrant reload` after fixing the Vagrantfile
Example fix
# before — same host path, two different option sets config.vm.synced_folder "/srv/shared", "/a", type: "nfs", linux__nfs_options: ["rw","no_subtree_check","all_squash"] config.vm.synced_folder "/srv/shared", "/b", type: "nfs", linux__nfs_options: ["ro","no_subtree_check"] # after — one consistent option set for /srv/shared config.vm.synced_folder "/srv/shared", "/a", type: "nfs", linux__nfs_options: ["rw","no_subtree_check","all_squash"] config.vm.synced_folder "/srv/shared", "/b", type: "nfs", linux__nfs_options: ["rw","no_subtree_check","all_squash"]
Defensive patterns
Strategy: validation
Validate before calling
# Pre-flight: assert one option set per host path before vagrant up
folders = { "/a" => { hostpath: "/srv/shared", linux__nfs_options: ["rw","no_subtree_check"] },
"/b" => { hostpath: "/srv/shared", linux__nfs_options: ["ro","no_subtree_check"] } }
folders.group_by { |_, o| File.expand_path(o[:hostpath]) }.each do |path, list|
uniq = list.map { |_, o| o[:linux__nfs_options] }.uniq
abort "#{path} exported with #{uniq.size} different nfs option sets" if uniq.size > 1
end Try / catch
begin
HostLinux::Cap::NFS.nfs_export(env, ui, id, ips, folders)
rescue Vagrant::Errors::NFSDupePerms => e
puts "conflicting options for #{e.data[:hostpath]} — unify linux__nfs_options"
raise
end Prevention
- Define linux__nfs_options once (a constant) and reuse it for shared paths
- Remember array order matters in the equality check
- Prefer one synced_folder per shared host directory
When it happens
Trigger: A Vagrantfile where two or more `type: "nfs"` synced_folders resolve to the same host path but their linux__nfs_options arrays differ in content or order (e.g. one with defaults, one customized; rw vs ro; different uid/gid mappings).
Common situations: Copy-pasting a synced_folder block and tweaking options; multi-machine Vagrantfiles sharing a host dir with per-machine options; identical option sets listed in different orders (still unequal via ==).
Related errors
- NFS is reporting that your exports file is invalid. Vagrant
- Vagrant failed to install an updated NFS exports file. This
- The synced folder type '%{type}' is reporting as unusable fo
- FreeBSD hosts do not support sharing directories with whites
- NFS requires a host-only network to be created. Please add a
AI-assisted analysis of hashicorp/vagrant@35f3160f4a (2026-08-21).
Data as JSON: /api/errors/d942b4983699073f.
Report an issue: GitHub.