Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel Homestead boot authentication error

Tags:

ssh

vagrant

I'm running Laravel Vagrant Homestead and I decided to sweep through to clean up all my projects and also move the location of my primary projects folder from my desktop to my C:/ just to keep things more organized. When I booted up my VM, it fails to authenticate.

==> default: Checking if box 'laravel/homestead' is up to date...
==> 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 => 8000 (adapter 1)
    default: 3306 => 33060 (adapter 1)
    default: 5432 => 54320 (adapter 1)
    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...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection timeout. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...

I've followed a few steps and checked my ssh key paths in my Homestead.yaml and all looks ok.

I ran vagrant ssh-config:

$ vagrant ssh-config
Host default
  HostName 127.0.0.1
  User vagrant
  Port 2222
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile C:/Users/David/.vagrant.d/insecure_private_key
  IdentitiesOnly yes
  LogLevel FATAL

and edited insecure_private_key to match my own (I saw that as an answer somewhere) but to no avail.

Here's my Homestead.yaml (modified to remove website name):

ip: "192.168.10.10"
memory: 2048
cpus: 1

authorize: C:/Users/David/.ssh/id_rsa.pub

keys:
    - C:/Users/David/.ssh/id_rsa

folders:
    - map: C:/Code/projects/website
      to: /home/vagrant/projects/website

sites:
    - map: website.app
      to: /home/vagrant/projects/website/public

variables:
    - key: APP_ENV
      value: local

I assure that the path to my ssh keys have not been modified. I've only started experiencing this issue after cleaning up my projects on the VM and moving my main code folder to C:/ and doing the remapping.

like image 467
davidxd33 Avatar asked Oct 31 '22 16:10

davidxd33


2 Answers

Base on your log, the VM is up. Just that Vagrant can't SSH.

Most probably you mess with the authorized_keys in the VM (~./ssh/authorized_keys)

  1. Leave the vagrant as it is, start another command prompt.

  2. Temporary copy the key from this site in you clipboard.

    https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub

  3. Use putty to SSH in.

    putty [email protected] -p 2222

  4. Type the following:

    echo "--paste from clipboard--" > ./authorized_keys

  5. exit putty

  6. type Vagrant reload notice it will detect the key is not secure and auto inject new one.

  7. You Vagrant should be up now.

HTH.

like image 102
Gian Avatar answered Nov 09 '22 14:11

Gian


This happened when homestead had not been used for a long time.

The box was updated with:

vagrant box add laravel/homestead

Then the issue above arose. The easiest thing to do would be to destroy homestead and thing bring it up again. Your config will persist as it is in ~/.homestead/Homestead.yml

homestead destroy
homestead up
like image 40
tread Avatar answered Nov 09 '22 14:11

tread