Diagnosing Vagrant Synced Folder Mount Failures on Linux Guests
A step‑by‑step diagnostic guide for fixing Vagrant synced folder mount failures on Linux guests using VirtualBox, rsync, or NFS, with cause table, ordered checks, targeted fixes, verification steps, and escalation criteria.
02 Sept 2026, 13:13 UTC

Problem you’ll see
After running vagrant up the shared directory on the guest is empty, commands return Permission denied, or Vagrant aborts with a message such as Failed to mount folders in Linux guest. The symptom is the same regardless of whether you use VirtualBox’s native shared folders, rsync, or NFS.
Cause / diagnostic quick‑reference
| Observed symptom | Likely cause | Where to look first |
|---|---|---|
Guest folder empty, no mount line in mount | VirtualBox Guest Additions missing or version‑mismatched | Guest kernel log (dmesg | grep -i vbox) |
mount: unknown filesystem type 'vboxsf' | Guest kernel headers / build tools not installed | Package manager (e.g. apt list --installed | grep linux-headers) |
Vagrant reports Synced folder type 'nfs' not supported | NFS client utilities absent on guest or host export mis‑configured | Host /etc/exports and guest rpcinfo -p |
Rsync fails with rsync: command not found | rsync not installed on guest | Guest which rsync |
Host path in Vagrantfile does not exist | Typo or relative path resolved from wrong directory | Host ls -ld /path/to/share |
Ordered diagnostic checks
- Confirm the VM is running. Run
vagrant statuson the host. The output must showrunning (virtualbox)(or your provider). - Inspect the Vagrantfile synced_folder entries. Look for lines like
config.vm.synced_folder "./data", "/vagrant_data", type: "virtualbox". Verify the host path exists and the guest path is absolute. - SSH into the guest and list mounts.
Run on the host; requires SSH access (default private key). Expect a line such asvagrant ssh -c "mount | grep -i vagrant"vagrant on /vagrant_data type vboxsf (rw,uid=1000,gid=1000). - Check guest development packages. Inside the guest run
Missing packages explain why thedpkg -l | grep -E 'linux-headers|build-essential|dkms' # or on RPM‑based yum list installed kernel-devel gcc makevboxsfkernel module cannot build. - Review provider‑specific logs. For VirtualBox:
VBox.login the VM directory (usually~/.vagrant.d/boxes/.../virtualbox/). Look for lines containingVBoxGuestAdditionsormount.vboxsf.
Fixes tied to each finding
1. Install / upgrade VirtualBox Guest Additions
On the host, with the VM powered off, run:
vagrant plugin install vagrant-vbguest # if not already present
vagrant vbguest --do install
This downloads the ISO matching the installed VirtualBox version, mounts it in the guest, and compiles the kernel modules. Requires the guest to have kernel headers and dkms (see step 4). After completion, run vagrant reload.
2. Install kernel headers and build tools
Inside the guest (Debian/Ubuntu example):
sudo apt-get update
sudo apt-get install -y linux-headers-$(uname -r) build-essential dkms
On Fedora/CentOS/RHEL:
sudo dnf install -y kernel-devel-$(uname -r) gcc make dkms
Then re‑run the Guest Additions install (step 1) or simply vagrant reload.
3. Switch synced folder type
If VirtualBox shared folders remain unreliable, change the type in the Vagrantfile:
config.vm.synced_folder "./data", "/vagrant_data", type: "rsync"
# or for NFS (Linux/macOS hosts only)
config.vm.synced_folder "./data", "/vagrant_data", type: "nfs"
Run vagrant reload. Note: rsync is one‑way by default (host → guest). Add rsync__args: ["--verbose", "--archive", "--delete", "-z"] and rsync__exclude: [".git/"] to tune behavior. NFS requires host‑side export configuration (see next fix).
4. Correct the host path
Ensure the path is absolute or relative to the Vagrantfile directory. Example of a common mistake:
# Wrong – resolves from the current working directory when vagrant runs
config.vm.synced_folder "../data", "/vagrant_data"
# Correct – explicit relative to Vagrantfile
config.vm.synced_folder File.expand_path("../data", __dir__), "/vagrant_data"
After fixing, run vagrant reload.
5. Configure NFS exports (host side)
On Linux/macOS hosts, edit /etc/exports (or /etc/exports.d/vagrant.exports) and add a line for the shared directory:
/home/user/project/data 192.168.56.0/24(rw,sync,no_subtree_check,all_squash,anonuid=1000,anongid=1000)
Then restart the NFS service (sudo systemctl restart nfs-server or sudo nfsd restart on macOS). Verify with showmount -e localhost. The guest must have the NFS client utilities (nfs-common on Debian, nfs-utils on RPM).
Verification after a fix
- Run
vagrant up(orvagrant reloadif the VM is already running). - Confirm the mount appears:
vagrant ssh -c "mount | grep -i vagrant" - Create a test file on the host:
echo "hello" > ./data/test.txt - Inside the guest verify it appears:
vagrant ssh -c "cat /vagrant_data/test.txt" - For bidirectional types (NFS, VirtualBox shared folders) create a file in the guest and confirm it shows up on the host.
If the file is visible in both directions, the synced folder is functional.
Escalation criteria
- Mount failures persist after trying at least two different synced folder types (e.g., VirtualBox → rsync → NFS).
- Provider logs show kernel‑module load errors such as
modprobe vboxsf failedor NFS mount system‑call returnsEACCESdespite correct exports. - Network policy blocks the required ports (NFS uses 2049 TCP/UDP plus rpcbind ports; rsync over SSH needs port 22). If the environment cannot open these ports and rsync’s one‑way nature is unacceptable, consider a different provider (e.g., libvirt with 9p/virtio‑fs) or a container‑based workflow.
Limitations & practical notes
- Behavior varies by Vagrant version, provider, guest OS, and host OS. The steps above assume Vagrant ≥ 2.3, VirtualBox ≥ 6.1, and a Linux guest with systemd.
- NFS is not available on Windows hosts without third‑party NFS server software.
- Rsync defaults to host‑to‑guest only; guest‑side changes are lost on
vagrant reloadunless you enablersync__auto: trueand accept the delete behavior. - VirtualBox Guest Additions must match the installed VirtualBox version; a mismatch produces kernel‑module version errors that are not always obvious in the UI.
- Never edit the VM’s disk image or provider state directly without a snapshot; a corrupted shared‑folder mount can leave the guest filesystem in an inconsistent state requiring VM recreation.
Diagram labels (for illustration)
- Host → Guest sync path
- VirtualBox Guest Additions kernel module
- NFS export configuration
- Rsync daemon / SSH tunnel
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.