env: bash: 没有那个文件或目录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/52039080/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 17:00:56  来源:igfitidea点击:

env: bash: No such file or directory

bashnginxpassenger

提问by Rich_F

(Yes I have checked other answers, and this has nothing to do with line endings.)

(是的,我已经检查了其他答案,这与行尾无关。)

I am getting the following subprocess error deploying Passengeron nginx. This is on FreeBSD-11.1:

我在部署Passenger上遇到以下子流程错误nginx。这是在FreeBSD-11.1

env: bash: No such file or directory

Very strange. The nginxprocess starts up as root, then moves to nobody, whose shell I have indeed changed to /usr/local/bin/bash. How either of these users can't see bashis strange. But their reported paths don't include /usr/local/bin:

很奇怪。该nginx过程启动为root,然后移至nobody,我确实已将其更改为/usr/local/bin/bash。这些用户中的任何一个都看不到bash是奇怪的。但他们报告的路径不包括/usr/local/bin

The rootenvironment:

root环境:

uid=0(root) gid=0(wheel) groups=0(wheel),5(operator)

SERVER_SOFTWARE=nginx/1.14.0 Phusion_Passenger/5.3.4
PASSENGER_USE_FEEDBACK_FD=true
PATH=/sbin:/bin:/usr/sbin:/usr/bin
PWD=/
HOME=/
RC_PID=1360

And for nobody:

而对于nobody

uid=65534(nobody) gid=65534(nobody) groups=65534(nobody)

PYTHONUNBUFFERED=1
PASSENGER_SPAWN_WORK_DIR=/tmp/passenger.spawn.lJk10nqveb
RC_PID=1360
PASSENGER_USE_FEEDBACK_FD=true
NODE_PATH=/usr/local/lib/ruby/gems/2.5/gems/passenger/src/nodejs_supportlib
NODE_ENV=production
USER=nobody
PWD=/usr/local/www/pneb
HOME=/nonexistent
PASSENGER_APP_ENV=production
RAILS_ENV=production
SHELL=/usr/local/bin/bash
RACK_ENV=production
SHLVL=0
IN_PASSENGER=1
WSGI_ENV=production
LOGNAME=nobody
PATH=/sbin:/bin:/usr/sbin:/usr/bin
SERVER_SOFTWARE=nginx/1.14.0 Phusion_Passenger/5.3.4

Neither of these users can see bash. I'm not sure which is throwing the error.

这些用户都看不到 bash。我不确定哪个抛出错误。

How can I get past this issue? I expect Passengerworking with nginxto be able to see shells.

我怎样才能解决这个问题?我希望Passenger与之nginx合作能够看到贝壳。

回答by Rich_F

Solved, thanks to Charles Duffy in chat:

已解决,感谢 Charles Duffy 在聊天中:

Add the following to the nginxlauncher at /usr/local/etc/rc.d/nginx:

将以下内容添加到nginx启动器/usr/local/etc/rc.d/nginx

PATH=$PATH:/usr/local/bin

This gives nginx a PATHto see bash.

这让 nginxPATH可以看到bash