Authentication Error with Homestead after Restoring from Backup - vagrant

I accidentally ran vagrant destroy before forgetting to backup my database. I replaced my VM directory with a backup and then corrected the UUID so they matched. However, when trying to start Homestead, I get an authentication error:
$ homestead up
/opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/pre-rubygems.rb:31: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
/opt/vagrant/embedded/gems/gems/bundler-1.10.6/lib/bundler/shared_helpers.rb:78: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: There was a problem while downloading the metadata for your box
==> default: to check for updates. This is not an error, since it is usually due
==> default: to temporary network problems. This is just a warning. The problem
==> default: encountered was:
==> default:
==> default: The requested URL returned error: 404 Not Found
==> default:
==> default: If you want to check for box updates, verify your network connection
==> default: is valid and try again.
==> 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) => 8000 (host) (adapter 1)
default: 443 (guest) => 44300 (host) (adapter 1)
default: 3306 (guest) => 33060 (host) (adapter 1)
default: 5432 (guest) => 54320 (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
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
I can start Homestead in the VirtualBox GUI and login with vagrant/vagrant but this does not help to get my sites online as No Input File Specified is displayed when attempting to access the sites in a browser.
The ssh keys were previously setup on this machine (backup is only a few days old) so I assumed the authentication would still work.
How do I get Homestead back up? Using OSX Sierra, VirtualBox 5.0.14, Homestead 2.2.1, Vagrant 1.8.1
I am a bit lost when it comes to ssh keys, but I've pulled up the following:
In OSX terminal:
$ vagrant ssh-config
Host default
HostName 127.0.0.1
User vagrant
Port 2200
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile "/Users/Myself/.vagrant.d/insecure_private_key"
IdentitiesOnly yes
LogLevel FATAL
$ cat /Users/Myself/.vagrant.d/insecure_private_key
-----BEGIN RSA PRIVATE KEY------
MIIEogIBAAKCAQEA6NF8iallvQVp22WDk..... omitted ...
-----END RSA PRIVATE KEY-----
Then I can ssh into the Homestead instance and run:
$ cat ~/.ssh/authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADA .... omitted ...6KI3AcGkjQOt/ vagrant
Back on Terminal in OSX, I have:
$ cat ~/.ssh/id_rsa
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: AES-128-CBC,FD8746C7776F06E98C74CBABEE95360C
MffswxNSLA1bn9/APO9/mb5QdF1...omitted
-----END RSA PRIVATE KEY-----
Do some of these keys need to be the same?
EDIT: Successful mysqldump on the Homestead machine! But -- I can't figure out how to move it to my local machine. The shared folders don't seem to be working. I can see the home/vagrant/Code directory but it is empty and does not appear to be liked with my local version. Within Settings > Shared Folders I see
Folder Path: /Users/Myself/Code
Folder Name: home_vagrant_Code
But that does no seem to be pulling up any files from /Users/Myself/Code.
If I can just get the mysqldump off the VM, I'll rollback the VM back to when it was working and reinstate the DB from there.

I was not able to restore the backup VM due to the ssh authentication errors.
However, I was able to ssh into the machine and perform a mysqldump.
To access the file, I ran into issues with mounting the virtual CD, it never worked. Thankfully I ran:
sudo apt-get install virtualbox-guest-utils
Then I was able to add a shared directory.
Finding this directory was also not obvious as it was located in the media director with an "sf" prefix (shared folder). So once I set up the folder through the VirtualBox GUI I had to run:
ls /media
And thankfully the directory was there.
I then copied the sql dump file to this directory and was able to see it on my local machine.
The next step was to revert back to the old VM folder with TimeMachine (still unclear why the backup did not work) and then ran homestead up and everything ran smoothly from there as I was able to access phpmyadmin and import the mysqldump file.

Related

vagrant ssh get error: ssh_exchange_identification: read: Connection reset by peer

I'm installing buildroot. But when I fllow the manual from buildroot doc, the error occurred.
This is my process.
curl -O https://buildroot.org/downloads/Vagrantfile; vagrant up
And the results are as fllows.
==> default: Attempting graceful shutdown of VM...
default: Guest communication could not be established! This is usually because
default: SSH is not running, the authentication information was changed,
default: or some other networking issue. Vagrant will force halt, if
default: capable.
==> default: Forcing shutdown of VM...
==> default: Checking if box 'ubuntu/bionic64' 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: 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: vagrant
default: SSH auth method: private key
Then I try to connect with ssh
vagrant ssh
But there is northing to show. Just like this.
lt#ubuntu:~/qemu/buildroot$ vagrant ssh
So I try ssh command.
lt#ubuntu:~/qemu/buildroot$ vagrant ssh-config
Host default
HostName 127.0.0.1
User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /home/lt/.vagrant.d/insecure_private_key
IdentitiesOnly yes
LogLevel FATAL
ssh vagrant#127.0.0.1 -p 2222 i /home/lt/.vagrant.d/insecure_private_key
However, also northing to show.
Could you give me a sultion? Thanks.
Try performing the following commands:
vagrant halt
vagrant up
vagrant ssh
This should fix the issue. If it still persists, check your bios settings to ensure that virtualization is enabled. If your on windows, make sure hyper-v is disabled.
Its a duplicate question and answered multiple times
You can refer my answer here https://stackoverflow.com/a/62928259/6150566
Enable Virtualization by going to BIOS if you are on Windows.
If you are running VirtualBox inside a nested VM, you can enable the Virtualization settings (VT-X) by powering off the VM.

homestead didn't wants to start normaly

I updated Virtualbox to 6.0.2 and Vagrant into 2.2.3 in MacOSX Siera. Also remove old laravel/homestead folder and download new one v8.0.2. But when install virtualbox and vagrant on my MacOSX and run vagrant up it make new ssh keys and move it into new virtual box machine. First indicator that I saw is that he forward only 22 port into virtual machine and make it in some strange name(previous naming is like homestead-7), and last time is homestead_default_1549352737068_70025. Here is list of logs that I get from console:
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'laravel/homestead'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'laravel/homestead' version '7.0.0' is up to date...
==> default: Setting the name of the VM: homestead_default_1549352737068_70025
==> 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
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
Next problem that I see when ssh to it that it didn't have project folder with sub-folders that defined in Homestead.yaml file also it didn't have mysql connection also apache/nginx didn't belongs there(my web sites didn't wants to start). Here is my Homestead.yaml snippet:
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/developing/projects
to: /home/vagrant/projects
sites:
- map: project_test.test
to: /home/vagrant/projects/project_test/public
- map: project_test2.test
to: /home/vagrant/projects/project_test2/public
databases:
- project_test
- project_test2
I try multiple times vagrant destroy && vagrant up --provision but it didn't helps me. Can anybody help me what to do next?Any idea?
After uninstall all(Vagrant and Virtualbox) and install new version. It's partially works. I can ssh to it, it works mysql connect when set ip to be 127.0.0.1 (didn't bind to be "192.168.10.10" from Homestead file) but still can't access to any of my websites over my browser :(
Try adding your sites to your local /etc/hosts file.
192.168.10.10 project_test.test
192.168.10.10 project_test2.test

