Vagrant-libvirt: Not mounting folders with NFS shared and vagrant libvirt in Debian Jessie

Created on 20 Dec 2016  ยท  6Comments  ยท  Source: vagrant-libvirt/vagrant-libvirt

Hi guys! I need your help to mounting vagrant libvirt box using NFS shared folders.
My OS software is: Debian Jessie AMD 64 bits

With the help of @Infernix in github, I was able to properly install the instance of libvirt but the problem now is to mount the shared directory with the VM.

References to installation Issue #710

Ow, never see error in mount nfs with vagrant before. :o

==> default: Exporting NFS shared folders...
==> default: Preparing to edit /etc/exports. Administrator privileges will be required...
โ— nfs-kernel-server.service - LSB: Kernel NFS server support
   Loaded: loaded (/etc/init.d/nfs-kernel-server)
   Active: active (exited) since Sun 2016-12-18 20:21:10 BRST; 15h ago
==> 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/tosystems/Documents/projects /home/vagrant/vagrant_rojects
result=$?
if test $result -eq 0; then
if test -x /sbin/initctl && command -v /sbin/init && /sbin/init 2>/dev/null --version | grep upstart; then
/sbin/initctl emit --no-wait vagrant-mounted MOUNTPOINT=/home/vagrant/vagrant_projects
fi
else
exit $result
fi

Stdout from the command:

Stderr from the command:

stdin: is not a tty
mount.nfs: rpc.statd is not running but is required for remote locking.
mount.nfs: Either use '-o nolock' to keep locks local, or start statd.
mount.nfs: an incorrect mount option was specified

I follow the @HalosGhost hints in link below, but I not succeeded.

http://unix.stackexchange.com/questions/77055/mount-linux-nfs-rpc-statd-is-not-running

.
I add in Vagrantfile configuration file custom params for synced_folder but I'm not succeeded with this mounting.

config.vm.synced_folder "~/projects", "/home/vagrant/vagrant_projects", type: "nfs", nfs_version: 4, "nfs_udp": false, mount_options: ["rw", "vers=4", "tcp"]

Most helpful comment

I'm afraid you'll have to figure out yourself why your nfs server isn't working; it's not an issue of vagrant-libvirt. I suggest not using shared folders, then log in to the VM and try to mount your hosts nfs manually to troubleshoot.

All 6 comments

From that stackexchange page: In /etc/default/nfs-common, insert the yes in NEED_STATD=yes

then restart nfs-common

Alternatively, use

config.vm.synced_folder "~/projects", "/home/vagrant/vagrant_projects", type: "nfs", nfs_version: 4, "nfs_udp": false, mount_options: ["rw", "vers=4", "tcp", "nolock"]

Thanks @infernix for nolock parameter tip.

I try but the following output appears:

==> 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,rw,vers=4,tcp,nolock 192.168.121.1:/home/tosystems/projects /home/vagrant/vagrant_projects
result=$?
if test $result -eq 0; then
if test -x /sbin/initctl && command -v /sbin/init && /sbin/init 2>/dev/null --version | grep upstart; then
/sbin/initctl emit --no-wait vagrant-mounted MOUNTPOINT=/home/vagrant/vagrant_projects
fi
else
exit $result
fi

Stdout from the command:

Stderr from the command:

stdin: is not a tty
mount.nfs: Connection timed out

I'm afraid you'll have to figure out yourself why your nfs server isn't working; it's not an issue of vagrant-libvirt. I suggest not using shared folders, then log in to the VM and try to mount your hosts nfs manually to troubleshoot.

Thanks @infernix Great tip! I had done just that.
I tried to mount manually and presented other types of errors, but for these, I will do an external search.

try add ufw rule sudo ufw allow to 192.168.121.1, this will allow the mount to go through.

Was this page helpful?
0 / 5 - 0 ratings