反复出现的Vagrant错误:不允许对NFS资源上的操作“ create”执行操作 [英] Recurring Vagrant error: operation not permitted on action `create` on an NFS resource

查看:51
本文介绍了反复出现的Vagrant错误:不允许对NFS资源上的操作“ create”执行操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个厨师准备者的无家可归的盒子。一切正常,除非对NFS资源进行操作。例如,我有以下同步的文件夹:

I have a vagrant box with chef provisioner. Everything works fine except when there are operation on NFS resources. For example, I have the following synced folders:

"host_path": "/Users/User/devbox/vdd/data",
        "guest_path": "/var/www",
        "type": "nfs"

在流浪汉文件中:

 # Synced Folders.
    config_json["vm"]["synced_folders"].each do |folder|
      case folder["type"]
      when "nfs"
        config.vm.synced_folder folder["host_path"], folder["guest_path"], type: "nfs"
        # This uses uid and gid of the user that started vagrant.
        config.nfs.map_uid = Process.uid
        config.nfs.map_gid = Process.gid

,我还有一个厨师食谱,可以对nfs资源执行 create 操作:

and I also have a chef recipe that executes a create action on an nfs resource:

directory "/var/www" do
  owner "vagrant"
  group "vagrant"
end

但是,我不断收到以下错误:

However, I keep getting the following error:

 default: Error executing action `create` on resource 'directory[/var/www]'
==> default: ================================================================================
==> default: 
==> default: 
==> default: Errno::EPERM
==> default: ------------
==> default: Operation not permitted - /var/www
==> default: 
==> default: 
==> default: Resource Declaration:
==> default: ---------------------
==> default: # In /tmp/vagrant-chef-3/chef-solo-2/cookbooks/vdd/recipes/apache.rb
==> default: 
==> default:   1: directory "/var/www" do
==> default:   2:   owner "vagrant"
==> default:   3:   group "vagrant"
==> default:   4: end
==> default:   5: 
==> default: 
==> default: 
==> default: 
==> default: 
==> default: Compiled Resource:

摆脱问题(并保留nfs)的唯一方法是通过以下操作:

The only way to get rid of the problem (and keep the nfs) is by the following:


  1. nfs 更改为默认

运行无用重载-设置

默认值更改回 nfs

运行无用重载

我已经搜索并尝试了各种建议的解决方案,但到目前为止,对我来说都没有用。

I have search and tried various suggested solution but nothing worked for me thus far.

推荐答案

我能够通过传递<$ c $告诉vagrant在配置后挂载nfs资源来解决此问题。 c> after::provision,选项。这是我的vagrantfile中的代码行:

I was able to fix this issue by telling vagrant to mount the nfs resource after the provisioning by passing the after: :provision, option. Here is the line of code in my vagrantfile:

config.bindfs.bind_folder "/var/nfs-#{i}", folder["guest_path"], after: :provision, perms: "u=rwX:g=rwX:o=rD", o: 'nonempty'

这篇关于反复出现的Vagrant错误:不允许对NFS资源上的操作“ create”执行操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