【问题标题】:sometimes cannot access newly created files within synced folders [closed]有时无法访问同步文件夹中新创建的文件[关闭]
【发布时间】:2014-08-15 15:24:09
【问题描述】:

有时我得到了新创建的文件,但我无法访问,尽管我可以在控制台中列出它们。我的Vagrant file 包含这个synced_folder 设置:

config.vm.synced_folder "/home/ulkas/Develop/beauty/Beautyportal", "/vagrant/Beautyportal", owner: "vagrant", group: "vagrant", :mount_options => ['dmode=777', 'fmode=777']

当我在主机和来宾中创建/修改文件时会发生这种情况,它们只是变得无法访问:

cannot access GuzzleStreamWrapper.php: No such file or directory

我可以在控制台中列出它们,但没有权限(看起来像挂载问题):

vagrant@precise64:/vagrant/Beautyportal/vendor/guzzlehttp/streams/src$ ls -al
ls: cannot access functions.php: No such file or directory
ls: cannot access NoSeekStream.php: No such file or directory
ls: cannot access LazyOpenStream.php: No such file or directory
ls: cannot access MetadataStreamInterface.php: No such file or directory
ls: cannot access StreamInterface.php: No such file or directory
ls: cannot access LimitStream.php: No such file or directory
ls: cannot access AppendStream.php: No such file or directory
ls: cannot access Stream.php: No such file or directory
ls: cannot access CachingStream.php: No such file or directory
ls: cannot access StreamDecoratorTrait.php: No such file or directory
ls: cannot access GuzzleStreamWrapper.php: No such file or directory
total 12
drwxrwxr-x 1 vagrant vagrant 4096 Aug 14 11:33 .
drwxrwxr-x 1 vagrant vagrant 4096 Aug 14 11:33 ..
?????????? ? ?       ?          ?            ? AppendStream.php
?????????? ? ?       ?          ?            ? CachingStream.php
?????????? ? ?       ?          ?            ? functions.php
?????????? ? ?       ?          ?            ? GuzzleStreamWrapper.php
?????????? ? ?       ?          ?            ? LazyOpenStream.php
?????????? ? ?       ?          ?            ? LimitStream.php
?????????? ? ?       ?          ?            ? MetadataStreamInterface.php
?????????? ? ?       ?          ?            ? NoSeekStream.php
?????????? ? ?       ?          ?            ? StreamDecoratorTrait.php
?????????? ? ?       ?          ?            ? StreamInterface.php
?????????? ? ?       ?          ?            ? Stream.php
drwxrwxr-x 1 vagrant vagrant 4096 Aug 14 11:33 .svn

重启机器后(vagrant reload),文件就可以访问了,因此我怀疑挂载/重新挂载有问题。

这个问题出现在 linux mint 13 主机和 windows 7 64 位主机上。 盒子是hashicorp/precise64

【问题讨论】:

    标签: linux virtual-machine vagrant virtualbox virtualization


    【解决方案1】:

    我想我找到了问题,这是由于重复安装 - 默认情况下,vagrant 将活动主机目录 /home/user/vagranthost 安装到 /vagrant 中。我所做的是,我添加了额外的子目录作为像 /home/user/vagranthost/project 这样的挂载点到 /vagrant/project 中,从而产生了一个冲突,它 vagrant 还不能识别并让它挂载。

    因此,解决此问题的方法是编辑 Vagrantfile 并更改行

    config.vm.synced_folder "/home/ulkas/Develop/beauty/Beautyportal", "/vagrant/Beautyportal", owner: "vagrant", group: "vagrant", :mount_options => ['dmode=777', 'fmode=777']
    

    进入

    config.vm.synced_folder "/home/ulkas/Develop/beauty", "/vagrant", owner: "vagrant", group: "vagrant", :mount_options => ['dmode=775', 'fmode=775']
    

    为了调试,这是之前mount命令的输出:

    /vagrant on /vagrant type vboxsf (uid=1000,gid=1000,rw)
    /vagrant/Beautyportal on /vagrant/Beautyportal type vboxsf (uid=33,gid=1000,rw)
    

    【讨论】:

      猜你喜欢
      • 2016-03-04
      • 1970-01-01
      • 2023-03-04
      • 2011-07-15
      • 2017-08-19
      • 1970-01-01
      • 1970-01-01
      • 2011-05-16
      • 2014-02-17
      相关资源
      最近更新 更多