openminds / sneakers

Sneakers is a simple, fast way to mimick Openminds Shared and Cloud hosting environments using vagrant/virtualbox, and provisioned by Chef.
25 stars 11 forks source link

NFS mount error #17

Closed dieterve closed 11 years ago

dieterve commented 11 years ago

I have the following config:

project:
    app_directory: "/Users/dieter/Sites/project.dev/"
    type: "php54"
    http_port: 8022                                                                                                                                                                                     
    memory: 1024
    nfs: true #NFS is not supported on windows!
    php_xdebug: true

After vagrant up I get this error:

$ vagrant up project
Bringing machine 'project' up with 'virtualbox' provider...
[project] Importing base box 'debian-6.0.7-amd64-ruby1.9.3.box'...
[project] Matching MAC address for NAT networking...
[project] Setting the name of the VM...
[project] Clearing any previously set forwarded ports...
Pruning invalid NFS exports. Administrator privileges will be required...
Password:
[project] Creating shared folders metadata...
[project] Clearing any previously set network interfaces...
[project] Preparing network interfaces based on configuration...
[project] Forwarding ports...
[project] -- 22 => 2222 (adapter 1)
[project] -- 8022 => 8022 (adapter 1)
[project] Booting VM...
[project] Waiting for VM to boot. This can take a few minutes.
[project] VM booted and ready for use!
[project] Setting hostname...
[project] Configuring and enabling network interfaces...
[project] Mounting shared folders...
[project] -- /vagrant
[project] -- /tmp/vagrant-chef-1/chef-solo-2/roles
[project] -- /tmp/vagrant-chef-1/chef-solo-1/cookbooks
[project] Exporting NFS shared folders...
Preparing to edit /etc/exports. Administrator privileges will be required...
[project] 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 10.0.2.1:'/Users/dieter/Sites/project.dev' /home/vagrant/apps/default

I logged in to the vbox via vagrant ssh project to manually execute the command:

vagrant@project:~$ sudo mount -o vers=3 10.0.2.1:'/Users/dieter/Sites/project.dev' /home/vagrant/apps/default 
mount.nfs: No route to host

Pinging to the 10.0.2.1 IP fails on the vbox but works from my local.

The issue is also going on here but no real solution is provided: https://github.com/mitchellh/vagrant/issues/1744. I tried some of the solutions, none of them worked. I finally got it to work by readding this line from a previous commit: https://github.com/openminds/sneakers/commit/f0dfe86d3431585c424c8bd581449a2b490d076c#L1R19

So my Vagrantfile changes look like:

$ git diff
diff --git a/Vagrantfile b/Vagrantfile
index cffab9b..2fe3f8c 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -16,7 +16,7 @@ Vagrant::Config.run do |config|
       node.vm.host_name = name
       node.vm.forward_port box['http_port'], box['http_port']
       node.vm.forward_port 3306, box['mysql_port'] if box['mysql_port']
-      node.vm.network :hostonly, "#{box['ip'] || '10.0.2.42'}" if box['nfs'] || box['ip']
+      node.vm.network :hostonly, "192.168.33.10" if box['nfs']
       Vagrant.configure("2") do |config|
         config.vm.provider :virtualbox do |vb|
           vb.customize ["modifyvm", :id, "--memory", "#{box['memory']}"]

So I don't know if this is a Sneakers issue, a Vagrant issue or a environment issue but this seems like the logically place to report it.

Vagrant version: 1.2.2 VirtualBox version: 4.2.16 r86992

Zhann commented 11 years ago

Thank you for reporting, we'll look in to it.

dieterve commented 11 years ago

Taking another look at what I changed, it also works by setting the IP manually in the config.yml. This prevents me from modifying the original code. So I am guessing its all about getting a correct fallback IP.

This works:

project:
    app_directory: "/Users/dieter/Sites/project.dev/"
    type: "php54"
    http_port: 8022
    memory: 1024
    nfs: true #NFS is not supported on windows!
    php_xdebug: true
    ip: 192.168.33.10     
dieterve commented 11 years ago

The same issue appears on a colleague's laptop using the same config. However, manually setting the ip does not help.

His config:

project:
    app_directory: "/Users/dieterpeirs/2-sites/project"
    type: "php54"
    http_port: 8022
    memory: 1024
    nfs: true #NFS is not supported on windows!
    php_xdebug: true
    ip: 192.168.34.1    

Error after manually mounting on the vm:

vagrant@project:~$ sudo mount -o vers=3 192.168.34.1:'/Users/dieterpeirs/2-sites/project' /home/vagrant/apps/default
mount.nfs: requested NFS version or transport protocol is not supported

I manually set the NFS version to 4 in the Vagrantfile but Vagrant just "hangs" when mounting with version 4: Vagrantfile:

node.vm.share_folder "apps", "/home/vagrant/apps/default", box['app_directory'], :nfs => box['nfs'], :nfs_version => "4"

Output (using VAGRANT_LOG=info):

[project] Exporting NFS shared folders...
 INFO interface: info: Preparing to edit /etc/exports. Administrator privileges will be required...
Preparing to edit /etc/exports. Administrator privileges will be required...
Password:
Password:
 INFO interface: info: Mounting NFS shared folders...
[project] Mounting NFS shared folders...
 INFO ssh: SSH is ready!
 INFO guest: Execute capability: mount_nfs_folder (debian)
 INFO ssh: SSH is ready!
 INFO guest: Execute capability: shell_expand_guest_path (debian)
 INFO ssh: Execute: printf /home/vagrant/apps/default (sudo=false)
 INFO ssh: Execute: mkdir -p /home/vagrant/apps/default (sudo=true)
 INFO ssh: Execute: mount -o vers=4 192.168.34.1:'/Users/dieterpeirs/2-sites/project' /home/vagrant/apps/default (sudo=true)

A few things I noticed:

If any info is needed, please ask. We spend some time on this but need to move on, so we set up the project without Vagrant for now.

dieterve commented 11 years ago

@openminds any ideas? We would love to use vagrant.

Zhann commented 11 years ago

@dieterve we'll try to reproduce the problem and find a fix.

Zhann commented 11 years ago

@dieterve , I was able to reproduce the problem. Some changes were pushed to Sneakers and should fix this. Can you pull/clone the latest version and can you also make sure Vagrant is up-to-date (v. 1.2.7) and tell me if this fixes your problem?

dieterve commented 11 years ago

Hey, seems to work on 3 tested machines. Tx!

Note: on one machine we had to disable mamp before it could work.

wonko commented 11 years ago

cool, thanks for the feedback.