Laravel Homestead: Provisioning failing on Windows 8 - windows

I'm trying to use Laravel Homestead for a Laravel 4.2.9 project. Here's what I'm running:
Windows 8.1 64-bit
VirtualBox 4.3.17
Vagrant 1.6.5
Latest Homestead version
When running the box with vagrant up for the first time or issuing the vagrant provision command, I get this:
==> default: Running provisioner: shell...
default: Running: inline script
==> default: /tmp/vagrant-shell: line 1: /home/vagrant/.ssh/$2: ambiguous redirect
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.
Contents of /tmp/vagrant-shell on the box:
echo "$1" > /home/vagrant/.ssh/$2 && chmod 600 /home/vagrant/.ssh/$2
This seems to be affecting nginx configuration as there is no default server conf and it's not listening on port 80 as expected. Presumably the provisioning script would handle that if it was able to proceed.
What might be causing this to happen?

I had the same problem and changed file homestead.rb in "scripts" directory by adding additional quotation marks and backslash around "$2".
s.inline = "echo \"$1\" > /home/vagrant/.ssh/\"$2\" && chmod 600 /home/vagrant/.ssh/\"$2\""

Related

Issues w vagrant ssh: terminating, 1 bad configuration options

first off I'm very new to programming and web development. I'm currently working through a Udacity course on SQL.
I'm trying to install VM and Vagrant and have run into this issue. Vagrant installed fine, and I'm able to run vagrant up, but when I run vagrant ssh I'm getting this message:
.ssh/config: terminating, 1 bad configuration options
I'll attach a screen here.
I'm on a Mac. Big Sur 11.5.2
Vagrant version 2.2.18
Any help provided would be greatly appreciated! Thanks in advance![enter image description here][1]
bash-3.2$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'bento/ubuntu-16.04-i386' version '2.3.5' 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.
bash-3.2$ vagrant ssh
/Users/scott27/.ssh/config: terminating, 1 bad configuration options
bash-3.2$
Consider moving your config file to a backup and trying again.
mv /Users/scott27/.ssh/config /Users/scott27/.ssh/config.bak
Then try vagrant up again and if it works then the issue is in your config file, troubleshoot that separately.
Instead of moving the existing ssh config file it is better to instead let vagrant point to its own config file using the config.ssh.config in vagrantfile
I am on Windows but I assume it is similar on mac. I updated my Vagrantfile like so:
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.ssh.config = File.expand_path(File.dirname(__FILE__) + '/ssh_config')
As you can see I point to a ssh_config file that I created, since an empty string resulted in an error.

Running vagrant up in Homestead

I'm trying to get Laravel Homestead set up on my mac. I am at the part where I run vagrant up and this is the error message I am receiving:
==> homestead-7: Failed to restart php7.0-fpm.service: Unit php7.0-fpm.service not found.
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what went wrong.
Anyone have any ideas?
Share on your folders files with "7.1" and change it to "5.0"

Vagrant - Inline scripts on Windows throw '/bin/sh: sudo: command not found' error

I'm running Vagrant on mac OS, setting up a Windows 7 VM. This is the provision script I am using at the moment:
config.vm.provision "shell", inline: "C:/Users/IEUser/Downloads/launch.bat"
Every time I do this, or in fact any other inline command, it will cause the following to happen:
default: Running provisioner: shell...
default: Running: inline script
==> default: /bin/sh: sudo: command not found
This will happen no matter what inline script I use. Basically what I am trying to do is start a .bat file on the Virtual Machine when I do vagrant up or vagrant provision, but nothing I have tried is working.
When you use inline option, vagrant will expect the content of the script itself.
If you reference an existing script you want to use path option
Path to a shell script to upload and execute. It can be a script relative to the project Vagrantfile or a remote script
Note that it must be relative to the project Vagrantfile, so from your host, not relative in the VM
Lets say you have the launch.bat file in a script directory within your host project folder, you will have
config.vm.provision "shell", path: "script/launch.bat"

Vagrant halt is failing with _syntax error near unexpected token `||'_

Vagrant is not able to halt / reload after the initial vagrant up (ie the one where the vm is provisioned). The initial vagrant up completes correctly, however after that I am not able to do the vagrant halt or reload.
The error message that I am getting is
==> default: Attempting graceful shutdown of VM...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
shutdown -h now
Stdout from the command:
Stderr from the command:
stdin: is not a tty
bash: line 2: syntax error near unexpected token `||'
bash: line 2: `export SSH_AUTH_SOCK= || ||'
List of vagrant plugin I am using
- vagrant-proxyconf (1.5.2)
- vagrant-share (1.1.5, system)
Vagrant version is 1.8.1
Virtualbox [provider] version 4.3.34r104062
Host OS : Windows 7 Enterprise
I have tried re-installing, all the components, destroying the VMs, deleting the config files [ie ~/.VirtualBox & ~/.vagrant.d]
Please help me in resolving the issue
This is not the fix.
The error went away when I again downloaded the code base from github.

vagrant ssh responded with with a non-zero

I am using vagrant on windows 8.1 and when I am doing vagrant up I am getting this error
The error message states that it failed trying execute this command:
chown `id -u vagrant`:`id -g vagrant` /vagrant
So I accessed the host machine by ssh: and I tried to execute the same command and I get error
Here is some commands I tried to execute in /vagrant directory, I don't know if that will help.
Here is my vagrantFile that I am using.
Please any idea what I am doing wrong ?
/vagrant probably doesn't exist
Check for /home/projects
This line in your Vagrantfile sets that directory. ./projects is on the host, /home/projects is on the guest.
config.vm.synced_folder "./projects", "/home/projects", nfs: true

Resources