Project

General

Profile

Actions

Bug #16111

closed

Smart proxy init script won't start due to CWD

Added by Trey Dockendorf almost 8 years ago. Updated about 7 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
RPMs
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

The CWD of the process that starts the foreman-proxy service is effecting the service's ability to start. If I start foreman-proxy, as root, from /root, the service fails. If I cd to /tmp, the service starts. This is also causing logrotate to crash foreman-proxy when it's restarted. I have 4 systems running smart-proxy and so far only 1 of the 4 has the logrotate issue but all 4 fail to start foreman-proxy unless I cd to /tmp.

Example:

[root@HOST ~]# pwd
/root
[root@HOST ~]# /etc/init.d/foreman-proxy restart
Stopping foreman-proxy: [ OK ]
Starting foreman-proxy: /usr/lib/ruby/gems/1.8/gems/bundler-1.5.2/lib/bundler/shared_helpers.rb:52:in `chdir': Permission denied - /root (Errno::EACCES)
from /usr/lib/ruby/gems/1.8/gems/bundler-1.5.2/lib/bundler/shared_helpers.rb:52:in `chdir'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.5.2/lib/bundler.rb:342:in `load_gemspec_uncached'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.5.2/lib/bundler.rb:332:in `load_gemspec'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.5.2/lib/bundler/dsl.rb:51:in `gemspec'
from /usr/share/foreman-proxy/Gemfile.in:3:in `eval_gemfile'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.5.2/lib/bundler/dsl.rb:9:in `evaluate'
from /usr/lib/ruby/gems/1.8/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb:14:in `parse_from_gemfile'
from /usr/lib/ruby/gems/1.8/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb:35:in `system_require'
from /usr/share/foreman-proxy/lib/bundler_helper.rb:22:in `require_groups'
from /usr/share/foreman-proxy/lib/smart_proxy_main.rb:32
from /usr/share/foreman-proxy/bin/smart-proxy:5:in `require'
from /usr/share/foreman-proxy/bin/smart-proxy:5
[FAILED]
[root@HOST ~]# cd /tmp
[root@HOST tmp]# pwd
/tmp
[root@HOST tmp]# /etc/init.d/foreman-proxy restart
Stopping foreman-proxy: foreman-proxy was not running. [FAILED]
Starting foreman-proxy: [ OK ]

Actions #1

Updated by Dominic Cleal almost 8 years ago

  • Project changed from Foreman to Packaging
  • Category changed from Smart Proxy to RPMs

I'd strongly recommend using the "service" command instead of executing init scripts directly, which is discouraged by most OSes. It will run the init script in a clean environment which should prevent the CWD and other environment leakage into the script.

Actions #2

Updated by Trey Dockendorf almost 8 years ago

Using "service foreman-proxy restart" resolves the main issue. I won't know for a few more days if starting with service resolves the logrotate issue too. Seems like when logrotate runs (weekly by default) that it ends up killing foreman-proxy.

Actions #3

Updated by Dominic Cleal almost 8 years ago

  • Status changed from New to Feedback

If not, then improved log rotation that doesn't restart the entire daemon in Foreman 1.12.0 (#12295) ought to resolve that too. (Plus EL7 uses systemd, which has better isolation.)

Actions #4

Updated by Anonymous about 7 years ago

  • Status changed from Feedback to Resolved
Actions

Also available in: Atom PDF