Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1956158

Summary: Attempt to restart a client using remote execution results in error shutdown: command not found
Product: Red Hat Satellite Reporter: Prakash Ghadge <pghadge>
Component: Remote ExecutionAssignee: Adam Ruzicka <aruzicka>
Status: CLOSED ERRATA QA Contact: Peter Ondrejka <pondrejk>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.8.0CC: aruzicka, lstejska, mmccune, pcreech, saydas
Target Milestone: 6.10.0Keywords: Patch, Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: tfm-rubygem-foreman_remote_execution-4.5.4 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-16 14:10:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Prakash Ghadge 2021-05-03 04:54:49 UTC
Description of problem:

Attempt to restart a client using remote execution results in error shutdown: command not found

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

> Satellite 6.8

How reproducible:

> In some cases it fails.

Steps to Reproduce:

> Unknown. But the workaround mentioned in additional info helped to resolve the issue.

Actual results:

> Restart task fails with the following error
~~~
   1:restart host
   2:/var/tmp/foreman-ssh-cmd-d1c44834-3875-4db1-ae22-e58a75f8fbb4/script: line 4: shutdown: command not found
   3:Exit status: 127
~~~

Expected results:

> Should restart the host without any error.

Additional info:

> There is a chance that the initialization of the PATH variable is not happening on the target host properly or it's not properly set for the SSH User.

The simple workaround is to modify the "Power Action - SSH Default" template with the absolute path of the "shutdown" command. Use "/sbin/shutdown" as this path is available on RHEL 6, 7, and 8.

~~~
echo <%= input('action') %> host && sleep 3
<%= case input('action')
     when 'restart'
       '/sbin/shutdown -r +1'
     else
       '/sbin/shutdown -h now'
     end %>
~~~

Comment 1 Bryan Kearney 2021-07-29 12:04:03 UTC
Upstream bug assigned to aruzicka

Comment 2 Bryan Kearney 2021-07-29 12:04:06 UTC
Upstream bug assigned to aruzicka

Comment 3 Bryan Kearney 2021-08-02 12:05:02 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/32496 has been resolved.

Comment 6 Peter Ondrejka 2021-08-16 13:23:49 UTC
Verified on Satellite 6.10 sn 13

Comment 9 errata-xmlrpc 2021-11-16 14:10:44 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