RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 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 "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". 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 "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-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 1409562 - Preparation for sending SIGTERM to rhn_check when rhnsd is terminated
Summary: Preparation for sending SIGTERM to rhn_check when rhnsd is terminated
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: rhnsd
Version: 7.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Jiří Dostál
QA Contact: Lukáš Hellebrandt
URL:
Whiteboard:
Depends On:
Blocks: 1395284
TreeView+ depends on / blocked
 
Reported: 2017-01-02 13:29 UTC by Jiří Dostál
Modified: 2021-03-11 14:53 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-01 22:19:00 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:2039 0 normal SHIPPED_LIVE rhn-client-tools, rhnlib, rhnsd, and yum-rhn-plugin bug fix update 2017-08-01 19:33:28 UTC

Description Jiří Dostál 2017-01-02 13:29:19 UTC
Description of problem:

When rhnsd is terminated and some instance of rhn_check is running, rhn_check doesn't quit and keeps running. This results in failures during machine shutdown, as rhn_check will later get killed ungracefully.

This Bugzilla has been created from https://bugzilla.redhat.com/show_bug.cgi?id=1260527 

This issue 
Version-Release number of selected component (if applicable):
rhnsd-5.0.23-1

How reproducible:
Always on RHEL 7

Steps to Reproduce:
1.  Register a RHEL 7 VM to satellite 5.7
2.  Assign provisioning entitlement to RHEL 7 system
3.  Subscribe RHEL 7 system to RHN tools channel.
4.  Install rhncfg and osad packages on RHEL 7 system using below command :
    # yum install rhncfg*
    # yum install osad
5   enable all actions for RHEL 7 system by executing below command :
    # rhn-actions-control --enable-all
6.  Go to RHEL 7 systems profile on satellite webui.
7.  Click on "Details" tab.
8.  Click on "Remote Command".
9.  In "Script" section add following command
    shutdown -h now  
10. Select appropriate time interval and date.
11. Click on schedule.
12. Now wait till command is executed. Once system is shutdown observe its status satellite webui.

Actual results:

1. Command is executed and system shuts down.
2. Status on satellite webUI remains as "The client has not yet completed this action"
3. When we power-on the system again the task gets executed and system gets shutdown
This goes in a loop. Action is never marked as completed.

Expected results:

1. Command is executed and system shuts down.
2. Status on satellite webUI should be : Completed


Additional info:
See https://bugzilla.redhat.com/show_bug.cgi?id=1260527 for original bug report.

This is fixed in spacewalk.git by 
75d9c00b96ab430221c5c7668baebebc74ddd67e
e5b82010f9a2d197b33e73de9e4267c8ec8135ec

Comment 4 Lukáš Hellebrandt 2017-06-27 11:34:37 UTC
When running multiple commands with the restart not being last, the execution stops after restart and the rest of the commands is not executed. The action is marked as Completed, with text 'Client execution returned "Script executed. Termination signal occurred during execution" (code 0)'.

Example:

1) schedule remote command
"""
shutdown -r now
echo test >> /root/test
"""
2) rhn_check
3) after restart:
# cat /root/test
cat: test: No such file or directory
4) In WebUI, notice the action is marked as Completed, with text 'Client execution returned "Script executed. Termination signal occurred during execution" (code 0)'


Needinfo: Is this acceptable behavior?

Comment 5 Jiří Dostál 2017-06-27 14:30:17 UTC
Yes, this is exactly the reason why this result message has been chosen. If user runs a script with instant reboot "somewhere inside", we can't guarantee that this script was executed to the end, that's why we're letting him know that it was "terminated during execution".

Comment 7 Lukáš Hellebrandt 2017-06-29 15:02:31 UTC
Verified with rhnlib-2.5.65-4, rhn-client-tools-2.0.2-11 (ONLY, rhn-client-tools-2.0.2-16 version is broken), rhnsd-5.0.13-7.

The signal is sent correctly but SELinux blocks it. Follow up bug 1466430 created. I am treating this BZ as "rhnsd *tries* to send signal to rhn_check".

1. Have a Client (with setenforce 1) registered to some Satellite 5, with provisioning and packages necessary for remote command execution installed
2. Schedule a remote command with long sleep to the Client
3. Wait for rhnsd to run rhn_check *
4. After the command is in picked-up state, kill rhnsd with SIGTERM
5. This causes rhnsd to send SIGTERM to the running rhn_check
6. Mentioned AVC denial occurs, rhn_check doesn't receive the signal and rhnsd waits indefinitely for rhn_check's termination

This also happens in 7.3 with package versions in which this BZ is fixed.


* if you do not want to wait, use gdb:
gdb -p <rhnsd PID>
c
^C
select-frame 2
set var sleep_untile=<now+1>
select-frame 1
return (unsigned int)0
c

Comment 8 errata-xmlrpc 2017-08-01 22:19:00 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, 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/RHBA-2017:2039


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