Homestead/Vagrant `* The host path of the shared folder is missing: ~/Code` - php

I am getting the below error while running the vagrant up command within ~/Homestead -
The host path of the shared folder is missing: ~/Code`
Here's the output from my terminal after running vagrant up within ~/Homestead
Josephs-MBP:Homestead Joey$ vagrant up
Bringing machine 'homestead-7' up with 'virtualbox' provider...
==> homestead-7: Box 'laravel/homestead' could not be found. Attempting to find and install...
homestead-7: Box Provider: virtualbox
homestead-7: Box Version: >= 0.4.0
==> homestead-7: Loading metadata for box 'laravel/homestead'
homestead-7: URL: https://atlas.hashicorp.com/laravel/homestead
==> homestead-7: Adding box 'laravel/homestead' (v1.0.1) for provider: virtualbox
homestead-7: Downloading: https://atlas.hashicorp.com/laravel/boxes/homestead/versions/1.0.1/providers/virtualbox.box
==> homestead-7: Successfully added box laravel/homestead' (v1.0.1) for 'virtualbox'!
There are errors in the configuration of this machine. Please fix
the following errors and try again:
vm:
* The host path of the shared folder is missing: ~/Code
How do I fix my issue with the host path?
Your truly,
Total Newb

You have a synced folder configured from your Vagrantfile but this folder does not exists.
Create the folder ~/Code on your mac and run again (you can run mkdir -pv ~/Code)

Related

Laravel Homestead - site cant be reached. Windows 10

Im getting started with Laravel Homestead and spend half a day working with tutorials and manuals.
The problem is that everything looks perfect - without any errors, but still I cant see laravel welcom page.
I've installed vagrant and virtual box.
at c:/windows/system32/drivers/etc/hosts added line like:
# 192.168.10.10 homestead.test
My directory tree looks like:
~/Server/.ssh
~/Server/Code
~/Server/Homestead
I made .ssh keys and using git bash:
cd Server
git clone https://github.com/laravel/homestead.git Homestead
cd Homestead
bash init.sh
and configured homestead.yaml file:
ip: "192.168.10.10"
memory: 2048
cpus: 2
provider: virtualbox
authorize: ~/Server/.ssh/id_rsa.pub
keys:
- ~/Server/.ssh/id_rsa
folders:
- map: ~/Server/Code
to: /home/vagrant/code
sites:
- map: homestead.test
to: /home/vagrant/code/homestead/public
databases:
- homestead
features:
- mariadb: false
- ohmyzsh: false
- webdriver: false
# ports:
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp
Everything looks fine to me so far, is it?
Next in shell:
vagrant up
vagrant ssh
successfully logged to laravel and changed directory to only one existing code, then:
laravel new homestead
Finished iwth message Application ready! Build something amazing.
Did also another one project with different names, but when I type in my chrome browser homestead.test or whatever I call my project -> This site can't be reached.
Thanks for your help.
It sounds like you made the vagrant box first then created a new app after ssh into the vagrant box. I usually take different steps.
Make sure vagrant is installed. https://www.vagrantup.com/downloads.html
Make sure the laravel/homested box has been added to vagrant vagrant box add laravel/homestead
Make sure homestead is installed on the home directory in a file named Homestead git clone https://github.com/laravel/homestead.git ~/Homestead https://laravel.com/docs/7.x/homestead#first-steps
install homestead into your project composer require laravel/homestead --dev
use the make command to generate the vagrant and homestead.yaml files (for windows vendor\\bin\\homestead make) https://laravel.com/docs/7.x/homestead#per-project-installation
Configure the vagrant, homestead.yaml, and hosts file as you have done.
vagrant up

Failure to launch Homestead Vagrant Box

I am in the middle of following Laravel Tutorial which directs me to installing the homestead vagrant box; I am stuck on composer part.
I use Ubuntu 14.04 LTS (64bit) and ran Vagrant through virtualbox 5.0.24r108355 (amd64). Apparently Homestead has conflict with virtualbox 5.1.
My understanding of Homestead is that it will set up
Ubuntu 16.04
Git
PHP 7.0
HHVM
Nginx
MySQL
MariaDB
Sqlite3
Postgres
Composer
Node (With PM2, Bower, Grunt, and Gulp)
Redis
Memcached
Beanstalkd
This is partly confirmed by the following: 16.04 LTS installation.
yhk#home:~/Homestead$ vagrant ssh
Welcome to Ubuntu 16.04 LTS (GNU/Linux 4.4.0-22-generic x86_64)
* Documentation: https://help.ubuntu.com/
Last login: Fri Jul 15 13:20:08 2016 from 10.0.2.2
However, when I try vagrant up, it fails. Apparently, I am already using composer. How do I proceed along to fix this glitch and have vagrant up and running properly?
yhk#home:~/Homestead$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
yhk#home:~/Homestead$ vagrant provision
==> 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: /tmp/vagrant-shell20160715-14549-1a6hi0t.sh
==> default: Running provisioner: shell...
default: Running: script: Creating Site: homestead.app
==> 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.1.3 (stable channel).
==> default: Running provisioner: shell...
default: Running: /tmp/vagrant-shell20160715-14549-l87w5y.sh
I think the setup properly done...
yhk#home:~/Homestead$ ls
CHANGELOG.md composer.lock init.bat LICENSE.txt scripts Vagrantfile
composer.json homestead init.sh readme.md src
yhk#home:~/.homestead$ ls
after.sh aliases Homestead.yaml Homestead.yaml~
Once again, how do I proceed along to get composer issue fixed and have vagrant up and running?
have you tried to run vagrant up with sudo privileges?
cd to Homestead folder and execute
sudo vagrant up
and then see if the error remains. sometimes this is a issue related with permissions.

Vagrant error while mounting nfs shared folders following roots bedrock+trellis+sage tutorial

Im following this repo https://github.com/roots/roots-example-project.com.
I did all steps till the vargrant up to see the development part.
It gives me this error after a few seconds:
==> default: Preparing to edit /etc/exports. Administrator privileges will be required... sudo: /etc/init.d/nfs-kernel-server: command not
found
==> default: Mounting NFS shared folders... The following SSH command responded with a non-zero exit status. Vagrant assumes that this means
the command failed!
mount -o 'vers=3,udp'
192.168.50.1:'/home/miguelrebola/projects/work/example.com/site' /vagrant-nfs-roots-example-project.com
Stdout from the command:
Stderr from the command:
stdin: is not a tty mount.nfs: requested NFS version or transport
protocol is not supported
I need to get that going and i've tried everything i found on internet.
It only gives this error once after that it only shows this when running vagrant up.
--- work/example.com » vagrant up Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: VirtualBox VM is already running.
==> default: Checking for host entries
--- work/example.com »
any idea whats happening?
PS. Im on Ubuntu.
It looks like nfsd is not running on your host machine (ubuntu does not install by default, mac os does)
install with sudo apt-get install nfs-kernel-server
most probably it will be enough, if not follow the instructions from https://help.ubuntu.com/community/SettingUpNFSHowTo to setup everything.
Second option : if you do not want to setup nfs, you can remove , type: 'nfs' from the Vagrantfile and let vagrant use the default sharing folder mechanism.

Laravel Homestead automatically destroys VM

I followed all the instructions on how to setup laravel homestead.
I am using windows 7 and am trying to install laravel homestead on my system.
I have install virtualbox and vagrant.
Every thing seems to go very well however when i run vagrant up homestead VM boots up but fail at some point.
==> 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/digitlimit/Homestead
default: /home/vagrant/Code => C:/server/www
==> default: Running provisioner: file...
==> default: Running provisioner: shell...
default: Running: inline script
==> default: stdin: is not a tty
==> default: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0/giyiT0RlisfYwMdHfL7lUSxZtO
kEWX5dJwmwwru5dUQda/xknMa9oHKqAlv//V+VvzQ0JKv4eA3xbCgrlj4NAwoZrEjqVC2P0M3HqT2JKF
M76/WCU4Ki7TQnMQz5ff3aRIqFphNC0LZWXz9v92QjJYohODlOAxIhw94PUimnt3BIzOKxT+kqPuBCOc
+oTJTZwduQsCIb+ArmKVDxNMj1LCL65WrSTaO4CmqqVqiTJ3LkzKm4nNluvy26w5usAKhFs8zrPV0+Jh
DXPI6w9crKzs7y/zSspsENgDdNTuh8wRflUrfGgJMq6LbDVf+Kp6lsjvJMadpn2ABXBY9pr5F emailme#yahoo.com
==> default: Running provisioner: shell...
default: Running: inline script
==> default: Running provisioner: shell...
==> default: Forcing shutdown of VM...
==> default: Destroying VM and associated drives...
I have provided the full bash commands and logs here:
http://pastebin.com/hcKpF9kA
Kindly view the log above and advise.
Its working now!
I ended up doing a fresh installation of both vagrant and virtualbox.
I took the following steps:
1.
I uninstalled vagrant and Virtualbox and deleted their folders from my system.
I also deleted the following folders:
C:\Users\mysername\.homestead
C:\Users\username\Homestead - vagrant environment
I deleted all the network adapters install by VM
Open Virtualbox and click File -> Preferences, click Network tab and then Host-only networks. Click on each item and click delete button
I download and install fresh copies of Vagrant and Virtualbox.
Am using Windows 7 (32bit)
https://dl.bintray.com/mitchellh/vagrant/vagrant_1.7.2.msi
http://dlc-cdn.sun.com/virtualbox/4.3.22/VirtualBox-4.3.22-98236-Win.exe
I also download laravel/homestead manually
https://vagrantcloud.com/laravel/boxes/homestead/versions/0.2.2/providers/virtualbox.box
to my downloads folder C:\Downloads\homestead-0-2-2.box
After i have install Virtualbox and Vagrant. I installed laravel/homestead by running the following command in git bash (you can download git bash here: http://git-scm.com/downloads).
vagrant box add laravel/homestead /c/downloads/homestead-0-2-2.box
Then i downloaded vagrant environment so i can run vagrant commands:
Run this command in Git bash. I run this command inside C:\users\yourusername
git clone https://github.com/laravel/homestead.git Homestead
NB: This will create this folder: C:\Users\yourusername\Homestead
With some files.
Still in Git bash, cd into C:\Users\yourusername\Homestead and run this command:
bash init.sh
NB: this will create a folder C:\Users\yourusername\.homestead that contains Homestead.yaml and some other files
Then Generate an SSH key which you will need when you want to login to your VM by running this command:
ssh-keygen -t rsa -C "youremailaddress#youremail.com"
NB: This will ask some question simply hit enter or type yes and hit enter.
This will create your ssh key inside C:\Users\yourusername\.ssh
Then you need to configure homestead by editing.
C:\Users\digitlimit\Homestead\Homestead.yaml
You can right-click Homestead.yaml file then click open then choose to open with wordpad.
My Homestead.yaml looks this after editing:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: /wamp/www
to: /home/vagrant/Code
sites:
- map: laravel.dev
to: /home/vagrant/Code/laravel/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
# blackfire:
# - id: foo
# token: bar
NB: To understand the mapping which is a process of sharing a folder between the host and the VM:
My laravel project is located at C:\wamp\www\laravel
This directory /home/vagrant/Code will be inside the VM after installation.
So what am telling VM is, whenever you see /home/vagrant/Code reference this folder C:\wamp\www\laravel
Also in this:
sites:
- map: laravel.dev
to: /home/vagrant/Code/laravel/public
What we are saying here is when i go to my browser and type http://laravel.dev display the content of /home/vagrant/Code/laravel/public which is actually pointing to C:\www\wamp\laravel\public
After editing Homestead.yaml file save your chnages
NB: Before we can use http://laravel.dev in the host web browser to view our laravel project, we need to add this the following to the hosts file located in
C:\Windows\System32\drivers\etc\hosts
Add this ip address under the list of other ip address listed if any:
192.168.10.10 laravel.dev
Finally, go back to your Git bash, ensure you are in
/c/Users/yourusername/homestead and type:
vagrant up
Wait for vagrant to complete its processes. Click yes when you see any dialog box asking for permission to create network adapter on your system
Well thats all i did. Working for me

vagrant : Failed to mount folders in Linux guest, "vboxsf" file system is not available?

I have VirtualBox 4.3.10 and Vagrant 1.4.3 installed on my Ubuntu 14.04 64 bit Desktop.
Earlier, worked with vagrant technology but this time, multiple issue. Let me describe what I have done
clone private git to local system /opt/lampp/htdocs/{project} : done
root#desktop:/opt/lampp/htdocs/{project}$ vagrant up
gives message on terminal while execution
GuestAdditions versions on your host (4.3.10) and guest (4.2.0) do not match.
command completed with below message
Failed to mount folders in Linux guest. This is usually beacuse the
"vboxsf" file system is not available. Please verify that the guest
additions are properly installed in the guest and can work properly.
The command attempted was:
...
I understand this is version difference.
check vagrant vbguest --status
GuestAdditions 4.3.10 running --- OK.
Open browser and run with http://192.168.0.33 (mentioned on README.md file of private git repo) but it didn't work.
UPDATE
Installed vagrant-vbguest as suggested here
$:sudo vagrant plugin install vagrant-vbguest
Installed the plugin 'vagrant-vbguest (0.10.0)'!
By doing this,message of version difference of GuestAdditions described in 2. is gone
restart vagrant halt and then vagrant up
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] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] -- 80 => 8080 (adapter 1)
[default] Booting VM...
[default] Waiting for machine to boot. This may take a few minutes...
[default] Machine booted and ready!
GuestAdditions 4.3.10 running --- OK.
[default] Configuring and enabling network interfaces...
[default] Mounting shared folders...
[default] -- /vagrant
Failed to mount folders in Linux guest. This is usually beacuse the "vboxsf" file system is not available. Please verify that the guest additions are properly installed in the guest and can work properly. The command attempted was:
mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` /vagrant /vagrant
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` /vagrant /vagrant
Do I need to change anything in local vagrantfile or change vagrant version or something else?
Some say it is a bug whilesome gives solution for ubuntu < 14.04
Kindly suggest the solution hints and how to fix this issue?
vagrant plugin install vagrant-vbguest
worked well for me (Virtual Box 5.0.22, Vagrant 1.8.4). It took muck longer to provision initially because the plugin downloaded gcc and a bunch of other tools before linking the guest additions .iso to the correct place.
Apparently there is a bug in the VirtualBox Guest Additions 4.3.10 installer: https://www.virtualbox.org/ticket/12879
There seems to be a simple workaround to this, by creating a symbolic link within Vagrant-VM:
sudo ln -s /opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions \
/usr/lib/VBoxGuestAdditions
You could add this to your provisioning configuration to make sure you don't hit the bug again:
NEWEST_VBOXGUESTADDITIONS_DIR=`find /opt/ -maxdepth 1 -mindepth 1 -name "VBoxGuestAdditions-*" | tail -n 1`;
if [[ ! -d "/usr/lib/VBoxGuestAdditions" && -n "$NEWEST_VBOXGUESTADDITIONS_DIR" ]];
then
ln -s ${NEWEST_VBOXGUESTADDITIONS_DIR}/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions
fi
This line of code in "Vagrantfile" was the solution for me:
config.vm.synced_folder "./", "/vagrant", id: "vagrant-root", type: "nfs"
In my case, this error was fixed by rebuilding the kernel on the guest machine with
sudo service vboxadd setup.

Categories