Laravel Homestead Vagrant - Cannot see site - installing problems

I have been attempting getting this to work now for 4 hours now and I am struggling.
I am trying to get my homestead working. I followed the installation guide here:
https://laravel.com/docs/5.2/homestead
I have a few questions:
1.) When I install homestead by cloning the github repo - I get a src folder in that installation and in that src folder I have this: src/stubs/Homestead.yaml. When I followed the instructions I ran bash init.sh inside of the root of that installation and that created a /.homestead folder with 3 files in it a after.sh a aliases and a Homestead.yml file. From my understanding I am to modify the Homestead.yml to reflect my enviornment. The question is which one? The one in the hidden .homestead folder or the one in the place where I installed Homestead?
2.) When I go to http://site1.local:8000/ in a browser I get a Site cannot be reached error - refused to connect. When i go to http://localhost:8000/ I get 'No input file specified.'
3.) The command Homestead from the command line isn't recognized as a internal or external command - should it be? I read people with similar problems should run the command homestead up yet it isn't recognized for me.
Here is my Homestead.yml file:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/LaravelProjects/projects
to: /home/vagrant/Code
sites:
- map: site1.local
to: /home/vagrant/Code/Laravel/public
databases:
- homestead
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# ports:
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp
Here is my host file:
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
#laravel project 1
192.168.10.10 site1.local
I have updated my hosts file. I have tried running vagrant reload --provision and vagrant destroy and other vagrant commands without luck. Any suggestions?
Here is the dump of running vagrant reload --provision
==> default: Attempting graceful shutdown of VM...
==> 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 (guest) => 8000 (host) (adapter 1)
default: 443 (guest) => 44300 (host) (adapter 1)
default: 3306 (guest) => 33060 (host) (adapter 1)
default: 5432 (guest) => 54320 (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
default: Warning: Remote connection disconnect. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: The guest additions on this VM do not match the installed version of
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you see
default: shared folder errors, please make sure the guest additions within the
default: virtual machine match the version of VirtualBox you have installed on
default: your host and reload your VM.
default:
default: Guest Additions Version: 5.0.20
default: VirtualBox Version: 5.1
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
default: /vagrant => C:/Users/Radley.Anaya/LaravelProjects/Homestead
default: /home/vagrant/Code => C:/Users/Radley.Anaya/LaravelProjects/projects
==> default: Running provisioner: file...
==> default: Running provisioner: shell...
default: Running: inline script
==> default: Running provisioner: shell...
default: Running: inline script
==> default: Running provisioner: shell...
default: Running: C:/Users/RADLEY~1.ANA/AppData/Local/Temp/vagrant-shell20160801-10000-y9i8nr.sh
==> default: Running provisioner: shell...
default: Running: script: Creating Site: site1.local
==> default: Running provisioner: shell...
default: Running: script: Restarting Nginx
==> default: Running provisioner: shell...
default: Running: script: Creating MySQL Database
==> default: Running provisioner: shell...
default: Running: script: Creating Postgres Database
==> default: Running provisioner: shell...
default: Running: script: Clear Variables
==> default: Running provisioner: shell...
default: Running: inline script
==> default: You are already using composer version 1.2.0 (stable channel).
==> default: Running provisioner: shell...
default: Running: C:/Users/RADLEY~1.ANA/AppData/Local/Temp/vagrant-shell20160801-10000-i2qk4o.sh
Update
I ssh'd into the VM and my folder structure looks like: Code/first/index.php how do I update it?
My Homestead.yml file has a different directory structure - I think that is likely causing my issues. How do I fix this?
From my understanding the .yml file dictates the folder structure of the virtual machine? This isn't the case??
Solved
My mappings were messed up. I ssh'd into the vm to verify and updated my .yaml file then provisioned the vm and everything is working. Also I had to remove the port from my url.

Laravel homestead and vagrant setup not working

I followed the original documentation for vagrant and homestead but every site.app:8000 you visit it just keeps loading and nothing happens. Is there an error within this configuration files?
Homestead.yaml
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Developer/laravel
to: /home/vagrant/laravel
sites:
- map: hello-world.local
to: /home/vagrant/laravel/hello-world/public
databases:
- homestead
hosts
192.168.10.10 hello-world.local
vagrant up log
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) => 8000 (host) (adapter 1)
default: 443 (guest) => 44300 (host) (adapter 1)
default: 3306 (guest) => 33060 (host) (adapter 1)
default: 5432 (guest) => 54320 (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
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: The guest additions on this VM do not match the installed version of
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you see
default: shared folder errors, please make sure the guest additions within the
default: virtual machine match the version of VirtualBox you have installed on
default: your host and reload your VM.
default:
default: Guest Additions Version: 5.0.20
default: VirtualBox Version: 5.1
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
default: /vagrant => /Users/nikla/Developer/homestead
default: /home/vagrant/laravel => /Users/nikla/Developer/laravel
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
nmap log
Starting Nmap 7.12 ( https://nmap.org ) at 2016-07-29 22:55 ART
Nmap scan report for 192.168.10.10
Host is up (0.00063s latency).
Not shown: 994 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
443/tcp open https
3306/tcp open mysql
5432/tcp open postgresql
9000/tcp open cslistener
Nmap done: 1 IP address (1 host up) scanned in 13.19 seconds
I have check your "vagrant up" log and I see all things ok. I have compared your log with my machine's log and is similar.
Try to open the IP in the web browser (change the IP with your Vagrant VM IP):
http://192.168.10.10/
Do you have some firewall, antivirus or another software that could disable the communication?
Try to execute a nmap to see wich ports are open. I paste my nmap, from my host machine to my virtual machine, so you can see wich ports are open.
$ nmap 192.168.10.10
Starting Nmap 6.47 ( http://nmap.org ) at 2016-07-30 01:48 Hora de verano romance
Nmap scan report for homestead.app (192.168.10.10)
mass_dns: warning: Unable to determine any DNS servers. Reverse DNS is disabled. Try using --system-dns or specify valid servers with --dns-servers
Host is up (0.0019s latency).
Not shown: 993 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
111/tcp open rpcbind
443/tcp open https
3306/tcp open mysql
5432/tcp open postgresql
9000/tcp open cslistener
MAC Address: 08:00:27:CD:99:8C (Cadmus Computer Systems)
Nmap done: 1 IP address (1 host up) scanned in 21.83 seconds
Check:
The id_rsa.pub and the id_rsa are in this folder.
The /Users/nikla/Developer/laravel folder exists in your host machine.
The /home/vagrant/laravel exists in your Vagrant VM machine. You can check it login in the machine using the command "vagrant ssh".
Try to access to the http://test.app without the 8000 port.
I don't see the database in your Homestead.yaml file. You should have the next text in this file
databases:
- homestead

Vagrant up error /sbin/ifdown eth1 2> /dev/null

on ubuntu16x64 + virtualbox + vagrant
I'm trying add the laravel/homestead box
I get error in
$ Vagrant up
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'laravel/homestead'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: Setting the name of the VM: homestead-7
==> 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) => 8000 (host) (adapter 1)
default: 443 (guest) => 44300 (host) (adapter 1)
default: 3306 (guest) => 33060 (host) (adapter 1)
default: 5432 (guest) => 54320 (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
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
/sbin/ifdown eth1 2> /dev/null
Stdout from the command:
Stderr from the command:
the output refers to a problem with the generated keys
I am not familiar with the key generation, so perhaps the problem is there, I report the steps I did to create them, maybe I made some big stupid
$ cd /home/ubiagio/.ssh/
$ ssh-keygen -t rsa -C biagiopas#yahoo.it
Generating public/private rsa key pair.
Enter file in which to save the key (/home/ubiagio/.ssh/id_rsa): biagiopas_sshrsakey
two keys generated
/home/ubiagio/.ssh/
biagiopas_ssh_key
biagiopas_ssh_key.pub
////////////////////////////////////////////
configuration
~/.homestead/Homestead.yaml
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
#authorize: ~/.ssh/id_rsa.pub
authorize: ~/.ssh/biagiopas_ssh_key.pub
keys:
# - ~/.ssh/id_rsa
- ~/.ssh/biagiopas_sshrsakey
folders:
- map: ~/Code
to: /home/vagrant/Code
sites:
- map: laraveltestblog01.app
to: /var/www/html/laravel/testblog01/public
////////////////////////////////////////////
if the cause is not due to the keys, then may be another problem encountered before
Launching The Vagrant Box
$ cd /home/ubiagio/Homestead/
$ vagrant up
This Vagrant environment has specified that it requires the Vagrant
version to satisfy the following version requirements:
>= 1.8.4
You are running Vagrant 1.8.1, which does not satisfy
these requirements. Please change your Vagrant version or update
the Vagrantfile to allow this Vagrant version. However, be warned
that if the Vagrantfile has specified another version, it probably has
good reason to do so, and changing that may cause the environment to
not function properly.
I tried to upgrade with
$ Sudo apt upgrade
but without success
so I manually changed the Vagrantfile
$ gedit /home/ubiagio/Homestead/Vagrantfile
#Vagrant.require_version '>= 1.8.4'
Vagrant.require_version '>= 1.8.1'
thanks from now for the help

Resources