Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vagrant creating duplicate entries in /etc/exports #11418

Closed
brianV opened this issue Feb 26, 2020 · 8 comments
Closed

Vagrant creating duplicate entries in /etc/exports #11418

brianV opened this issue Feb 26, 2020 · 8 comments

Comments

@brianV
Copy link

brianV commented Feb 26, 2020

Vagrant is creating duplicate entries in /etc/exports when I try to bring up a project on my localhost.

# VAGRANT-BEGIN: 1000 b942511b-1c04-4c66-91e4-83a76daa4d31
"/home/brian/Workspace/client_project" 10.20.1.2(rw,no_subtree_check,all_squash,anonuid=1000,anongid=1000,fsid=3632416851)
"/home/brian/Workspace/client_project" 10.20.1.2(rw,no_subtree_check,all_squash,anonuid=1000,anongid=1000,fsid=3632416851)
# VAGRANT-END: 1000 b942511b-1c04-4c66-91e4-83a76daa4d31

As a result, vagrant up errors out with:

==> client_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,udp 10.20.1.1:/home/brian/Workspace/client_project /var/www/client_project.local

Stdout from the command:

Stderr from the command:

mount.nfs: requested NFS version or transport protocol is not supported

I've tried removing one of the /etc/exports entries, then performing vagrant up --provision, however, the NFS mounts aren't present on the resulting box.

I've also tried doing a vagrant halt, removing one up the entries, then a vagrant up, but in this scenario, Vagrant recreates the duplicate entries, after which presents the above error when it attempts to create the NFS mounts again.

Vagrant version

2.2.6

Host operating system

Linux Mint 19.1

Guest operating system

Ubuntu 16.04
https://app.vagrantup.com/palantir/boxes/drupalbox/versions/1.4.0

Vagrantfile

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.require_version ">= 2.1.0"

%w{ vagrant-hostmanager vagrant-auto_network }.each do |plugin|
    unless Vagrant.has_plugin?(plugin)
        raise "#{plugin} plugin is not installed. Please install with: vagrant plugin install #{plugin}"
    end
end

# tunables
project     = 'clientsite'
hostname    = "#{project}.local"
extra_hostnames = []

ansible_solr_enabled = true
ansible_https_enabled = true
ansible_project_web_root = "docroot"
ansible_timezone = "America/Chicago"
ansible_system_packages = []
ansible_custom_playbook = ""
# end tunables

Vagrant.configure(2) do |config|

    config.hostmanager.enabled = true
    config.hostmanager.manage_host = true

    config.vm.define "#{project}" do |box|

        box.vm.box = "palantir/drupalbox"
        box.vm.box_version = ">= 1.2.0, < 2.0"

        box.vm.provider "virtualbox" do |vb|
            vb.customize ["modifyvm", :id, "--memory", "2048"]
        end

        box.vm.hostname = "#{hostname}"
        box.vm.network :private_network, :auto_network => true

        box.hostmanager.aliases = extra_hostnames

        box.vm.synced_folder ".", "/vagrant", :disabled => true
        box.vm.synced_folder ".", "/var/www/#{hostname}", :nfs => true

        box.ssh.forward_agent = true
    end

    config.vm.provision "the-vagrant", type: "ansible" do |ansible|
        ansible.playbook = "vendor/palantirnet/the-vagrant/conf/vagrant/provisioning/drupal8-skeleton.yml"

        ansible.groups = {
            "all:children" => ["#{project}"]
        }

        ansible.extra_vars = {
            "project" => project,
            "hostname" => hostname,
            "extra_hostnames" => extra_hostnames,
            "solr_enabled" => ansible_solr_enabled,
            "https_enabled" => ansible_https_enabled,
            "project_web_root" => ansible_project_web_root,
            "timezone" => ansible_timezone,
            "system_packages" => ansible_system_packages,
            "php_ini_memory_limit" => "512M",
        }
    end

    if (defined?(ansible_custom_playbook) && !ansible_custom_playbook.empty?)
        config.vm.provision "clientsite-provision", type: "ansible" do |ansible|
            ansible.playbook = ansible_custom_playbook
        end
    end

    config.trigger.before [:up, :reload] do |trigger|
        trigger.name = "Composer Install"
        trigger.run = {
            inline: "composer install --ignore-platform-reqs"
        }
    end

end

Debug output

https://gist.github.com/brianV/983ec5198cb0d3e3033417561f032184

