Homestead/Vagrant - no mounted folders - laravel

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.

Related

Vagrant upn "unknown state"

After running vagrant up command, I get this error:
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'bento/ubuntu-16.04-i386'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'bento/ubuntu-16.04-i386' is up to date...
==> default: Setting the name of the VM: vagrant_default_1494490054450_47471
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 8000 (guest) => 8000 (host) (adapter 1)
default: 8080 (guest) => 8080 (host) (adapter 1)
default: 5000 (guest) => 5000 (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
The guest machine entered an invalid state while waiting for it
to boot. Valid states are 'starting, running'. The machine is in the
'unknown' state. Please verify everything is configured
properly and try again.
If the provider you're using has a GUI that comes with it,
it is often helpful to open that and watch the machine, since the
GUI often has more helpful error messages than Vagrant can retrieve.
For example, if you're using VirtualBox, run `vagrant up` while the
VirtualBox GUI is open.
The primary issue for this error is that the provider you're using
is not properly configured. This is very rarely a Vagrant issue.
When I look at the virtualbox GUI everything seems to be fine, it's in running state and I can even log in into linux. Im running it on Windows 10 OS, Vagrant 1.9.4, VirtualBox 5.1.22
Ok, I solved the problem. I did not have virtualization enabled on my laptop.

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

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 - This webpage is not available

I do not know where I got stuck, I used already homestead and can not figure out the problem. The virtual machine runs correctly, folders are also mirrored correctly.
$ vagrant reload
==> 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 => 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 timeout. Retrying...
==> 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:/Users/Roko/Homestead
default: /home/vagrant/Code => C:/Users/Roko/Homestead/Code
default: /home/vagrant/Code/geogram => C:/Users/Roko/Homestead/Code/geogram
default: /home/vagrant/Code/phpmyadmin => C:/Users/Roko/Homestead/Code/phpmyadmin
default: /home/vagrant/Code/Laravel/public => C:/Users/Roko/Homestead/Code/Laravel/public
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: to force provisioning. Provisioners marked to run always will still run.
I added entries to the hosts file:
127.0.0.1 phpmyadmin.app
127.0.0.1 homestead.app
and this is YAML file:
ip: "192.168.10.10"
memory: 1048
cpus: 1
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Homestead/Code
to: /home/vagrant/Code
sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public
- map: phpmyadmin.app
to: /home/vagrant/Code/phpmyadmin/
databases:
- homestead
variables:
- key: APP_ENV
value: local
And I still get This web page is not available for http://homestead.app:8000/
Can someone figure out what am I doing wrong?
Did you tried vagrant reload --provision
Your vagrant up and the Homestead.yaml configruation is fine. But the ip address inside your hosts file should be 192.168.10.10 so to resolve this edit the hosts file acordingly
(read documentation https://laravel.com/docs/5.2/homestead)
192.168.10.10 phpmyadmin.app
192.168.10.10 homestead.app
then reload your vagrant using provision
vagrant reload --provision
That should do it.
use 192.168.10.10 in your /etc/hosts
Example..
192.168.10.10 Laravel.app

Laravel Homestead won't start, always enters 'guru meditation' status

I am trying to run Laravel Homestead box on DigitalOcean's Ubuntu 14.04 LEMP droplet. I'm following these two tutorials:
How to install Vagrant on a VPS Running Ubuntu 12.04
Laravel Homestead
But I can't seem to start up the box after the installation. I keep getting this error message:
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
==> 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 => 22280 (adapter 1)
default: 443 => 22443 (adapter 1)
default: 3306 => 23306 (adapter 1)
default: 5432 => 25432 (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
The guest machine entered an invalid state while waiting for it
to boot. Valid states are 'starting, running'. The machine is in the
'gurumeditation' state. Please verify everything is configured
properly and try again.
If the provider you're using has a GUI that comes with it,
it is often helpful to open that and watch the machine, since the
GUI often has more helpful error messages than Vagrant can retrieve.
For example, if you're using VirtualBox, run `vagrant up` while the
VirtualBox GUI is open.
Here is my VirtualBox's error log:
VirtualBox log

Resources