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 2048547 - When using async_ssh true and for some reason the script retrieve.sh fails to, the task remain stuck
Summary: When using async_ssh true and for some reason the script retrieve.sh fails to...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Remote Execution
Version: 6.10.1
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: 6.12.0
Assignee: Adam Ruzicka
QA Contact: Peter Ondrejka
URL:
Whiteboard:
Depends On: 2124850 2128209
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-01-31 13:45 UTC by Joniel Pasqualetto
Modified: 2022-11-16 13:33 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-11-16 13:33:25 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 34363 0 Normal Ready For Testing Improve ssh error reporting 2022-02-03 12:05:03 UTC
Red Hat Issue Tracker SAT-12778 0 None None None 2022-09-07 09:49:10 UTC
Red Hat Product Errata RHSA-2022:8506 0 None None None 2022-11-16 13:33:44 UTC

Description Joniel Pasqualetto 2022-01-31 13:45:01 UTC
Description of problem:

- Have option async_ssh set to true
- Have /var/tmp mounted with option noexec on clients
- Try to run any remote execution job will result in the job stuck on "running" forever. 
- Looking at the target server logs, we can see repeatedly connections calling the retrieve.sh:

~~~
Jan 31 08:09:50 nodename sudo:     rex : TTY=unknown ; PWD=/home/rex ; USER=root ; COMMAND=/var/tmp/foreman-ssh-cmd-c5227fef-dd73-4ee9-b6cf-6be9226e0191/retrieve.sh
Jan 31 08:10:50 nodename sudo:     rex : TTY=unknown ; PWD=/home/rex ; USER=root ; COMMAND=/var/tmp/foreman-ssh-cmd-c5227fef-dd73-4ee9-b6cf-6be9226e0191/retrieve.sh
Jan 31 08:11:51 nodename sudo:     rex : TTY=unknown ; PWD=/home/rex ; USER=root ; COMMAND=/var/tmp/foreman-ssh-cmd-c5227fef-dd73-4ee9-b6cf-6be9226e0191/retrieve.sh
Jan 31 08:12:51 nodename sudo:     rex : TTY=unknown ; PWD=/home/rex ; USER=root ; COMMAND=/var/tmp/foreman-ssh-cmd-c5227fef-dd73-4ee9-b6cf-6be9226e0191/retrieve.sh
Jan 31 08:13:52 nodename sudo:     rex : TTY=unknown ; PWD=/home/rex ; USER=root ; COMMAND=/var/tmp/foreman-ssh-cmd-c5227fef-dd73-4ee9-b6cf-6be9226e0191/retrieve.sh
Jan 31 08:14:52 nodename sudo:     rex : TTY=unknown ; PWD=/home/rex ; USER=root ; COMMAND=/var/tmp/foreman-ssh-cmd-c5227fef-dd73-4ee9-b6cf-6be9226e0191/retrieve.sh
Jan 31 08:15:52 nodename sudo:     rex : TTY=unknown ; PWD=/home/rex ; USER=root ; COMMAND=/var/tmp/foreman-ssh-cmd-c5227fef-dd73-4ee9-b6cf-6be9226e0191/retrieve.sh
Jan 31 08:16:53 nodename sudo:     rex : TTY=unknown ; PWD=/home/rex ; USER=root ; COMMAND=/var/tmp/foreman-ssh-cmd-c5227fef-dd73-4ee9-b6cf-6be9226e0191/retrieve.sh
Jan 31 08:17:53 nodename sudo:     rex : TTY=unknown ; PWD=/home/rex ; USER=root ; COMMAND=/var/tmp/foreman-ssh-cmd-c5227fef-dd73-4ee9-b6cf-6be9226e0191/retrieve.sh
Jan 31 08:18:54 nodename sudo:     rex : TTY=unknown ; PWD=/home/rex ; USER=root ; COMMAND=/var/tmp/foreman-ssh-cmd-c5227fef-dd73-4ee9-b6cf-6be9226e0191/retrieve.sh
Jan 31 08:19:54 nodename sudo:     rex : TTY=unknown ; PWD=/home/rex ; USER=root ; COMMAND=/var/tmp/foreman-ssh-cmd-c5227fef-dd73-4ee9-b6cf-6be9226e0191/retrieve.sh
Jan 31 08:20:55 nodename sudo:     rex : TTY=unknown ; PWD=/home/rex ; USER=root ; COMMAND=/var/tmp/foreman-ssh-cmd-c5227fef-dd73-4ee9-b6cf-6be9226e0191/retrieve.sh
Jan 31 08:21:55 nodename sudo:     rex : TTY=unknown ; PWD=/home/rex ; USER=root ; COMMAND=/var/tmp/foreman-ssh-cmd-c5227fef-dd73-4ee9-b6cf-6be9226e0191/retrieve.sh
Jan 31 08:22:55 nodename sudo:     rex : TTY=unknown ; PWD=/home/rex ; USER=root ; COMMAND=/var/tmp/foreman-ssh-cmd-c5227fef-dd73-4ee9-b6cf-6be9226e0191/retrieve.sh
Jan 31 08:23:56 nodename sudo:     rex : TTY=unknown ; PWD=/home/rex ; USER=root ; COMMAND=/var/tmp/foreman-ssh-cmd-c5227fef-dd73-4ee9-b6cf-6be9226e0191/retrieve.sh
Jan 31 08:24:56 nodename sudo:     rex : TTY=unknown ; PWD=/home/rex ; USER=root ; COMMAND=/var/tmp/foreman-ssh-cmd-c5227fef-dd73-4ee9-b6cf-6be9226e0191/retrieve.sh
Jan 31 08:25:57 nodename sudo:     rex : TTY=unknown ; PWD=/home/rex ; USER=root ; COMMAND=/var/tmp/foreman-ssh-cmd-c5227fef-dd73-4ee9-b6cf-6be9226e0191/retrieve.sh
Jan 31 08:26:57 nodename sudo:     rex : TTY=unknown ; PWD=/home/rex ; USER=root ; COMMAND=/var/tmp/foreman-ssh-cmd-c5227fef-dd73-4ee9-b6cf-6be9226e0191/retrieve.sh
Jan 31 08:27:58 nodename sudo:     rex : TTY=unknown ; PWD=/home/rex ; USER=root ; COMMAND=/var/tmp/foreman-ssh-cmd-c5227fef-dd73-4ee9-b6cf-6be9226e0191/retrieve.sh
~~~

