我有一个简单的流浪箱,这是我在学习教程时构建的。我在这个盒子上建立了我的流浪汉文件。
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise32"
config.vm.box_url = "http://files.vagrantup.com/precise32.box"
config.vm.provision :shell, :path => "bootstrap.sh"
#config.vm.network "forwarded_port", guest: 80, host: 8080
end这似乎工作得很好,正在等待其他一些配置,但我在配置时遇到的问题是。
它发现Shell脚本运行良好,没有任何错误。它甚至建立了流浪汉的盒子。但是,当它完成时,我会得到这个错误
==> default: stdin: is not a tty
==> default: bash: /tmp/vagrant-shell: /user/bin/env: bad interpreter: No such file or directory
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
chmod +x /tmp/vagrant-shell && /tmp/vagrant-shell
Stdout from the command:
Stderr from the command:
stdin: is not a tty
bash: /tmp/vagrant-shell: /user/bin/env: bad interpreter: No such file or directory当我ssh中没有安装任何东西时,将安装要安装的安装程序。当我通过命令在终端命令中运行bash脚本时,它可以工作。这是我的bash脚本。
#!/user/bin/env bash
#install
sudo apt-get update
sudo apt-get install -y python-software-properties
sudo add-apt-repository -y ppa:ondrej/php5
sudo apt-get update
sudo apt-get install -y wget php5 apache2 php5-mcrypt php5-curl git
sudo apt-get update
#apache onfig
sudo a2enmod rewrite
#Symlink for local development
#remove the WWW for Apache
sudo rm -rf /var/www
#symlink for local directory ln -fs {PATH TO LOCAL PROJECT} /var/www
sudo ln -fs /pathtolocaldirectory /var/www
#Restart Apache
sudo service apache2 restart发布于 2014-07-16 14:29:38
实际上,错误信息非常清楚:/user/bin/env不存在。
只需将bash脚本中的第一行替换为:
#!/usr/bin/env bash发布于 2014-07-16 14:48:44
您的/tmp目录或脚本本身缺少权限,这可能是此执行问题的根本原因。
要解决此问题,请尝试
chmod 755 /tmp/
chmod +x /tmp/vagrant-shell然后尝试执行该命令,它将安全地工作。
https://stackoverflow.com/questions/24771595
复制相似问题