Vagrant up on Laravel/Homestead stuck on ssh auth method - ssh

Can anyone help me, the vagrant up stops every time at SSH auth method. I have been stuck for 4 days. Please guys help me.
Vagrant Version is 1.9.2
Virtual Box Version is 5.0.16
Sam#sam-PC MINGW32 /c/www/Homestead (master)
$ vagrant up
Bringing machine 'homestead-7' up with 'virtualbox' provider...
==> homestead-7: Checking if box 'laravel/homestead' is up to date...
==> homestead-7: Clearing any previously set forwarded ports...
==> homestead-7: Clearing any previously set network interfaces...
==> homestead-7: Preparing network interfaces based on configuration...
homestead-7: Adapter 1: nat
homestead-7: Adapter 2: hostonly
==> homestead-7: Forwarding ports...
homestead-7: 80 (guest) => 8000 (host) (adapter 1)
homestead-7: 443 (guest) => 44300 (host) (adapter 1)
homestead-7: 3306 (guest) => 33060 (host) (adapter 1)
homestead-7: 5432 (guest) => 54320 (host) (adapter 1)
homestead-7: 8025 (guest) => 8025 (host) (adapter 1)
homestead-7: 27017 (guest) => 27017 (host) (adapter 1)
homestead-7: 22 (guest) => 2222 (host) (adapter 1)
==> homestead-7: Running 'pre-boot' VM customizations...
==> homestead-7: Booting VM...
==> homestead-7: Waiting for machine to boot. This may take a few minutes...
homestead-7: SSH address: 127.0.0.1:2222
homestead-7: SSH username: vagrant
homestead-7: SSH auth method: private key
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.
If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.
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.
Here is my YAML File
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/www/Sites
to: /home/vagrant/Sites
sites:
- map: test.app
to: /home/vagrant/Sites/Test
databases:
- homestead
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# ports:
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp
Can anyone help me, the vagrant up stops every time at SSH auth method. I have been stuck for 4 days. Please guys help me.
Vagrant Version is 1.9.2
Virtual Box Version is 5.0.16

Related

"SSH auth method: private key" vagrant problem