- Running the script manually, we can see that it never runs due to noexec:

~~~
# /var/tmp/foreman-ssh-cmd-c5227fef-dd73-4ee9-b6cf-6be9226e0191/retrieve.sh
-bash: /var/tmp/foreman-ssh-cmd-c5227fef-dd73-4ee9-b6cf-6be9226e0191/retrieve.sh: Permission denied
~~~


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. Configure foreman-proxy to use async_ssh
~~~
# grep async /etc/foreman-proxy/settings.d/remote_execution_ssh.yml 
# Whether to run remote execution jobs asynchronously
:async_ssh: true
~~~

2. Have a client configured with its remote_working_dir (/var/tmp by default) in a mountpoint with "noexec"

~~~
# mount |grep /var/tmp
tmpfs on /var/tmp type tmpfs (rw,noexec,relatime,seclabel,size=524288k)
~~~

3. Launch any command to be executed with remote execution. 

Actual results:

Job is initiated, but never ends. Doesn't return any errors either.

Expected results:
It should return an error, because the script is not being executed at all.

Additional info:
When using async_false, the jobs fails and returns the permission denied returned by the script execution.

Comment 2 Joniel Pasqualetto 2022-01-31 13:56:43 UTC
Agreed, but that's not the problem I'm reporting.

The problem is that if someone does that, the rex execution don't fail. It should fail, like it does when the async_ssh is false.

Comment 3 Bryan Kearney 2022-03-17 00:05:15 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/34363 has been resolved.

Comment 6 Peter Ondrejka 2022-10-03 14:34:28 UTC
Verified on Satellite 6.12 sn 13, the rex job now fails with: "Error initializing command: RuntimeError - Failed to execute script on remote machine, exit code: 126" in described circumstances (async-ssh). The same goes for ssh provider, pull-mqtt still hangs but that is expected and tracked in https://bugzilla.redhat.com/show_bug.cgi?id=2118651

Comment 10 errata-xmlrpc 2022-11-16 13:33:25 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 (Important: Satellite 6.12 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-2022:8506


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