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

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

Closed
techsk8 opened this issue Oct 16, 2021 · 5 comments
Closed
Labels
enhancement New feature or request

Comments

@techsk8
Copy link

techsk8 commented Oct 16, 2021

Hello there,
I'm trying to get your box running via vagrant, having libvirt as provider.
This is the output that I get...

my-machine $  vup --provider=libvirt
Bringing machine 'kali' up with 'libvirt' provider...
==> kali: Checking if box 'elrey741/kali-linux_amd64' version '0.0.181' is up to date...
==> kali: Creating image (snapshot of base box volume).
==> kali: Creating domain with the following settings...
==> kali:  -- Name:              kali_kali
==> kali:  -- Description:       Source: /home/me/Learning-Linux/vagrant-boxes/kali/Vagrantfile
==> kali:  -- Domain type:       kvm
==> kali:  -- Cpus:              1
==> kali:  -- Feature:           acpi
==> kali:  -- Feature:           apic
==> kali:  -- Feature:           pae
==> kali:  -- Clock offset:      utc
==> kali:  -- Memory:            512M
==> kali:  -- Management MAC:
==> kali:  -- Loader:
==> kali:  -- Nvram:
==> kali:  -- Base box:          elrey741/kali-linux_amd64
==> kali:  -- Storage pool:      default
==> kali:  -- Image():     /var/lib/libvirt/images/kali_kali.img, 64G
==> kali:  -- Disk driver opts:  cache='default'
==> kali:  -- Kernel:
==> kali:  -- Initrd:
==> kali:  -- Graphics Type:     vnc
==> kali:  -- Graphics Port:     -1
==> kali:  -- Graphics IP:       127.0.0.1
==> kali:  -- Graphics Password: Not defined
==> kali:  -- Video Type:        cirrus
==> kali:  -- Video VRAM:        256
==> kali:  -- Sound Type:	
==> kali:  -- Keymap:            en-us
==> kali:  -- TPM Backend:       passthrough
==> kali:  -- TPM Path:
==> kali:  -- INPUT:             type=mouse, bus=ps2
==> kali: Creating shared folders metadata...
==> kali: Starting domain.
==> kali: Waiting for domain to get an IP address...
==> kali: Waiting for machine to boot. This may take a few minutes...
    kali: SSH address: 192.168.121.80:22
    kali: SSH username: vagrant
    kali: SSH auth method: private key
    kali:
    kali: Vagrant insecure key detected. Vagrant will automatically replace
    kali: this with a newly generated keypair for better security.
    kali:
    kali: Inserting generated public key within guest...
    kali: Removing insecure key from the guest if it's present...
    kali: Key inserted! Disconnecting and reconnecting using new SSH key...
==> kali: Machine booted and ready!
==> kali: Setting hostname...
==> kali: Exporting NFS shared folders...
==> kali: Preparing to edit /etc/exports. Administrator privileges will be required...
[sudo] password for me:
==> kali: Mounting NFS shared folders...
==> kali: Pruning invalid NFS exports. Administrator privileges will be required...
==> kali: Removing domain...
==> kali: Deleting the machine folder
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/me/Learning-Linux/vagrant-boxes/kali /vagrant

Stdout from the command:



Stderr from the command:

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

** What can I do to fix it? Could this feature be implemented on your side? So we would be able to mount NSF shared folders right out of the box?
I guess the box needs to have NFS version 4 and above installed.

/etc/nfs.conf

[nfsd]
vers4=y
@techsk8 techsk8 added the enhancement New feature or request label Oct 16, 2021
@techsk8
Copy link
Author

techsk8 commented Oct 16, 2021

After finding this on the Arch Wiki I've solved this problem which I've also had with some other boxes. But the problem still persists around this Kali box. This is the other error which I get now:

THe same output as above ^^^^^^
....
.....
==> kali: Exporting NFS shared folders...
==> kali: Preparing to edit /etc/exports. Administrator privileges will be required...
==> kali: Mounting NFS shared folders...
==> kali: Pruning invalid NFS exports. Administrator privileges will be required...
==> kali: Removing domain...
==> kali: Deleting the machine folder
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/me/Learning-Linux/vagrant-boxes/kali /vagrant

Stdout from the command:



Stderr from the command:

mount.nfs: an incorrect mount option was specified

VM must be created before running this command. Run `vagrant up` first.

@elreydetoda
Copy link
Owner

Hello @alincocio, sorry for not responding sooner normally the GitHub mobile app notifies me if there was an issue on one of my repos and it didn't 🤔. Sorry about that!

So, I actually have run into this issue on a few different machines before ( at least it looks familiar ). I think it is a version miss match between a vagrant default (using v3 of nfs for shared folders) and your OS. The vagrant box should support v4 out of the box (from a client (inside the VM) perspective), but its a matter of using the right version when connecting to the "server" (i.e. your host machine that is running the VM).

If you don't mind me asking, what distro are you running? ( Fedora, Ubuntu, arch, etc...)

If it is the issue that I am thinking of, then you might have to fiddle around with some options inside of your Vagrantfile. I wish I could change this on the "server" side, but then that might break compatibility for other distros that don't have a more updated nfs setup.

This should be an example of what you could add to your Vagrantfile to (hopefully) fix the issue:

  config.vm.provider :libvirt do |lv, override|  
    override.vm.allowed_synced_folder_types = [:libvirt, :nfs]
    override.vm.synced_folder ".", "/vagrant", nfs_version: 4, nfs_udp: false
  end

Here is an example of me using it when I actually do development for this repo.

Let me know if this helps at all or what other errors you have 🙂

@elreydetoda
Copy link
Owner

another thing I do for debugging is (when I am having an issue inside the vagrant box on libvirt (libvirt specifically, because it destroys the box if it fails)) run vagrant up with the --no-destroy-on-error flag. Then it won't remove the box from my machine, and I can hop in to run different commands to further diagnose the issue.

One such command you could run to help diagnose is the command that vagrant is outputting that it had an error with.

mount -o vers=3,udp 192.168.121.1:/home/me/Learning-Linux/vagrant-boxes/kali /vagrant

Then once you can get it to mount properly you can just modify the Vagrantfile to adapt to using the same stuff (i.e. nfs version 4, etc... ).

@techsk8
Copy link
Author

techsk8 commented Oct 18, 2021

Thank you indeed 👍🏽

This block of code indeed did the trick. That's much appreciated for taking the time to look into it 😄 Keep up the good work! 💯

 config.vm.provider :libvirt do |lv, override|  
    override.vm.allowed_synced_folder_types = [:libvirt, :nfs]
    override.vm.synced_folder ".", "/vagrant", nfs_version: 4, nfs_udp: false
  end

@techsk8 techsk8 closed this as completed Oct 18, 2021
@elreydetoda
Copy link
Owner

elreydetoda commented Oct 20, 2021

Thank you indeed 👍🏽

This block of code indeed did the trick.

That's awesome @alincocio ! I am glad it is working now 😁

That's much appreciated for taking the time to look into it 😄

Anytime 😊

Keep up the good work! 💯

Thank you for using my vagrant box 🙂! You are the first person (besides me 🙃) to file an issue that isn't a co-worker, so thank you for reaching out!

I'm glad to know someone else beside my co-workers use it and enjoy it 😅😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants