我正试图在家用电脑的工作环境中设置我的Vagrant盒子,但我遇到了问题。我现在已经卸载并重新安装了Virtualbox和Vagrant两次。在工作中,一切都按预期工作。在家里,什么都没有。我的流浪文件如下:
Vagrant::configure("2") do |config|
config.vm.box = "saucy64"
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/saucy/current/saucy-server-cloudimg-amd64-vagrant-disk1.box"
config.vm.network :private_network, ip: "192.168.33.10"
# Allow more memory usage for the VM
config.vm.provider :virtualbox do |v|
v.customize ["modifyvm", :id, "--memory", "1024"]
end
# Fix rights and permissions on shared folder
config.vm.synced_folder ".", "/vagrant/", :mount_options => [ "dmode=777", "fmode=666" ]
config.vm.synced_folder "./www", "/vagrant/www/", :mount_options => [ "dmode=775", "fmode=644" ], :owner => 'vagrant', :group => 'www-data'
# Set the timezone to something useful
config.vm.provision :shell, :inline => "echo \"Europe/London\" | sudo tee /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata"
# Make sure APT is up to date
config.vm.provision :shell, :inline => "apt-get update --fix-missing"
# Fix locales
# config.vm.provision :shell, :inline => "apt-get -y install language-pack-en"
config.vm.provision :puppet do |puppet|
puppet.facter = { "fqdn" => "dev.oraculum2.local", "hostname" => "www" }
puppet.manifests_path = "puppet/manifests"
puppet.manifest_file = "oraculum2.pp"
puppet.module_path = "puppet/modules"
puppet.options = "--hiera_config /vagrant/hiera.yaml"
end
end
我的输出如下:
$ vagrant up --provision
Bringing machine 'default' up with 'virtualbox' provider...
[default] Importing base box 'saucy64'...
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[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...
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period. This can
mean a number of things.
If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.
If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.
当然,我试图增加启动超时,但效果相同。我试图在GUI中启动,但它会变成黑屏并且永远不会改变。
使用: Vagrant 1.4.1和Virtualbox 4.3.6
我使用的是Ubuntu 12.04机器,这与工作相同。
我尝试使用Vagrant 1.4.3但结果相同。我迷失了,因为它在工作中很好。有什么想法吗?
答案 0 :(得分:2)
我最初会建议有网络问题,但我错过了'GUI进入黑屏并永不改变'部分。
这听起来好像VirtualBox设置本身似乎有些麻烦。我建议用另一个盒子来尝试它以确定它是否与盒子有问题(可能是一个破碎的下载?)或VirtualBox本身。
答案 1 :(得分:1)
确保用户~vagrant / .ssh / authorized_keys框包含与您的流浪私钥匹配的pub密钥。
我有一个非常类似的问题。流浪汉将中止,虚拟框将开始正常。 我会得到这个:
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Clearing any previously set forwarded ports...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] Booting VM...
[default] Waiting for machine to boot. This may take a few minutes...
The guest machine entered an invalid state while waiting for it
to boot. Valid states are 'starting, running'. The machine is in the
'aborted' state. Please verify everything is configured
properly and try again.
If the provider you're using has a GUI that comes with it,
it is often helpful to open that and watch the machine, since the
GUI often has more helpful error messages than Vagrant can retrieve.
For example, if you're using VirtualBox, run `vagrant up` while the
VirtualBox GUI is open.
我看着打开控制台并看到它启动然后中止了。 所以我生成了调试。
VAGRANT_LOG=debug vagrant up >> DEBUG.LOG.0 2>&1 &
我走过那些数据并看到里面:
DEBUG ssh: == Net-SSH connection debug-level log END ==
INFO ssh: SSH not up: #<Vagrant::Errors::SSHAuthenticationFailed: SSH authentication failed! This is typically caused by the public/private
keypair for the SSH user not being properly set on the guest VM. Please
verify that the guest VM is setup with the proper public key, and that
the private key path for Vagrant is setup properly as well.>
我从提供商启动虚拟盒,登录,检查并且流浪键已损坏。 取而代之。测试ssh作为没有密码的流浪汉。现在关机-h。流浪汉...... SUCCESS !!
流浪汉的输出是误导性的。在调试中,我们可以看到它知道它失败的地方但是没有足够的处理来告诉用户盒子/可能/罚款,沟通不好。答案 2 :(得分:0)
在终端上运行以下命令
$ vagrant ssh-config
然后检查IdentityFile
值的输出,例如:
IdentityFile /home/{USERNAME}/.vagrant.d/insecure_private_key
然后切换或登录到相应的SSH用户并运行vagrant up
,在登录SSH用户之前,您必须&#34;暂停流浪盒&#34;使用vagrant suspend
命令。