Expected behavior

Environment should come up.

Steps to reproduce

Unfortunately, not able to give reproduction steps without access to a codebase.

References

@briancain
Copy link
Member

Hey there @brianV - Do you get duplicate entries if you remove all third party plugins and just run a simple Vagrantfile like this inside a different folder? Or if you try with a different box like hashicorp/bionic64? Also please share the result of that in a debug log, thanks!

Vagrant.configure(2) do |config|
  config.vm.define "test" do |box|
        box.vm.box = "palantir/drupalbox"
        box.vm.box_version = ">= 1.2.0, < 2.0"

        box.vm.provider "virtualbox" do |vb|
            vb.customize ["modifyvm", :id, "--memory", "2048"]
        end

        box.vm.synced_folder ".", "/var/www/test-folder", :nfs => true
    end
end

@brianV
Copy link
Author

brianV commented Mar 3, 2020

@briancain:

Thanks. I get the same issue with the palantir/drupalbox box using the same Vagrantfile you pasted, as well as with the hashicorp/bionic64 box using a slightly modified Vagrantfile to remove box.vm.box_version and add `config.vm.network:

Vagrant.configure(2) do |config|
  config.vm.define "test" do |box|
        box.vm.box = "hashicorp/bionic64"

        box.vm.provider "virtualbox" do |vb|
            vb.customize ["modifyvm", :id, "--memory", "2048"]
        end

        config.vm.network "private_network", type: "dhcp"

        box.vm.synced_folder ".", "/var/www/test-folder", :nfs => true
    end
end

Here's a gist with the debug log using the hasicorp/bionic64 box: https://gist.github.com/brianV/eda6f99d691ef2fc5418f85bb19f53f2

@briancain
Copy link
Member

@brianV Hey, thanks for checking with that. Can you confirm that nfs-server is running on your host prior to running Vagrant up too? And either way, perhaps try reloading the NFS service and try Vagrant again? 🙏

@brianV
Copy link
Author

brianV commented Mar 4, 2020

@briancain So, I want to take back my previous comment, because I hadn't removed an earlier the original entries from /etc/exports that had the duplicated entries from my original Vagrantfile. Once I removed the duplicate entries and tested your sample Vagrantfile, it worked.

In #4666, it seems to be tied to having the same folder synced into two places, but that specific issue was supposedly fixed in Sept. 2017.

@briancain
Copy link
Member

@brianV Yes...that behavior should be fixed. Is that what you are seeing now? I thought the original report was for a single Vagrantfile.

@brianV
Copy link
Author

brianV commented Mar 6, 2020

@briancain My report is for a single Vagrant file - it appears that the mechanism is different from #4666, but the end result is the same: Duplicate lined in /etc/exports.

I was able to re-add to the test case Vagrantfile until I triggered the duplicate /etc/exports entries:

 Vagrant.configure(2) do |config|
    # tunables
    project     = 'clientsite'
    hostname    = "#{project}.local"
    extra_hostnames = []

  config.vm.define "test" do |box|
        box.vm.box = "palantir/drupalbox"
        box.vm.box_version = ">= 1.2.0, < 2.0"

        box.vm.provider "virtualbox" do |vb|
            vb.customize ["modifyvm", :id, "--memory", "2048"]
        end

        box.vm.hostname = "#{hostname}"
        box.vm.network :private_network, :auto_network => true

        box.hostmanager.aliases = extra_hostnames
        box.vm.synced_folder ".", "/vagrant", :disabled => true
        box.vm.synced_folder ".", "/var/www/#{hostname}", :nfs => true
    end
end

The last change was to add the box.vm.hostname, box.vm.network and box.hostmanager.aliases lines.

However, by the same token, the duplicate lines aren't causing the NFS failure in this use case. In fact, the original Vagrantfile and project where this was happening are no longer triggering any NFS issues like they were the other day.

At this point, my specific project is back operational, despite creating duplicate /etc/exports lines. If the duplicate lines are not an issue, I guess I can chalk this up to some unknown condition on my machine over the past few days and close the issue.

@briancain
Copy link
Member

Hey there! Sorry that I did not get back to you sooner. I still am unable to reproduce this issue with a handful of boxes. I'm going to go ahead and close this issue for now. However if you're still experiencing this issue with the latest version of Vagrant, please feel free to open a new issue and reference this one! Thanks.

@ghost
Copy link

ghost commented Jun 20, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Jun 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants