Search code examples
network-programmingvagrantvirtualboxsalt-project

NFS error when vagrant up


I am having this error everytime i vagrant up the customer environment:

    NFS requires a host-only network to be created.
    Please add a host-only network to the machine (with either DHCP or a
    static IP) for NFS to work.

Here is the message when i try to vagrant up. The error message came out right after this:

    manager: Attempting graceful shutdown of VM...
    manager: Checking if box 'centos/7' is up to date...
    manager: Clearing any previously set forwarded ports...
    manager: Clearing any previously set network interfaces...
    manager: Preparing network interfaces based on configuration...
    manager: Adapter 1: nat
    manager: Adapter 2: hostonly
    manager: You are trying to forward to privileged ports (ports <= 1024). Most
    manager: operating systems restrict this to only privileged process (typically
    manager: processes running as an administrative user). This is a warning in case
    manager: the port forwarding doesn't work. If any problems occur, please try a
    manager: port higher than 1024.
    manager: Forwarding ports...
    manager: 2375 (guest) => 172 (host) (adapter 1)
    manager: 22 (guest) => 2222 (host) (adapter 1)
    manager: Running 'pre-boot' VM customizations...
    manager: Booting VM...
    manager: Waiting for machine to boot. This may take a few minutes...
    manager: SSH address: 127.0.0.1:2222
    manager: SSH username: vagrant
    manager: SSH auth method: private key
    manager: Machine booted and ready!
    manager: Setting hostname...
    manager: Configuring and enabling network interfaces...
    manager: SSH address: 127.0.0.1:2222
    manager: SSH username: vagrant
    manager: SSH auth method: private key

I have done some researchs and seen similar cases, but most of the answer pointed out that there's lacking a config.vm.network in vagrantfile. Im totally sure that is not the case here, since i have checked the vagrantfile already, and my colleagues can vagrant up just fine in their PCs.

For now, i have tried to reinstall virtualbox (5.1.30), vagrant (2.0.0), but it does not work. Please help


Solution

  • I have figured out my question:

    basically something in my Virtualbox got screwed up and the host only network interface was being created but somehow lost registration with virtualbox. Here are the things that i did:

    • Check all the vagrant plugin that is needed (often required in vagrantfile)
    • Delete all the boxes that created by vagrant.
    • Delete all the NAT and host-only network card and recreate them.
    • Change the Ipv4 address of host-only network to the correct one of the box you want to create (depend on what you config in the vagrantfile). I also have to disable the DHCP server in this case.

    Hope this can help some of the similar cases i saw in the internet. This is a known issue for vagrant and virtualbox.