By default, Vagrant’s
user/password is vagrant/vagrant.
This is now true with the box ubuntu/xenial64,
whose default user is ubuntu. This
is not an issue if you download the box from the public Vagrant server, you
will run into issues if you try to add a packaged box based on ubuntu/xenial64.
vagrant package outputs
package.box.
Now add it:
vagrant box add exp1 package.box
In Vagrantfile, use exp1 as the base box of the VM:
config.vm.box ="exp1"
vagrant up fails with:
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection reset.
Retrying...
default: Warning: Connection aborted.
Retrying...
default: Warning: Connection reset.
Retrying...
default: Warning: Connection aborted. Retrying...
default: Warning: Remote connection
disconnect. Retrying...
default: Warning: Connection aborted.
Retrying...
default: Warning: Connection reset.
Retrying...
default: Warning: Authentication failure.
Retrying...
default: Warning: Authentication failure.
Retrying...
default: Warning: Authentication failure.
Retrying...
default: Warning: Authentication failure.
Retrying...
default: Warning: Authentication failure.
Retrying...
default: Warning: Authentication failure.
Retrying...
default: Warning: Authentication failure.
Retrying...
default: Warning: Authentication failure.
Retrying...
default: Warning: Authentication failure.
Retrying...
default: Warning: Authentication failure.
Retrying...
default: Warning: Authentication failure.
Retrying...
default: Warning: Authentication failure.
Retrying...
default: Warning: Authentication failure.
Retrying...
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 is because vagrant
uses user vagrant, while ubuntu/xenial64 uses user ubuntu. ubuntu/xenial64
user/password can be found in file
C:\Users\admin\.vagrant.d\boxes\ubuntu-VAGRANTSLASH-xenial64\20170523.1.0\virtualbox\Vagrantfile:
config.ssh.username =
"ubuntu"
config.ssh.password =
"5605ab75c7b6cc6baa497b18"
Add these lines to Vagrantfile, vagrant up now succeeds.
This is just the first
hurdle, vagrant ssh now runs
into an issue.
$ vagrant ssh
==>
default: The machine you're attempting to SSH into is configured to use
==>
default: password-based authentication. Vagrant can't script entering the
==>
default: password for you. If you're prompted for a password, please enter
==>
default: the same password you have configured in the Vagrantfile.
vagrant ssh-config shows
something weird, it doesn’t output IdentityFile,
which normally should be like:
IdentityFile C:/devops/exp2/.vagrant/machines/default/virtualbox/private_key
$ vagrant ssh-config
Host default
HostName 127.0.0.1
User ubuntu
Port 2201
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentitiesOnly yes
LogLevel FATAL
The problem is in file C:\Users\admin\.vagrant.d\boxes\exp1\0\virtualbox\Vagrantfile:
Vagrant.configure("2") do |config|
config.ssh.private_key_path =
File.expand_path("../vagrant_private_key", __FILE__)
end
Comment out config.ssh.private_key_path line, now vagrant ssh works.
No comments:
Post a Comment