Vagrant up not mounting the directory

Trying to use vagrant to mount a VM. I use libvirt as a provider.

I have this in my Vagrantfile :

config.vm.synced_folder ‘.’, ‘/toto’

I get the following :

==> 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.122.1:/home/ludovic/Documents/src/3liz/toto /vagrant

Stdout from the command:

Stderr from the command:

mount.nfs: Connection timed out

I have followed instructions at Synced folders with NFS — Fedora Developer Portal - but it’s not helping.

[ludovic@saraan lizmap-box]$ sudo cat /etc/exports

VAGRANT-BEGIN: 1000 d7208f2d-8be6-40ed-a777-2d9741158fca

“/home/ludovic/Documents/src/3liz/lizmap-box” 192.168.122.180(rw,no_subtree_check,all_squash,anonuid=1000,anongid=1000,fsid=1641509170)

VAGRANT-END: 1000 d7208f2d-8be6-40ed-a777-2d9741158fca

[ludovic@saraan lizmap-box]$

[ludovic@saraan lizmap-box]$ vagrant --version
Vagrant 2.2.6

I have tried to use rsync as per Basic Usage - Synced Folders | Vagrant | HashiCorp Developer , but I still get some NFS error :frowning: .

Journalctl -e is of little help.

What am I doing wrong ?

Hi,

I had the same type of question when I started using Fedora and was used to using Vagrant. Here’s what I did:

I installed sshfs:

sudo dnf install sshfs is the equivalent Fedora command to apt-get

Now in your virtual machine change the owner and group of the directory you want to sync with:

chown vagrant:vagrant /vagrant -R

It possibly is already set as “vagrant” which is fine.

Then in your host machine, create a mount point:

sudo mkdir /mnt/myvagrant

Now you need to change the permissions of that new directory to those that you are using:

sudo chown ludovic:ludovic /mnt/myvagrant -R

Then you can use sshfs like this:

sudo sshfs -o allow_other,default_permissions vagrant@192.168.122.1:/vagrant /mnt/myvagrant

If all goes well you should now be able to cd /mnt/vagrant and see your files in the /vagrant directory of your virtual machine.

I am still quite a newbie but thought I’d try and help.

P.S. DO NOT FOLLOW THE " Permanently Mounting the Remote File System" instructions on that page. It will break your boot up. (I found out the hard way!)

1 Like

Thanks for the good workaround. I’ll probably file an issue with vagrant, that simple thing should work.

Thanks this helped a lot. I’ve switched from using NFS to sshfs and wrote a small blog entry about it at https://www.hirlimann.net/Ludovic/carnet/?post/2020/03/31/Mounting-your-projet-directory-in-vagrant-on-Fedora-using-libvirt-provider

Great news! I am glad it helped!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.