homestead didn't wants to start normaly - laravel

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

Related

Error when Launching a vagrant box using "vagrant up" on Windows

I'm attempting to set a virtual machine enviroment using vagrant.
I've done a couple of tries with different boxes via vagrantcloud.com, BUT I'm always getting stuck when I try to launch this box: I added a URL on vagrant file for downloads https://app.vagrantup.com/ubuntu/boxes/trusty64, but i doesnt seem to work
λ vagrant init x9 ubuntu/boxes/bionic64
λ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
default: Box 'x9' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
default: Box file was not detected as metadata. Adding it directly... default: Adding box 'x9' (v0) for provider: virtualbox
default: Downloading: https://app.vagrantup.com/ubuntu/boxes/bionic64
default:
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.
Failed to connect to app.vagrantup.com port 443: Timed out
Anyone knows how do I proceed ?
it's normal it cannot find this box if you haven't downloaded it yet.
I tried and it works perfect, it downloads and start the box, i share you my basic config (which is what i tested)
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/bionic64"
end
This is my output:
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'ubuntu/bionic64' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Loading metadata for box 'ubuntu/bionic64'
default: URL: https://vagrantcloud.com/ubuntu/bionic64
==> default: Adding box 'ubuntu/bionic64' (v20200304.0.0) for provider: virtualbox
default: Downloading: https://vagrantcloud.com/ubuntu/boxes/bionic64/versions/20200304.0.0/providers/virtualbox.box
==> default: Box download is resuming from prior download progress
default: Download redirected to host: cloud-images.ubuntu.com
==> default: Successfully added box 'ubuntu/bionic64' (v20200304.0.0) for 'virtualbox'!
==> default: Importing base box 'ubuntu/bionic64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/bionic64' version '20200304.0.0' is up to date...
==> default: Setting the name of the VM: amos_default_1583767787636_71616
==> 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
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: 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.2.34
default: VirtualBox Version: 6.1
==> default: Mounting shared folders...
default: /vagrant => /home/amos
The only possible explanation is that you have bad internet connection...try to do a speed test here:
https://www.speedtest.net/
if you have bad connection try restart your modem or contact your internet provider

Authentication Error with Homestead after Restoring from Backup

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.

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.

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

Homestead/Vagrant - no mounted folders

I'm trying to get a Homestead VM setup for my laravel project. I have followed the instructions here exactly. The only difference is the folder I put the Homestead directory in; I simply put it in C:/.
Otherwise I have set up the Vagrant box, cloned and inited Homestead, and set up the homestead.yaml file exactly as instructed. I then start the VM with vagrant ssh. When I use ls to view the folders in the mapped directory - nothing.
This is my homestead.yaml file:
p: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/ssh/id_rsa.pub
keys:
- ~/ssh/id_rsa.pub
folders:
- map: c:/laravelprojects
to: /home/vagrant/Code
sites:
- map: app.dev
to: /home/vagrant/Code/username/public
databases:
- homestead
When I run vagrant up, this is the output:
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: Warning: Remote connection disconnect. Retrying...
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...
==> default: Mounting shared folders...
default: /vagrant => C:/Homestead
As you can see, the last two lines seem to be mounted the wrong folder, ie the folder the Vagrant machine is being started from. However, checking in Virtualbox shows that both this and the folder specified in the .yaml file are set and mapped.
What gives?
/vagrant is mounted by default from the project where Vagrantfile is.
I am not sure if it can be disable from homestead.yaml file directly, but you can edit the Vagrantfile and add
config.vm.synced_folder ".", "/vagrant", disabled: true
so it will not create a /vagrant directory in the VM and VirtualBox will show only your folder specified from the yaml.

Resources