Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1962757 - /usr/share/foreman is not writable for satellite-installer
Summary: /usr/share/foreman is not writable for satellite-installer
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Installation
Version: 6.10.0
Hardware: All
OS: All
unspecified
medium
Target Milestone: 6.10.0
Assignee: Ewoud Kohl van Wijngaarden
QA Contact: Devendra Singh
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-05-20 15:11 UTC by Gaurav Talreja
Modified: 2022-07-19 15:14 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-16 14:11:01 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 33013 0 Normal New bundler warns /usr/share/foreman is not writable 2021-07-14 09:17:28 UTC
Red Hat Product Errata RHSA-2021:4702 0 None None None 2021-11-16 14:11:08 UTC

Description Gaurav Talreja 2021-05-20 15:11:33 UTC
Description of problem:
/usr/share/foreman is not writable for satellite-installer, so it chooses some /tmp/directory for bundler

Version-Release number of selected component (if applicable):
Satellite 6.10.0 Snap 1.0

How reproducible:
Always

Steps to Reproduce:
1. # satellite-installer
2021-05-20 09:10:32 [WARN  ] [boot] Unsetting environment variable 'HTTP_PROXY' for the duration of the install.
2021-05-20 09:10:32 [NOTICE] [root] Loading installer configuration. This will take some time.
...
<snip>
Executing: foreman-rake upgrade:run
`/usr/share/foreman` is not writable.
Bundler will use `/tmp/bundler20210520-43729-pzug1w43729' as your home directory temporarily.
'ErbParser' is ignored.
'RubyParser' is ignored.
=============================================
Upgrade Step 1/2: katello:correct_repositories. This may take a long while.
=============================================
Upgrade Step 2/2: katello:clean_backend_objects. This may take a long while.
Failed upgrade task: katello:clean_backend_objects, see logs for more information.
</snip>

2. # echo $?
   0

Actual results:
satellite-installer runs successfully, /usr/share/foreman is not writable, so it chooses some /tmp/directory for bundler.

Expected results:
satellite-installer should run successfully, with no such stdout.

Additional info:

Comment 1 Ewoud Kohl van Wijngaarden 2021-05-21 12:41:11 UTC
This isn't really the installer. The root cause is related to CVE-2019-3881 (https://bugzilla.redhat.com/show_bug.cgi?id=1651826). In https://github.com/rubygems/bundler/commit/02e7f67727b45 it was changed to use a randomized directory if the home directory is not writable.

For the foreman user the home directory /usr/share/foreman is not writable (for security reasons). foreman-rake is executed as the foreman user and the installer runs foreman-rake. For completeness, this also affects the foreman-proxy which can't write to /usr/share/foreman-proxy. This can be seen in the foreman-proxy service startup (journalctl -u foreman-proxy).

A possible workaround is to create /var/lib/foreman{,-proxy}/.bundle and create a /usr/share/foreman{,proxy}/.bundle symlink. This would allow the Foreman (Proxy) user to write there. However, to code appears to really be checking the HOME, so it may not even work. In theory you can export a different HOME but other code may suddenly start to break if you do so. Some scripts may assume $HOME has the entire Rails code.

Comment 2 Eric Helms 2021-06-02 20:02:12 UTC
Since this output is more of an implementation detail, could we hide it when executing foreman-rake ?

Comment 3 Ewoud Kohl van Wijngaarden 2021-07-14 09:17:20 UTC
Created redmine issue https://projects.theforeman.org/issues/33013 from this bug

Comment 4 Ewoud Kohl van Wijngaarden 2021-07-14 09:20:49 UTC
Bundler does appear to have Bundler.ui which can be set to Bundler::UI::Silent. However, I'm not really sure where we would set this.

https://github.com/theforeman/foreman/blob/develop/script/foreman-rake is the source for foreman-rake (on EL7 RAKE_CMD is changed to /usr/bin/tfm-rake). It's a shell script that ends up calling plain rake.

I suspect that adding some code to Rakefile doesn't work either because at that point it already has loaded the bundler environment.

I've submitted https://github.com/theforeman/foreman/pull/8663 which may work but right now I don't have a test environment so I'll spin one up.

Comment 5 Bryan Kearney 2021-07-14 12:07:01 UTC
Upstream bug assigned to ekohlvan

Comment 6 Bryan Kearney 2021-07-14 12:07:05 UTC
Upstream bug assigned to ekohlvan

Comment 7 Bryan Kearney 2021-07-19 16:06:38 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/33013 has been resolved.

Comment 8 Devendra Singh 2021-08-20 17:17:34 UTC
Verified on 6.10 snap14

# satellite-installer
2021-08-20 13:09:47 [NOTICE] [root] Loading installer configuration. This will take some time.
2021-08-20 13:09:54 [NOTICE] [root] Running installer with log based terminal output at level NOTICE.
2021-08-20 13:09:54 [NOTICE] [root] Use -l to set the terminal output log level to ERROR, WARN, NOTICE, INFO, or DEBUG. See --full-help for definitions.
Package versions are locked. Continuing with unlock.

........................
........................
2021-08-20 13:12:23 [NOTICE] [configure] 3000 configuration steps out of 3029 steps complete.
2021-08-20 13:12:31 [NOTICE] [configure] System configuration has finished.
Executing: foreman-rake upgrade:run
'ErbParser' is ignored.
'RubyParser' is ignored.
=============================================
Upgrade Step 1/2: katello:correct_repositories. This may take a long while.
Processing Repository 1/140: Red Hat Enterprise Linux 6 Server RPMs x86_64 6Server (2)
Processing Repository 2/140: Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server (4)
...............
...............
Processing Repository 140/140: tools6_latest_repo_rhel6 (901)
=============================================
Upgrade Step 2/2: katello:clean_backend_objects. This may take a long while.
0 orphaned consumer id(s) found in candlepin.
Candlepin orphaned consumers: []
  Success!

Comment 11 errata-xmlrpc 2021-11-16 14:11:01 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: Satellite 6.10 Release), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2021:4702


Note You need to log in before you can comment on or make changes to this bug.