Vagrant Laravel Homestead - 运行 vagrant up 时出错
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36111020/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Vagrant Laravel Homestead - error when running vagrant up
提问by AHL
I have followed the tutorial on https://laravel.com/docs/5.0/homesteadand when running the step 'vagrant up', I get the following error message (below) Any ideas what the problem is? Running latest version of Oracle VirtualBox and the latest version of Vagrant. Regards
我已经按照https://laravel.com/docs/5.0/homestead上的教程进行操作,在运行“vagrant up”步骤时,我收到以下错误消息(如下) 知道问题是什么吗?运行最新版本的 Oracle VirtualBox 和最新版本的 Vagrant。问候
--
——
C:\Users\Anders\Vagrant\Homestead>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-7
==> 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 (guest) => 8000 (host) (adapter 1)
default: 443 (guest) => 44300 (host) (adapter 1)
default: 3306 (guest) => 33060 (host) (adapter 1)
default: 5432 (guest) => 54320 (host) (adapter 1)
default: 22 (guest) => 2222 (host) (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:
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!
GuestAdditions versions on your host (5.0.16) and guest (5.0.12) do not match.
Reading package lists...
Building dependency tree...
Reading state information...
dkms is already the newest version.
linux-headers-3.19.0-25-generic is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
Copy iso file C:\Program Files\Oracle\VirtualBox\VBoxGuestAdditions.iso into the
box /tmp/VBoxGuestAdditions.iso
mount: block device /tmp/VBoxGuestAdditions.iso is write-protected, mounting rea
d-only
Installing Virtualbox Guest Additions 5.0.16 - guest version is 5.0.12
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.0.16 Guest Additions for Linux............
VirtualBox Guest Additions installer
Removing installed version 5.0.12 of VirtualBox Guest Additions...
Stopping VirtualBox Additions ...fail!
(Cannot unload module vboxguest)
Removing existing VirtualBox DKMS kernel modules ...done.
Removing existing VirtualBox non-DKMS kernel modules ...done.
Stopping VirtualBox Guest Addition service ...done.
Copying additional installer modules ...
Installing additional modules ...
Removing existing VirtualBox DKMS kernel modules ...done.
Removing existing VirtualBox non-DKMS kernel modules ...done.
Building the VirtualBox Guest Additions kernel modules ...done.
Doing non-kernel setup of the Guest Additions ...done.
You should restart your guest to make sure the new modules are actually used
Installing the Window System drivers
Could not find the X.Org or XFree86 Window System, skipping.
An error occurred during installation of VirtualBox Guest Additions 5.0.16. Some
functionality may not work as intended.
In most cases it is OK that the "Window System drivers" installation failed.
==> default: Checking for guest additions in VM...
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
default: /vagrant => C:/Users/Anders/Vagrant/Homestead
default: /home/vagrant/Code => C:/Users/Anders/Code
Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:
mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3`,
actimeo=1 home_vagrant_Code /home/vagrant/Code
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant`,actimeo=1 home_vagran
t_Code /home/vagrant/Code
The error output from the last command was:
unknown mount option `actimeo=1'
valid options:
rw mount read write (default)
ro mount read only
uid =<arg> default file owner user id
gid =<arg> default file owner group id
ttl =<arg> time to live for dentry
iocharset =<arg> i/o charset (default utf8)
convertcp =<arg> convert share name from given charset to utf8
dmode =<arg> mode of all directories
fmode =<arg> mode of all regular files
umask =<arg> umask of directories and regular files
dmask =<arg> umask of directories
fmask =<arg> umask of regular files
C:\Users\Anders\Vagrant\Homestead>
--
——
vagrant file:
流浪文件:
--
——
require 'json'
require 'yaml'
VAGRANTFILE_API_VERSION = "2"
confDir = $confDir ||= File.expand_path("~/.homestead")
homesteadYamlPath = confDir + "/Homestead.yaml"
homesteadJsonPath = confDir + "/Homestead.json"
afterScriptPath = confDir + "/after.sh"
aliasesPath = confDir + "/aliases"
require File.expand_path(File.dirname(__FILE__) + '/scripts/homestead.rb')
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
if File.exists? aliasesPath then
config.vm.provision "file", source: aliasesPath, destination: "~/.bash_aliases"
end
if File.exists? homesteadYamlPath then
Homestead.configure(config, YAML::load(File.read(homesteadYamlPath)))
elsif File.exists? homesteadJsonPath then
Homestead.configure(config, JSON.parse(File.read(homesteadJsonPath)))
end
if File.exists? afterScriptPath then
config.vm.provision "shell", path: afterScriptPath
end
end
--
——
yaml file:
yaml文件:
--
——
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/Vagrant/Homestead/homestead.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Code
to: /home/vagrant/Code
type: "nfs"
sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public
hhvm: true
databases:
- homestead
回答by Brian Brownton
The issue you're experiencingwith Homestead has been documented in Github. There is a workaround provided, which is as follows:
您在使用 Homestead 时遇到的问题已记录在 Github 中。提供了一种解决方法,如下所示:
Solution: Remove type: "nfs" on your folders of Homestead.yaml.
http://docs.vagrantup.com/v2/synced-folders/nfs.html
"Windows users: NFS folders do not work on Windows hosts. Vagrant will ignore your request for NFS synced folders on Windows.
解决方案:在 Homestead.yaml 的文件夹中删除类型:“nfs”。
http://docs.vagrantup.com/v2/synced-folders/nfs.html
“Windows 用户:NFS 文件夹在 Windows 主机上不起作用。Vagrant 将忽略您对 Windows 上 NFS 同步文件夹的请求。
Original Answer(for the question before it was edited)
原始答案(针对编辑前的问题)
Now the issue seems to be with your ssh key, or lackthereof.
现在问题似乎与您的 ssh 密钥有关,或者没有。
No such file or directory @ rb_sysopen - C:/Users/Anders/.ssh/id_rsa (Errno::ENOENT)
The section in the guide you linkedtitled Set Your SSH Key has the following instructions to help you generate one (trimmed to the relevant Windows instructions):
本节你链接的指南中标题设置您的SSH密钥具有以下说明你生成一个(修剪到相关的Windows指令)的帮助:
Set Your SSH Key
[...]
On Windows, you may install Gitand use the
Git Bash
shell included with Git to issue the command above. Alternatively, you may use PuTTYand PuTTYgen.Once you have created a SSH key, specify the key's path in the authorize property of your
Homestead.yaml
file.
设置您的 SSH 密钥
[...]
在 Windows 上,您可以安装Git并使用
Git Bash
Git 附带的shell 发出上述命令。或者,您可以使用PuTTY和PuTTYgen。创建 SSH 密钥后,请在
Homestead.yaml
文件的授权属性中指定密钥的路径。
If you are not that comfortable with commandlines, I would recommend using the PuTTYgen method.
如果您对命令行不太满意,我建议您使用 PuTTYgen 方法。
回答by Lucas Silva
This is a problem with your Homestead.yaml file in ~/.homestead directory. I need see the file content to help you more.
这是 ~/.homestead 目录中 Homestead.yaml 文件的问题。我需要查看文件内容以帮助您更多。
After you had fixed the indention style to use only space characters, the another problem happenned because you not generate a pair (public and private) of keys yet. To do that:
在您将缩进样式固定为仅使用空格字符后,另一个问题发生了,因为您还没有生成一对(公钥和私钥)密钥。要做到这一点:
mkdir -p ~/.ssh && cd ~/.ssh
mkdir -p ~/.ssh && cd ~/.ssh
ssh-keygen -b 2048 -t rsa -C "[email protected]"
ssh-keygen -b 2048 -t rsa -C "[email protected]"
You can let the default file name (id_rsa), type the password and repeat the same password.
您可以让默认文件名(id_rsa),键入密码并重复相同的密码。
回答by PtrTon
In case anyone else ends up here via Google and didn't read all the comments too well (like I did).
以防其他人通过谷歌来到这里并且没有很好地阅读所有评论(就像我一样)。
I ran into the same issue of not being able to vagrant up
with the following error:
我遇到了同样的问题,无法解决vagrant up
以下错误:
Vagrant was unable to mount VirtualBox shared folders. This is usually
because the filesystem "vboxsf" is not available. This filesystem is
made available via the VirtualBox Guest Additions and kernel module.
Please verify that these guest additions are properly installed in the
guest. This is not a bug in Vagrant and is usually caused by a faulty
Vagrant box. For context, the command attempted was:
mount -t vboxsf -o actimeo=1,nolock,uid=1000,gid=1000 var_www_dev.mybox /var/www/dev.mybox
The error output from the command was:
fmask =<arg> umask of regular files
As Lucas mentioned hereWindows users can install the vagrant-winnfsdplugin which allows you to use NFS shared folders in Vagrant and Homestead).
正如 Lucas 在这里提到的,Windows 用户可以安装vagrant-winnfsd插件,它允许您在 Vagrant 和 Homestead 中使用 NFS 共享文件夹)。
So I solved this error by running vagrant plugin install vagrant-winnfsd
followed by a vagrant up
.
所以我通过运行vagrant plugin install vagrant-winnfsd
后跟一个vagrant up
.