Ask Your Question

Exec of ENC script always returns 127

asked 2013-09-19 15:16:06 -0600

Ben McClure gravatar image

updated 2013-09-20 14:52:47 -0600

All of my servers are failing when running the puppet agent, the puppetmaster returns an error that the ENC script (the node.rb script for Foreman) is returning exit code 127. When I run the exact same command on the puppetmaster directly, even as the puppet user, it returns valid YAML for the node and exit code 0.

I'm not entirely certain what exit code 127 is, as the script itself is configured to return exit code 1 on failure it appears. Puppet has a colon after the error code like it is expecting to display more details but ... (more)

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2013-09-19 15:40:10 -0600

GregLarkin gravatar image

Exit code 127 indicates that the shell that executes your ENC script cannot locate an executable in the PATH variable. Have your environment variables changed since working on the other issue that you mentioned?

Since the script succeeds even when running it as the puppet user (assuming you are using su - puppet <rest of command>), can you post any relevant log output in case there is a clue contained within?

edit flag offensive delete link more


Actually, I was running it with "sudo -u puppet /etc/puppet/node.rb <node-name>" but that must not have been sufficient. I just ran 'su - puppet /etc/puppet/node.rb ...(more)

Ben McClure gravatar imageBen McClure ( 2013-09-19 15:49:32 -0600 )edit

In /var/log/syslog (trimmed for brevity): puppet-master: Executing '/etc/puppet/node.rb <hostname>' puppet-master: Failed when searching for node <hostname>: Failed to find <hostname> via exec: Execution of '/etc ...(more)

Ben McClure gravatar imageBen McClure ( 2013-09-19 15:52:48 -0600 )edit

I did replace /etc/environment with a custom version, however I am comparing the contents and literally the only different is the absence of /usr/games from $PATH. But I ...(more)

Ben McClure gravatar imageBen McClure ( 2013-09-19 16:01:54 -0600 )edit

The contents of syslog are a concern - it looks like the script is invoked with the literal token "<hostname>" instead of an actual hostname like "". Would you ...(more)

GregLarkin gravatar imageGregLarkin ( 2013-09-19 17:28:11 -0600 )edit

<hostname> was just a token I used to replace the hostname for the purposes of posting that comment, sorry for not clarifying that. It is using the real hostname in ...(more)

Ben McClure gravatar imageBen McClure ( 2013-09-20 09:10:20 -0600 )edit

answered 2013-10-01 10:18:12 -0600

Ben McClure gravatar image

updated 2013-10-01 10:18:57 -0600

I finally solved this by using 'env' at the top of my nginx configuration file to manually set PATH and locale-related environment variables. These passed through to Puppetmaster via Passenger and made things work again.

I still don't know why it suddenly stopped working and required me to manually set these vars, but nonetheless, if you're in the same position I was, that was the solution that worked.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2013-09-19 15:16:06 -0600

Seen: 1,102 times

Last updated: Oct 01 '13