ubuntu xenial64 盒子密码?

Kil*_*ail 36 vagrant 16.04

可能是一个愚蠢的问题,但是

我之前在 vagrant 中使用过 trusty64 框,并尝试使用 xenial64 框,但它不接受普通用户:vagrant 密码:vagrant login?

小智 30

正如用户@prometee 在此启动板讨论#1569237 中所述,您可以在以下位置找到密码:

~/.vagrant.d/ubuntu-VAGRANTSLASH-xenial64/20161221.0.0/virtualbox/Vagrantfile
Run Code Online (Sandbox Code Playgroud)

或者:

~/.vagrant.d/boxes/ubuntu-VAGRANTSLASH-xenial64/20161221.0.0/virtualbox/Vagrantfile
Run Code Online (Sandbox Code Playgroud)

取决于你的 Vagrant 版本。(注意20161221.0.0路径一部分将根据下载框的时间而有所不同。此外,您的目录中可能不止一个。)

这是我的(第 8 行):

# Front load the includes
include_vagrantfile = File.expand_path("../include/_Vagrantfile", __FILE__)
load include_vagrantfile if File.exist?(include_vagrantfile)

Vagrant.configure("2") do |config|
  config.vm.base_mac = "022999D56C03"
  config.ssh.username = "ubuntu"
  config.ssh.password = "fbcd1ed4fe8c83b157dc6e0f"

  config.vm.provider "virtualbox" do |vb|
     vb.customize [ "modifyvm", :id, "--uart1", "0x3F8", "4" ]
     vb.customize [ "modifyvm", :id, "--uartmode1", "file", File.join(Dir.pwd, "ubuntu-xenial-16.04-cloudimg-console.log") ]
  end
end
Run Code Online (Sandbox Code Playgroud)

仅供参考,用户@racb 在同一个讨论中提到了this bug report having been filed ubuntu和到目前为止的no [...] decision has been made yet内容。

  • 我在 ~\.vagrant.d\boxes\ubuntu-VAGRANTSLASH-xenial64\20170331.0.0\virtualbox\Vagrantfile (在 Windows 中)找到它 (2认同)
  • 这个答案必须是公认的答案! (2认同)

小智 11

昨天我把头撞在墙上半天,直到我意识到我运行的是旧版本的 Virtualbox (5.0.x) 和 Vagrant (1.8.0)

更新到 VirtualBox 5.1.x 和 Vagrant 1.8.7 并获得更好的结果

基本上ubuntu/xenial32ubuntu/xenial64图像有缺陷,因为它们不是vagrant用户开箱即用的。

这违反了 Vagrant规范

我最终v0rtex/xenial64按照此错误报告中的建议使用。不知道为什么canonical不解决这个问题

我的流浪文件如下

# -*- mode: ruby -*-
# vi: set ft=ruby :

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  config.vm.box = "v0rtex/xenial64"

  config.vm.network :private_network, ip: "10.10.10.10"

  config.ssh.username = 'vagrant'
  config.ssh.password = 'vagrant'

  config.vm.provider :virtualbox do |vb|
     vb.name = "supercool"
     vb.customize ["modifyvm", :id, "--memory", "768"]
     vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
  end

end
Run Code Online (Sandbox Code Playgroud)

如果您仍然想使用canonical提供的图像,可以使用以下方法

# -*- mode: ruby -*-
# vi: set ft=ruby :

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  config.vm.box = "ubuntu/xenial64"

  config.vm.network :private_network, ip: "10.10.10.10"

  config.ssh.insert_key = true
  config.ssh.forward_agent = true

  config.vm.provider :virtualbox do |vb|
     vb.name = "supercool"
     vb.customize ["modifyvm", :id, "--memory", "768"]
     vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
  end

end
Run Code Online (Sandbox Code Playgroud)

如果您这样做,该/vagrant文件夹将由ubuntu:ubuntu而不是vagrant:vagrant. 如果您的脚本依赖于vagrant用户在那里,它们就会中断