Skip to content
This repository has been archived by the owner on Feb 18, 2021. It is now read-only.

Unable to find the file '/provision/main/etc/hosts.json' #5

Closed
benlipp opened this issue Mar 4, 2015 · 21 comments
Closed

Unable to find the file '/provision/main/etc/hosts.json' #5

benlipp opened this issue Mar 4, 2015 · 21 comments

Comments

@benlipp
Copy link

benlipp commented Mar 4, 2015

I saw this project on Reddit, so I thought I'd check it out. However, I'm missing the file '/provision/main/etc/hosts.json', so I have to edit the host files on both machines myself. There's nothing in the wiki, so I can't look up any documentation on the matter. Can you include the file in the repo?

@johnRivs
Copy link

johnRivs commented Mar 4, 2015

Same thing here:

==> default: Running provisioner: hostsupdate...
==> default: Updating hosts file on the guest machine...
==> default: Unable to find the file '/provision/main/etc/hosts.json'
==> default: Updating hosts file on the host machine (password may be required)...
==> default: Unable to find the file '/provision/main/etc/hosts.json'

@mohatt
Copy link
Owner

mohatt commented Mar 4, 2015

Could you please post the full console output so that I can figure out what causes the issue

@benlipp
Copy link
Author

benlipp commented Mar 4, 2015

The issue is caused by there being no '/provision/main/etc/hosts.json'.
It's just not there. Did you forget to include it in the repo?

On Wednesday, March 4, 2015, Mohamed Kholy notifications@github.com wrote:

Could you please post the full console output so that I can figure out
what causes the issue


Reply to this email directly or view it on GitHub
#5 (comment).

Thanks!
Ben Lippincott

@mohatt
Copy link
Owner

mohatt commented Mar 4, 2015

The file '/provision/main/etc/hosts.json' is not included with the repository, instead it is automatically generated during the provisioning process.
If you're running OS X, please upgrade your working copy because there was an issue with file permissions and I just fixed it.

@benlipp
Copy link
Author

benlipp commented Mar 4, 2015

Thanks very much! It's fixed.

@benlipp benlipp closed this as completed Mar 4, 2015
@johnRivs
Copy link

johnRivs commented Mar 4, 2015

Windows 7. Vagrant 1.7.2. VirtualBox 4.3.18.
Git pulled the latest changes.
File not found. No errors prior to my output.

@mohatt
Copy link
Owner

mohatt commented Mar 4, 2015

Could you please post the full console output? it will help me better identify your issue.

@johnRivs
Copy link

johnRivs commented Mar 4, 2015

==> default: Attempting graceful shutdown of VM...
==> default: Checking if box 'mdkholy/dashbrew' 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: 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: /var/www => C:/Users/John/dashbrew/public
    default: /vagrant => C:/Users/John/dashbrew
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: to force provisioning. Provisioners marked to run always will still run.
==> default: Running provisioner: shell...
    default: Running: X:/Users/John/AppData/Local/Temp/vagrant-shell20150304-5364-11sci6.sh
==> default: stdin: is not a tty
==> default: /tmp/vagrant-shell: /vagrant/provision/main/dashbrew: /usr/bin/php^M: bad interpreter: No such file or directory
==> default: Running provisioner: hostsupdate...
==> default: Updating hosts file on the guest machine...
==> default: Unable to find the file '/provision/main/etc/hosts.json'
==> default: Updating hosts file on the host machine (password may be required)...
==> default: Unable to find the file '/provision/main/etc/hosts.json'

@mohatt
Copy link
Owner

mohatt commented Mar 4, 2015

The problem is in this line:

==> default: /tmp/vagrant-shell: /vagrant/provision/main/dashbrew: /usr/bin/php^M: bad interpreter: No such file or directory

This is caused by an issue in your Git line ending configuration, it converts the line ending of the file provision/main/dashbrew from LF to CLRF which prevents the linux VM from properly reading the file.

Please check the value of this core.autocrlf Git config and make sure it is set to false.
git config --get core.autocrlf

@johnRivs
Copy link

johnRivs commented Mar 4, 2015

It's set to false. Same issue.

@johnRivs
Copy link

johnRivs commented Mar 4, 2015

Did git convert the line endings when I cloned the repo? Should I re-clone now that I changed the value?

@mohatt
Copy link
Owner

mohatt commented Mar 4, 2015

I have just added a .gitattributes file that tells Git how to deal with line endings. Please try re-cloning the repository and let me know.

