我在Windows 8.1操作系统上的VirtualBox中安装了Ubuntu 16.04。
我使用Ubuntu 16.04启动我的虚拟机箱并在其中,当我尝试运行vagrant up
时,它在default: ssh auth method: private key
行冻结,最后在600秒后超时(我设置为Vagrantfile)
等待机器启动时超时。这意味着 Vagrant无法与内部的客户机通信 配置的(" config.vm.boot_timeout"值)时间段。如果你看一下,你应该能够看到Vagrant在尝试连接到机器时遇到的错误。这些错误通常是关于可能出错的好提示。如果您使用自定义文件夹,请确保网络正常运行,并且您可以连接到本机。在这些框中没有正确设置网络是一个常见问题。验证身份验证配置是否也已正确设置, 同样。如果该框似乎正在正常启动,您可能希望增加超时(" config.vm.boot_timeout")值。
我从其位置运行vagrant up
命令。
$ /var/www/yrc-2017$ vagrant up
我的Vagrantfile如下所示:
if Gem::Version.new(Vagrant::VERSION) < Gem::Version.new("1.5.0")
puts "ERROR: Outdated version of Vagrant"
puts " Chassis requires Vagrant 1.5.0+ "
puts
exit 1
end
if not File.exist?(File.join(File.dirname(__FILE__), "puppet", "modules", "apt", ".git"))
puts "NOTICE: Submodules not found, updating for you"
if not system("git submodule update --init", :chdir => File.dirname(__FILE__))
puts "WARNING: Submodules may be missing, and could not automatically\ndownload them for you."
end
# Extra new line, please!
puts
end
require_relative "puppet/chassis.rb"
CONF = Chassis.config
Chassis.install_extensions(CONF)
base_path = Pathname.new( File.dirname( __FILE__ ) )
module_paths = [ base_path.to_s + "/puppet/modules" ]
module_paths.concat Dir.glob( base_path.to_s + "/extensions/*/modules" )
module_paths.map! do |path|
pathname = Pathname.new(path)
pathname.relative_path_from(base_path).to_s
end
Vagrant.configure("2") do |config|
# Set up potential providers.
config.vm.provider "virtualbox" do |vb|
# Use linked clones to preserve disk space.
vb.linked_clone = true if Vagrant::VERSION =~ /^1.8/
end
config.vm.box = "bento/ubuntu-16.04"
# Adding boot timeout
config.vm.boot_timeout = 600
# Enable SSH forwarding
config.ssh.forward_agent = true
# Disable updating of Virtual Box Guest Additions for faster provisioning.
if Vagrant.has_plugin?("vagrant-vbguest")
config.vbguest.auto_update = false
end
# Having access would be nice.
if CONF['ip'] == "dhcp"
config.vm.network :private_network, type: "dhcp", hostsupdater: "skip"
else
config.vm.network :private_network, ip: CONF['ip'], hostsupdater: "skip"
end
config.vm.hostname = CONF['hosts'][0]
config.vm.network "forwarded_port", guest: 22, host: 2222, host_ip: "127.0.0.1", id: 'ssh'
preprovision_args = [
CONF['apt_mirror'].to_s,
CONF['database']['has_custom_prefix'] ? "" : "check_prefix"
]
config.vm.provision :shell, :path => "puppet/preprovision.sh", :args => preprovision_args
config.vm.provision :puppet do |puppet|
puppet.manifests_path = "puppet/manifests"
puppet.manifest_file = "development.pp"
module_paths.map! { |rel_path| "/vagrant/" + rel_path }
puppet.options = "--modulepath " + module_paths.join( ':' ).inspect
puppet.options += " --hiera_config /dev/null"
puppet.options += " --disable_warnings=deprecations"
end
config.vm.provision :shell do |shell|
shell.path = "puppet/postprovision.sh"
shell.args = [
# 0 = hostname
CONF['hosts'][0],
# 1 = username
CONF['admin']['user'],
# 2 = password
CONF['admin']['password']
]
end
synced_folders = CONF["synced_folders"].clone
synced_folders["."] = "/vagrant"
mount_opts = CONF['nfs'] ? [] : ["dmode=777","fmode=777"]
synced_folders.each do |from, to|
config.vm.synced_folder from, to, :mount_options => mount_opts, :nfs => CONF['nfs']
if CONF['nfs'] && Vagrant.has_plugin?("vagrant-bindfs")
config.bindfs.bind_folder to, to
end
end
# Success?
end
我只在上面的文件中添加了以下两行:
config.vm.boot_timeout = 600
和
config.vm.network "forwarded_port", guest: 22, host: 2222, host_ip: "127.0.0.1", id: 'ssh'
我该怎么办?
UPDATE 我在VirtualBox中有以下设置&gt; Windows 8.1上的系统
Paratruualization Interface:默认
硬件虚拟化:
- 启用VT-x / AMD-V
- 启用嵌套分页
上面的所有选项都被禁用,意味着我无法改变任何内容。
答案 0 :(得分:0)
尝试并写下#34; Vagrant ssh&#34;在流浪之后,如果它要求凭证,那就是&#34; vagrant&#34;,如果问题没有通过流浪汉修复 - 提供或流浪汉重新加载(停止和向上),那么删除你的盒子并重建它来自你开始的盒子。
有些时候发生在我身上,当我尝试升级我的盒子时,我只需要重新设置盒子,一切正常。
碰巧系统没有正确启动系统。