i want to setup a webserver using vagrant and i have problem with the command "vagrant up":
First i work on a virtual machine (Virtualbox) and i have to build my vagrant project inside virtualbox so I created a Vagrantfile:
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty32"
config.vm.network "private_network", ip: "192.168.68.8"
config.vm.provider "virtualbox" do |vb|
vb.gui = true
end
config.vm.provision :shell, :path => ".provision/bootstrap.sh"
end
Then when i execute the command "vagrant up" it hangs on the last line:
zakaria#server:~/webserver$ 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: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 80 (guest) => 8080 (host) (adapter 1)
default: 80 (guest) => 8080 (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
and the gui stucks too :
This is the picture knowing that i am already enabled VT-X in virtualbox settings.
One thing I encourage you to look is if you have HyperV on, Vagrant docs specifically say to disable it: https://www.vagrantup.com/docs/installation#windows-virtualbox-and-hyper-v
I suffered a similar problem and mine was related (mostly) to Docker Desktop Client for Windows.
I took the nuclear option and removed Docker and disabled a ton of features relating to containers and virtualisation (incl. most specifically Hyper-V) for Windows 10 and it worked (I no longer the get SSH auth method: private key timeout; I am slowly piecing back all the pieces I disabled to see which specific feature is a no-go for a working solution).
Until I removed all the features, my CPU was not recognising VT-x and Extended Page Tables ... once I made the above changes, Intel Processor Identification Utility and CPU-Z confirmed the CPU supported these, and I found that I was once again able to SSH without any timeout issues.

Unable to use vagrant ssh on a custom box

I have successfully created a custom Vagrant box, based on the official ubuntu/xenial64 Vagrant box, but I get this message when I attempt to use 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.
The only change to the box is to provision it with NginX. I then use...
vagrant package --vagrantfile <path_to_vagrantfile> --output nginx.box
... where <path_to_vagrantfile> is, in my case, /home/blackslate/.vagrant.d/boxes/ubuntu-VAGRANTSLASH-xenial64/20170822.0.0/virtualbox/Vagrantfile. I follow this with:
vagrant box add nginx nginx.box
I then create a new directory and use vagrant init nginx to create a new instance of the box. The whole process is described in this question.
When I use vagrant up, all appears to be running as expected:
vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'nginx'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: Custom_default_1503826905856_10643
==> 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: 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: ubuntu
default: SSH auth method: password
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
default: /vagrant => /home/blackslate/repos/Vagrant/Custom
However, vagrant ssh provokes the message at the beginning of this question. When I try to ssh in manually, using "ubuntu" as the ssh user and "vagrant" as the password, I get this:
ssh ubuntu#127.0.0.1
The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.
ECDSA key fingerprint is SHA256:PSnauymZfKi1HIRIKfez5wAnpPFJW9h3eC+TzxiiIWA.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': yes
Warning: Permanently added '127.0.0.1' (ECDSA) to the list of known hosts.
ubuntu#127.0.0.1's password:
Permission denied, please try again.
ubuntu#127.0.0.1's password:
I get a similar result if I try ssh vagrant#127.0.0.1:
ssh vagrant#127.0.0.1
vagrant#127.0.0.1's password:
Permission denied, please try again.
vagrant#127.0.0.1's password:
The same is true if I open the VirtualBox GUI and talk to the VM directly.
I have tried following the instructions here, but I'm guessing that this refers to an older version of Vagrant.
I am hoping that I will be able to make changes at the package stage, so that when I distribute the custom Vagrant box to other developers, vagrant ssh just works, with no need to massage any files beforehand.
Try using the Oracle Virtual Box Manager to log in directly console instead of with ssh. Thereupon may edit the sshd config file and allow the passoword authentication. Restart SSHD service.

Vagrant SSH connection failure

I have an Ubuntu 16.04 LTS and three Vagrant/VirtualBox VMs that need to be turned on at the same time
When I installed Vagrant with VirtualBox, the first day, SSH connection was going correctly. At the following day I obtained this at the three machines (Here is an example of one of them):
xxxx-callserver#xxxxcallserver-Precision-WorkStation-T5400:~/VM$ vagrant up vvs --provision
Bringing machine 'vvs' up with 'virtualbox' provider...
==> vvs: Checking if box 'dmservices/fedora17-x86_64' is up to date...
==> vvs: Clearing any previously set forwarded ports...
==> vvs: Clearing any previously set network interfaces...
==> vvs: Preparing network interfaces based on configuration...
vvs: Adapter 1: nat
vvs: Adapter 2: hostonly
==> vvs: Forwarding ports...
vvs: 22 (guest) => 2222 (host) (adapter 1)
==> vvs: Running 'pre-boot' VM customizations...
==> vvs: Booting VM...
==> vvs: Waiting for machine to boot. This may take a few minutes...
vvs: SSH address: 127.0.0.1:2222
vvs: SSH username: vagrant
vvs: SSH auth method: password
vvs: Warning: Remote connection disconnect. Retrying...
vvs: Warning: Authentication failure. Retrying...
Until it triggers a Time Out
And when I try to vagrant ssh vvs, with or without --plain:
==> vvs: The machine you're attempting to SSH into is configured to use
==> vvs: password-based authentication. Vagrant can't script entering the
==> vvs: password for you. If you're prompted for a password, please enter
==> vvs: the same password you have configured in the Vagrantfile.
Permission denied (publickey).
This the part of the Vagrantfile for that machine (the only differences between the three machines is the name, the ip (inside the same network 192.168.33.0/24) and that the other two are debian/jessie64):
Vagrant.configure("2") do |config|
...
...
config.vm.define "vvs" do |vvs|
vvs.vm.hostname = "vvs"
vvs.vm.box = "dmservices/fedora17-x86_64"
vvs.vm.network "private_network", ip: "192.168.33.4"
vvs.ssh.username = "vagrant"
vvs.ssh.password = "vagrant"
vvs.vm.synced_folder "/home/xxxx-callserver/NetBeansProjects", "/NetBeansProjects", create: true, type: "virtualbox"
vvs.vm.provider "virtualbox" do |v|
v.memory = 2048
v.cpus = 2
v.customize ["modifyvm", :id, "--vram", "64"]
end
end
Thanks in advance and ask me for more info if needed
EDIT: Output of vagrant ssh-config
Host avaya
HostName 127.0.0.1
User vagrant
Port 2201
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /home/xxxx-callserver/VM/.vagrant/machines/avaya/virtualbox/private_key
IdentitiesOnly yes
LogLevel FATAL
Host videogateway
HostName 127.0.0.1
User vagrant
Port 2200
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /home/xxxx-callserver/VM/.vagrant/machines/videogateway/virtualbox/private_key
IdentitiesOnly yes
LogLevel FATAL
Host vvs
HostName 127.0.0.1
User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentitiesOnly yes
LogLevel FATAL
Please check whether you explicitly forwarding each of your Vagrant guest port 22 to different host port. I am not familiar with vagrant script, but you really need a line to explicitly specify different port, because default Vagrant always map 22 to 2222. For multiple VM. This mean only the first vagrant VM will map it correct, the rest will failed. In Vagrantfile, you need something like this for each guest machine.
# avaya
config.vm.network :forwarded_port, id: 'ssh', guest:22, host: 2201,
# videogateway
config.vm.network :forwarded_port, id: 'ssh', guest:22, host: 2200,
# vvs
config.vm.network :forwarded_port, id: 'ssh', guest:22, host: 2222,
Since you already have the first VM setup the port forwarding from 22 to 2222, all the 3 VM will failed change the port forwarding map. Perhaps you should consider change host vvs forwarding to different host port, so it will not conflict with future adhoc vagrant startup that use the default power forwarding.

Cannot ssh into newly created vagrant box

Just created a new vagrant box with minimal centos 7.
I followed this guide. https://blog.engineyard.com/2014/building-a-vagrant-box
Also I have everything in place as mentioned in official vagrant guides here and here
However when I try to do vagrant up. It timeouts when trying to ssh into the box.
What might be causing this?
My network adapter in the VM is NAT.
I tried to set private network ip
config.vm.network "private_network", ip: "192.168.50.4"
I was able to ssh using this ip and vagrant as username and password. I wonder why vagrant is not able to ssh?
Here is the output of vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'my'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: my_box_default_1475351710988_24744
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
==> 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
And after a long time it gives this error.
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.
If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.
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.
ssh keys set using the following commands
mkdir -p /home/vagrant/.ssh
chmod 0700 /home/vagrant/.ssh
wget --no-check-certificate https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub -O /home/vagrant/.ssh/authorized_keys
chmod 0600 /home/vagrant/.ssh/authorized_keys
chown -R vagrant:vagrant /home/vagrant/.ssh
There was a bug in 1.8.5 that can explain this.
can you please upgrade to 1.8.6 ?
Have you tried using
vagrant ssh
This might help someone.
Try running ip addr command and if the network interface has no IP address assigned to it then you need to set ONBOOT to yes.
[root#localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-enp0s3
Then change ONBOOT=no to ONBOOT=yes
Restart the machine and run ip addr to make sure that network is started properly and an IP address is assigned to the network interface.

Vagrant stuck connection timeout retrying (Server refused our key)

My vagrant was working perfectly fine last night. I've just turned the PC on, hit vagrant up, and this is what I get:
vagrant up
Bringing machine 'machine1' up with 'virtualbox' provider...
==> machine1: Checking if box 'puphpet/ubuntu1404-x64' is up to date...
==> machine1: Clearing any previously set forwarded ports...
==> machine1: Clearing any previously set network interfaces...
==> machine1: Preparing network interfaces based on configuration...
machine1: Adapter 1: nat
machine1: Adapter 2: hostonly
==> machine1: Forwarding ports...
machine1: 22 (guest) => 9180 (host) (adapter 1)
machine1: 22 (guest) => 2222 (host) (adapter 1)
==> machine1: Running 'pre-boot' VM customizations...
==> machine1: Booting VM...
==> machine1: Waiting for machine to boot. This may take a few minutes...
machine1: SSH address: 127.0.0.1:2222
machine1: SSH username: vagrant
machine1: SSH auth method: private key
machine1: Warning: Remote connection disconnect. Retrying...
machine1: Warning: Remote connection disconnect. Retrying...
machine1: Warning: Authentication failure. Retrying...
machine1: Warning: Authentication failure. Retrying...
machine1: Warning: Authentication failure. Retrying...
machine1: Warning: Authentication failure. Retrying...
machine1: Warning: Authentication failure. Retrying...
machine1: Warning: Authentication failure. Retrying...
machine1: Warning: Authentication failure. Retrying...
machine1: Warning: Authentication failure. Retrying...
When I tried to connect I see this:
Using username "vagrant".
Server refused our key
vagrant#127.0.0.1's password:
But my key file didn't change. There is similar question Vagrant stuck connection timeout retrying but there is other reason and it not helped me.
There is ssh-config
> vagrant ssh-config
Host machine1
HostName 127.0.0.1
User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile "C:/puphpet/puphpet/files/dot/ssh/id_rsa"
IdentityFile "C:/Users/alexk/.vagrant.d/insecure_private_key"
IdentitiesOnly yes
LogLevel FATAL
Add the following line of code to C:\HashiCorp\vagrant\embedded\gems\gems\vagrant-1.8.5\plugins\guests\linux\cap\public_key.rb:
chmod 0600 ~/.ssh/authorized_keys
Original block:
if test -f ~/.ssh/authorized_keys; then
grep -v -x -f '#{remote_path}' ~/.ssh/authorized_keys > ~/.ssh/authorized_keys.tmp
mv ~/.ssh/authorized_keys.tmp ~/.ssh/authorized_keys
fi
New block:
if test -f ~/.ssh/authorized_keys; then
grep -v -x -f '#{remote_path}' ~/.ssh/authorized_keys > ~/.ssh/authorized_keys.tmp
mv ~/.ssh/authorized_keys.tmp ~/.ssh/authorized_keys
chmod 0600 ~/.ssh/authorized_keys
fi
I had the same problem and found the above solution here.