@johnRivs
Copy link

johnRivs commented Mar 4, 2015

Worked perfectly! Thanks very much.

@johnRivs
Copy link

johnRivs commented Mar 4, 2015

Actually, something else happened. It ran OK and I managed to go to http://dashbrew.dev/ but it was accesible for 5 seconds. Using the sample environment config I get this output when vagrant up. Also, used vagrant provision:

==> default: Attempting graceful shutdown of VM...
==> default: Checking if box 'mdkholy/dashbrew' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Fixed port collision for 22 => 2222. Now on port 2200.
==> 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: 22 => 2200 (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:2200
    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: /var/www => C:/Users/John/dashbrew/public
    default: /vagrant => C:/Users/John/dashbrew
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: to force provisioning. Provisioners marked to run always will still run.
==> default: Running provisioner: shell...
    default: Running: X:/Users/John/AppData/Local/Temp/vagrant-shell20150304-5560-1wznvlo.sh
==> default: stdin: is not a tty
==> default: [Info] Initializing environment.yaml
==> default: [Info] Checking system packages
==> default: [Info] Checking apache modules
==> default: [Info] Checking nodejs modules
==> default: [Info] Checking php 5.6.0
==> default: [Info] Building php from source
==> default: [Info] This may take a while depending on your cpu(s)...
==> default: /vagrant/provision/main/scripts/phpbrew/php.install.sh: line 2: $'\r': command not found
==> default: /vagrant/provision/main/scripts/phpbrew/php.install.sh: line 4: $'\r': command not found
: No such file or directorysion/main/scripts/phpbrew/php.install.sh: line 5: /vagrant/provision/main/scripts/phpbrew
==> default: /vagrant/provision/main/scripts/phpbrew/php.install.sh: line 6: $'\r': command not found
==> default: /vagrant/provision/main/scripts/phpbrew/php.install.sh: line 11: $'\r': command not found
==> default: PHP Warning:  file_put_contents(/root/.phpbrew/php-releases.json): failed to open stream: Permission denied in phar:///usr/bin/phpbrew/PhpBrew/ReleaseList.php on line 2
==> default: PHP Stack trace:
==> default: PHP   1. {main}() /usr/bin/phpbrew:0
==> default: PHP   2. require() /usr/bin/phpbrew:6
==> default: PHP   3. CLIFramework\Application->runWithTry() phar:///usr/bin/phpbrew/scripts/phpbrew-emb.php:2
==> default: PHP   4. CLIFramework\Application->run() phar:///usr/bin/phpbrew/CLIFramework/Application.php:2
==> default: PHP   5. CLIFramework\CommandBase->executeWrapper() phar:///usr/bin/phpbrew/CLIFramework/Application.php:2
==> default: PHP   6. call_user_func_array:{phar:///usr/bin/phpbrew/CLIFramework/CommandBase.php:2}() phar:///usr/bin/phpbrew/CLIFramework/CommandBase.php:2
==> default: PHP   7. PhpBrew\Command\InstallCommand->execute() phar:///usr/bin/phpbrew/CLIFramework/CommandBase.php:2
==> default: PHP   8. PhpBrew\ReleaseList::getReadyInstance() phar:///usr/bin/phpbrew/PhpBrew/Command/InstallCommand.php:2
==> default: PHP   9. PhpBrew\ReleaseList->fetchRemoteReleaseList() phar:///usr/bin/phpbrew/PhpBrew/ReleaseList.php:2
==> default: PHP  10. file_put_contents() phar:///usr/bin/phpbrew/PhpBrew/ReleaseList.php:2
==> default: [Error] Unable to build php
==> default: [Info] Finished in 4.35s
==> default: Running provisioner: hostsupdate...
==> default: Updating hosts file on the guest machine...
==> default: Updating hosts file on the host machine (password may be required)...

@mohatt
Copy link
Owner

mohatt commented Mar 4, 2015

Ok, try destroying your vagrant machine by running vagrant destroy, re-clone the repository into a clean directory and post the output of the first vagrant up

@johnRivs
Copy link

johnRivs commented Mar 4, 2015

Basically, the same thing. It's not even picking up the env config:

==> default: Checking if box 'mdkholy/dashbrew' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Fixed port collision for 22 => 2222. Now on port 2200.
==> 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: 22 => 2200 (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:2200
    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: /var/www => C:/Users/John/Dropbox/Web/wamp/www/dashbrew/public
    default: /vagrant => C:/Users/John/Dropbox/Web/wamp/www/dashbrew
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: to force provisioning. Provisioners marked to run always will still run.
==> default: Running provisioner: shell...
    default: Running: X:/Users/John/AppData/Local/Temp/vagrant-shell20150304-4988-k2gvtx.sh
==> default: stdin: is not a tty
==> default: /tmp/vagrant-shell: /vagrant/provision/main/dashbrew: /usr/bin/php^M: bad interpreter: No such file or directory
==> default: Running provisioner: hostsupdate...
==> default: Updating hosts file on the guest machine...
==> default: Unable to find the file '/provision/main/etc/hosts.json'
==> default: Updating hosts file on the host machine (password may be required)...
==> default: Unable to find the file '/provision/main/etc/hosts.json'

@johnRivs
Copy link

johnRivs commented Mar 4, 2015

Here's some more. I went to my hosts file and removed what I had from before. Ran vagrant up and got this:

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'mdkholy/dashbrew' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Fixed port collision for 22 => 2222. Now on port 2200.
==> 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: 22 => 2200 (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:2200
    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: /var/www => C:/Users/John/dashbrew/public
    default: /vagrant => C:/Users/John/dashbrew
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: to force provisioning. Provisioners marked to run always will still run.
==> default: Running provisioner: shell...
    default: Running: X:/Users/John/AppData/Local/Temp/vagrant-shell20150304-3976-j25a2f.sh
==> default: stdin: is not a tty
==> default: /tmp/vagrant-shell: /vagrant/provision/main/dashbrew: /usr/bin/php^M: bad interpreter: No such file or directory
==> default: Running provisioner: hostsupdate...
==> default: Updating hosts file on the guest machine...
==> default: Unable to find the file '/provision/main/etc/hosts.json'
==> default: Updating hosts file on the host machine (password may be required)...
==> default: Unable to find the file '/provision/main/etc/hosts.json'
==> default: 'X:\Windows\System32\drivers\etc\hosts' file updated successfully

This is how the hosts file looks:

# 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

## vagrant-hosts-provisioner-start id: be8f7921-3d0b-45cc-b595-ea1eb7ca2277-0

## vagrant-hosts-provisioner-end


After vagrant reload:

==> default: Attempting graceful shutdown of VM...
==> default: Checking if box 'mdkholy/dashbrew' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Fixed port collision for 22 => 2222. Now on port 2200.
==> 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: 22 => 2200 (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:2200
    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: /var/www => C:/Users/John/dashbrew/public
    default: /vagrant => C:/Users/John/dashbrew
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: to force provisioning. Provisioners marked to run always will still run.
==> default: Running provisioner: shell...
    default: Running: X:/Users/John/AppData/Local/Temp/vagrant-shell20150304-3352-1144u52.sh
==> default: stdin: is not a tty
==> default: /tmp/vagrant-shell: /vagrant/provision/main/dashbrew: /usr/bin/php^M: bad interpreter: No such file or directory
==> default: Running provisioner: hostsupdate...
==> default: Updating hosts file on the guest machine...
==> default: Unable to find the file '/provision/main/etc/hosts.json'
==> default: Updating hosts file on the host machine (password may be required)...
==> default: Unable to find the file '/provision/main/etc/hosts.json'

@johnRivs
Copy link

johnRivs commented Mar 5, 2015

Don't know if this is relevant but, did vagrant ssh, then moved to /vagrant/provision/main/dashbew and used php dashbrew provision, got:

[Error] Failed to touch "/etc/dashbrew/initialsetup.lock".
[Info] Finished in 0.03s

@johnRivs
Copy link

johnRivs commented Mar 5, 2015

More madness. Used sed to get rid of dos style line endings on /vagrant/provision/main/dashbew and the phpbrew script files. sed -i 's/\r//' file. Using sample environment config. First vagrant up after that, failed to load hosts files. vagrant reload and all is green now, it works.

Definitely problems with line endings :(

@mohatt
Copy link
Owner

mohatt commented Mar 6, 2015

I am not sure why all of this is happening. .gitattributes file should prevent Git from messing up with line endings.
Also check #10

@mohatt mohatt mentioned this issue Mar 6, 2015
@chillyistkult
Copy link

Kill the dos line endings with sed -i 's/\r//' /vagrant/provision/main/dashbew works for all you guys struggling on windows 7.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants