Vagrant up 错误,更改 /vagrant 的所有权:不是目录

Vagrant up error, changing ownership of /vagrant: not a directory

我在笔记本电脑上 运行ning Windows 8.1 64 位。

我一直在按照本指南尝试为我的 Laravel 项目设置 homestead:laravel installation and setup

指南 tldr:您只需安装 vagrant、virtual-box 和 composer。您使用这些来获取 homestead,然后进行初始化和安装。您配置 homestead.yaml 并生成 ssh 密钥。在这一切之后,你使用 vagrant up,让 vagrant 使用你的开发环境和所有其他东西设置你的 Vritual 机器。

使用 git bash,我按照指南进入 'vagrant up' 部分。

这是问题所在,我收到以下错误:

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'laravel/homestead'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: Setting the name of the VM: homestead
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 80 => 8000 (adapter 1)
    default: 443 => 44300 (adapter 1)
    default: 3306 => 33060 (adapter 1)
    default: 5432 => 54320 (adapter 1)
    default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection timeout. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default:
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default:
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version o
f
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you
 see
    default: shared folder errors, please make sure the guest additions within t
he
    default: virtual machine match the version of VirtualBox you have installed
on
    default: your host and reload your VM.
    default:
    default: Guest Additions Version: 4.3.14
    default: VirtualBox Version: 5.0
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
    default: /vagrant => C:/Users/Work/Homestead/Homestead
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

chown `id -u vagrant`:`id -g vagrant` /vagrant

Stdout from the command:

Stderr from the command:

chown: changing ownership of ���/vagrant���: Not a directory

我有 运行 git bash 作为管理员。 我的 .yaml 文件看起来像这样

---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox

authorize: C:/Users/Work/.ssh/id_rsa.pub

keys:
    - C:/Users/Work/.ssh/id_rsa

folders:
    - map: C:/Users/Work/Projects
      to: /home/vagrant/Code

sites:
    - map: homestead.app
      to: /home/vagrant/Code/Laravel/public

databases:
    - homestead

variables:
    - key: APP_ENV
      value: local

我得到了最新版本的 Vagrant 和 Virtual Box。

在我看来错误来自文件夹的路径无效,但看到我的 yaml 文件应该是正确的我不知道如何解决它。

我确实在另一台 windows 8.1 固定 PC 上成功安装了 homestead 环境,但我从未遇到过此错误。

不是 100% 确定,但看起来,vagrant 正试图将其默认的“/vagrant”文件夹映射到您的本地 C:/Users/Work/Homestead/Homestead。如果本地不存在或有一些权限错误,/vagrant 将不会被创建,下一个命令将失败。查看是否创建了 C:/Users/Work/Homestead/Homestead。而且我在你的 yaml 中也没有看到这个映射。 /vagrant => C:/Users/Work/Homestead/Homestead。您的配置没有被覆盖吗?

所以,这就是我实际设法修复它的方法。

最新版本的 Vagrant (1.3.5) 和 VirtualBox (4.3.4) 在 Windows 上根本不能一起玩。所以,我保留了 Vagrant 1.3.5,然后转到 VirtualBox 4.2.2。

完成后,您必须删除几个文件夹,以便一切正确地自行重置:

 Users\<<USERNAME>>\.VirtualBox
Users\<<USERNAME>>\.vagrant.d

在尝试之前删除那些 运行

vagrant up

有了它,我又可以 运行ning 了。但是,我注意到 运行ning vagrant up 确实比以前慢了一点。不过我可以接受。 感谢您的所有帮助和建议。

我刚通过。

  • 所以你有 Vagrant 和最新的 VirtualBox。
  • 如果在任何安装后没有重新启动计算机,请立即重新启动计算机
  • 卸载 Vbox 5.0
  • 重新启动计算机
  • 为 amd/x86
  • 下载并安装 4.3.30
  • 运行 vagrant up 你就在那里

Mitchell 为我们确认这是最新版本中的错误,现在已修复:查看此问题和相关提交 https://github.com/mitchellh/vagrant/issues/5933

目前 Vagrant (<=1.7.3) 在 VirtualBox 5.0 中有一个错误。根据

https://github.com/mitchellh/vagrant/issues/5933

Vagrant 1.7.4 将修复 VB 5.0。不过,正如我在 Github 问题中提到的那样,它可以应用于树内。

如果您随后收到此消息,请尝试匹配主机上的 VirtualBox 版本,这将解决问题。

默认:此 VM 上的来宾添加与安装的版本不匹配 默认值:VirtualBox!在大多数情况下这很好,但在极少数情况下它可以 默认值:阻止诸如共享文件夹之类的东西正常工作。如果你看到 默认:共享文件夹错误,请确保guest添加在 默认值:虚拟机与您安装的 VirtualBox 版本相匹配 默认值:您的主机并重新加载您的虚拟机。 默认: 默认值:来宾添加版本:4.3.10 默认值:VirtualBox 版本:5.0