Connection to homestead Refused - laravel

Hey I have been trying to get my homestead running but I keep getting to the error:
Bringing machine 'default' up with 'virtualbox' provider...
==> 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: 443 => 44300 (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 refused. Retrying...
default: Warning: Connection refused. Retrying...
default: Warning: Connection refused. Retrying...
I am running windows 10 and Virtual box 5.0.4

The error is happening right after the line 'default: SSH auth method: private key' and presents a connection refused error, so I assume it can be related to your ssh keys. Did you check if your ssh keys are set properly?
ssh-keygen -t rsa -C "you#homestead"
Try running this again and set your public and private key paths in the homestead.yaml file (make sure it points to the file properly) then try again.
If the problem persists show us your homestead.yaml file so we can try to help better :) I hope I could be of help

Related

Vagrant and Virtual Box keep getting set to Aborted

I am having an issue with vagrant and virtualbox in which I am able to vagrant up fine but after a few minutes (sometimes it's 5 minutes sometimes it's an hour) my virtualbox gets set to an 'ABORTED' status. I am unsure of why this happens.
I'm using VirtualBox 5.1.28 and the most recent version of vagrant (2.0.0). I'm running macOS Sierra 10.12.6.
Below is the output of my vagrant up command. I've noticed there is a disconnect retry thing but I don't know why that is there. It is not there for my coworkers. I've done some googling already and all the people with the same problem never make it out of the disconnect retry loop.
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Specific bridge 'en1: Wi-Fi (AirPort)' not found. You may be asked to specify
==> default: which network to bridge to.
==> default: Available bridged network interfaces:
1) en0: Wi-Fi (AirPort)
2) en1: Thunderbolt 1
3) en2: Thunderbolt 2
4) bridge0
5) p2p0
6) awdl0
==> default: When choosing an interface, it is usually the one that is
==> default: being used to connect to the internet.
default: Which interface should the network bridge to? 1
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: bridged
==> default: Forwarding ports...
default: 80 (guest) => 8080 (host) (adapter 1)
default: 3306 (guest) => 33306 (host) (adapter 1)
default: 5000 (guest) => 5000 (host) (adapter 1)
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: password
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Connection reset. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Connection reset. Retrying...
default: Warning: Remote connection disconnect. Retrying...
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: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
default: /vagrant => /Users/jdavis/hts_vagrant
default: /app/localhost/html => /Users/jdavis/projects
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
==> default: Running provisioner: shell...
default: Running: inline script

Error booting after Virtualbox VM upgrade

I am using Vagrant and Homestead for laravel development. After updgrading my VM, when I vagrant up from Homestead root location I got an error:
$ vagrant up
Bringing machine 'homestead-7' up with 'virtualbox' provider...
==> homestead-7: Importing base box 'laravel/homestead'...
==> homestead-7: Matching MAC address for NAT networking...
==> homestead-7: Checking if box 'laravel/homestead' is up to date...
==> homestead-7: Setting the name of the VM: homestead-7
==> 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 por`enter code here`ts...
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
homestead-7: Warning: Remote connection disconnect. Retrying...
homestead-7:
homestead-7: Vagrant insecure key detected. Vagrant will automatically repla ce
homestead-7: this with a newly generated keypair for better security.
homestead-7:
homestead-7: Inserting generated public key within guest...
homestead-7: Removing insecure key from the guest if it's present...
homestead-7: Key inserted! Disconnecting and reconnecting using new SSH key. ..
==> homestead-7: Machine booted and ready!
==> homestead-7: Checking for guest additions in VM...
==> homestead-7: Setting hostname...
==> homestead-7: Configuring and enabling network interfaces...
==> homestead-7: Mounting shared folders...
homestead-7: /vagrant => D:/Development/homestead
Vagrant was unable to mount VirtualBox shared folders. This is usually
because the filesystem "vboxsf" is not available. This filesystem is
made available via the VirtualBox Guest Additions and kernel module.
Please verify that these guest additions are properly installed in the
guest. This is not a bug in Vagrant and is usually caused by a faulty
Vagrant box. For context, the command attempted was:
mount -t vboxsf -o uid=1000,gid=1000 vagrant /vagrant
enter code here
The error output from the command was:
: No such file or directory

Windows: Running vagrant as administrator not working - works normally

I've been using vagrant to run laravel/lumen as well as just other general stuff such as node js scripts. I've run into problems installing some things using npm, and it seems that a solution working for a lot of people is just running the command line (or git bash in my case) as an administrator. However when I try this and use vagrant up, I get a long list of errors. I've also tried vagrant init which gives the same errors.
Here are the errors
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> 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: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Setting hostname...
v==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
default: /vagrant => C:/Users/Andy McNally/Homestead
vag default: /home/vagrant/home => C:/Users/Andy McNally/home
r==> default: Machine already provisioned. Run `vagrant provision` or use
the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always
will still run.

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.

Port forwarding on Vagrant 1.8.1

I have a vagrant installed on Windows7 PC. I have jenkins, puppet other stuff installed on my centos7 vagrant box. When I do vagrant reload
==> default: Attempting graceful shutdown of VM...
==> 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: 8082 (guest) => 8080 (host) (adapter 1)
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: Warning: Remote connection disconnect. Retrying...
==> default: Machine booted and ready!
GuestAdditions 5.0.12 running --- OK.
==> default: Checking for guest additions in VM...
==> default: Mounting shared folders...
default: /vagrant => C:/vagrant/projects/jenkins
default: /vagrant_data => C:/Devops
==> default: Machine already provisioned. Run `vagrant provision` or use the `-
provision`
==> default: flag to force provisioning. Provisioners marked to run always will
still run.
Now when I do curl -v
C:\>curl -v http://127.0.0.1:8082
* Rebuilt URL to: http://127.0.0.1:8082/
* timeout on name lookup is not supported
* Trying 127.0.0.1...
* connect to 127.0.0.1 port 8082 failed: Connection refused
* Failed to connect to 127.0.0.1 port 8082: Connection refused
* Closing connection 0
curl: (7) Failed to connect to 127.0.0.1 port 8082: Connection refused
Needless to say http://127.0.0.1:8082 doesnt fetch anything in the browser wither. What am I missing? BTW my vagrant and virtual box 5 is running on Windows7.
Thanks in advance
R

Resources