【问题标题】:Vagrant CentOS8 using NFS fails to mount: mount.nfs: requested NFS version or transport protocol is not supported使用 NFS 的 Vagrant CentOS8 无法挂载:mount.nfs:不支持请求的 NFS 版本或传输协议
【发布时间】:2020-11-01 21:29:02
【问题描述】:

我正在尝试为使用Jeff Geerling's packer-boxes repo 构建的CentOS 8 机器执行vagrant up

我的 Vagrantfile 看起来像这样。

# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
  config.ssh.insert_key = false
  config.vm.synced_folder '.', '/vagrant', type: 'nfs'

  # VirtualBox.
  config.vm.define "virtualbox" do |virtualbox|
    virtualbox.vm.hostname = "virtualbox-centos8"
    virtualbox.vm.box = "file://builds/virtualbox-centos8.box"
    virtualbox.vm.network :private_network, ip: "172.16.9.29"
    virtualbox.vbguest.auto_update = true

    config.vm.provider :virtualbox do |v|      v.gui = false
      v.memory = 1024
      v.cpus = 1
      v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
      v.customize ["modifyvm", :id, "--ioapic", "on"]
    end

    config.vm.provision "shell", inline: "echo Hello, World"
  end

end

我收到无法使用 NFS 的错误消息。

The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mount -o vers=3 172.16.9.1:/home/bcrice/projects/packer-boxes/centos8 /vagrant

Stdout from the command:



Stderr from the command:

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

我已经尝试了这里发布的所有技巧,但都没有奏效。

https://github.com/hashicorp/vagrant/issues/9666

我正在使用这个版本的 Ubuntu 桌面

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"

我的主机上的 VirtualBox dpkg -l | grep 虚拟机 | awk '{打印 $3}'

6.1.10-dfsg-1~ubuntu1.20.04.1
6.1.10-dfsg-1~ubuntu1.20.04.1
6.1.10-1~ubuntu1.20.04.1
6.1.10-dfsg-1~ubuntu1.20.04.1

VirtualBox 中的Guest 说它正在运行guest-utils

vagrant vbguest --status
[virtualbox] GuestAdditions 6.1.10 running --- OK.

我的 /etc/exports 自动正确添加条目,但它不起作用

cat /etc/exports
# VAGRANT-BEGIN: 1000 2b82110e-78ed-489e-891e-c80e073c4f73
"/home/bcrice/packer-boxes/centos8" 172.16.9.29(rw,no_subtree_check,all_squash,anonuid=1000,anongid=1000,fsid=187307313)
# VAGRANT-END: 1000 2b82110e-78ed-489e-891e-c80e073c4f73

【问题讨论】:

  • 需要做apt install nfs-kernel-server。尽管systemctl status nfs-kernel-server 说它正在运行,但实际上并没有安装它。安装后执行 systemctl restart nfs-kernel-server 即可。

标签: vagrant virtualbox nfs centos8 virtualbox-guest-additions


【解决方案1】:

需要做apt install nfs-kernel-server。尽管systemctl status nfs-kernel-server 说它正在运行,但实际上并没有安装。安装后执行 systemctl restart nfs-kernel-server 即可。

一个很好的赠品是,当我运行 exportfs 时,它说未安装 nfs-kernel-server。

运行dpkg -l | grep nfs-kernel-server 并仔细检查您是否安装了它。

【讨论】:

    猜你喜欢
    • 2017-01-13
    • 1970-01-01
    • 1970-01-01
    • 2014-12-29
    • 1970-01-01
    • 1970-01-01
    • 2023-02-06
    • 1970-01-01
    • 2016-06-24
    相关资源
    最近更新 更多