Ask Your Question

`/usr/bin/env: ruby: No such file or directory` in `tomcat::setenv::entry`

asked 2015-11-30 01:29:22 -0600

Yasser Zamani gravatar image

updated 2015-11-30 12:24:51 -0600

I have following puppet code in a manifest:

    tomcat::setenv::entry {'JAVA_OPTS':
  value => "-Xms128m -Xmx12048m -XX:MaxPermSize=2024m",

but running

sudo puppet agent --test

at puppet agent, causes following error:

Error: /Stage[main]/Main/Node[software]/Tomcat::Setenv::Entry[JAVAOPTS] /Concat[/usr/share/tomcat7029/bin/]/ Exec[concat/usr/share/tomcat7029/bin/]: Could not evaluate: /usr/bin/env: ruby: No such file or directory

At puppet agent I've installed ruby from source, not rvm, and following command says me:

software:~/ # /usr/bin/env ruby --version
ruby 2.1.7p400 (2015-08-18 revision 51632) [x86_64-linux]
software:~/ # pwd
software:~/ #

At puppet master, Ruby has been installed with puppetserver package, and above command says same things.

How to figure this out, please?

[Edit 1]

After running:

sudo puppet agent --test --debug

these are interesting output which may help:

Debug: Exec concat/usr/share/tomcat7029/bin/ Executing check '/opt/puppetlabs/puppet/cache/concat/bin/concatfragments.rb -o "/opt/puppetlabs/puppet/cache/concat/" -d "/opt/puppetlabs/puppet/cache/concat/" -l -t'

Debug: Executing: '/opt/puppetlabs/puppet/cache/concat/bin/concatfragments.rb -o "/opt/puppetlabs/puppet/cache/concat/" -d "/opt/puppetlabs/puppet/cache/concat/" -l -t'

[mNotice: /Stage[main]/Main/Node[software]/Tomcat::Setenv::Entry[JAVAOPTS]/Concat[/usr/share/tomcat7029/bin/]/File[/usr/share/tomcat7029/bin/]: Dependency Exec[concat/usr/share/tomcat70_29/bin/] has failures: true

File fragments.concat.out and directory both exist and that directory has a sub-directory named fragments which contains a file named 10_setenv-JAVA_OPTS. All things appear OK! but I also tried the above execute command (/opt/puppetlabs/puppet/cache/concat/bin/concatfragments.rb ...) in command line manually and same output appeared, /usr/bin/env: ruby: No such file or directory.

edit retag flag offensive close merge delete


Are you able to run the script successfully by hand on the Puppet agent machine? Is the ruby package installed on the Puppet agent machine prior to the invocation of the script by Puppet?

GregLarkin gravatar imageGregLarkin ( 2015-11-30 11:21:27 -0600 )edit

@GregLarkin,On Puppet agent machine, still there is no any `` file because tomcat does not have this file in it's bin folder by default and I expect Puppet to create one.and yes,the ruby package is installed.I installed it by compiling from source before puppet installation which was needed

Yasser Zamani gravatar imageYasser Zamani ( 2015-11-30 12:33:01 -0600 )edit

@GregLarkin, I updated the question with output of debug messages. It seems that it does not have any problem with ruby installation itself, but `concatfragments.rb` expect some file or directory which does not exist.

Yasser Zamani gravatar imageYasser Zamani ( 2015-11-30 12:41:49 -0600 )edit

@GregLarkin, I resolved it as below. Thank you for your attention and sorry for inconvenience.

Yasser Zamani gravatar imageYasser Zamani ( 2015-12-01 11:29:21 -0600 )edit

Hey, no problem and glad you figured it out!

GregLarkin gravatar imageGregLarkin ( 2015-12-01 16:04:47 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2015-12-01 11:25:13 -0600

Yasser Zamani gravatar image

I'm genius! The problem was with sudo which resets $PATH environment variable to minimum and so, does not know ruby any more. To avoid this, I edited /etc/sudoers with following command:

sduo visudo


sudo vi /etc/sudoers

then edited following line as:

Defaults env_keep += "PATH ...

Actually I added PATH to env_keep which means sudo should keep this variable unchanged ;)

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: 2015-11-30 01:29:22 -0600

Seen: 1,007 times

Last updated: Dec 01 '15