Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
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.
.`logrotate` no longer incorrectly signals Rsyslog in log rotation
Previously, the argument order was incorrectly set in the `logrotate` script, which caused a syntax error. This resulted in `logrotate` not correctly signaling Rsyslog during log rotation.
With this update, the order of the arguments in `logrotate` is fixed and `logrotate` signals Rsyslog correctly after log rotation even when the `POSIXLY_CORRECT` environment variable is set.
Hello,
To me, it does not seem like a bug in rsyslog, when the POSIXLY_CORRECT=1 env variable is set.
If you take a look at the command output lines:
Failed to kill unit -s.service: Unit -s.service not loaded.
Failed to kill unit HUP.service: Unit HUP.service not loaded.
You can see that it is not capable of determining which parameter represents the signal. Firstly, it tries the "-s.service"(don't know why), which probably does not exist. From the systemctl man page: --signal: When used with kill, choose which signal to send to selected processes. Must be one of the well-known signal specifiers such as SIGTERM, SIGINT or SIGSTOP. If omitted, defaults to SIGTERM.
As it was unable to process the signal part, the default is used, which is the SIGTERM signal. In that case, it is delivered to the rsyslog service. Thus, rsyslog will terminate.
Feel free to correct me if I am wrong.
Comment 2Dariusz Wojewódzki
2022-04-06 08:08:14 UTC
Hello, This command is in the official rsyslog package in the /etc/logrotate.d/syslog file.
As you stated, systemctl wants to kill both the -s and HUP services that do not exist and sends a SIGTERM signal to all parameters after kill, rather than interpreting -s as a switch.
On the other hand:
"/usr/bin/systemctl -s HUP kill rsyslog.service >/dev/null 2>&1 || true" works with POSIXLY_CORRECT.
Hello,
Now I can see the difference between the two commands:
1. /usr/bin/systemctl kill -s HUP rsyslog.service
2. /usr/bin/systemctl -s HUP kill rsyslog.service
So in case the POSIXLY_CORRECT=1 env var is set, only the second option is correct. Both versions work when the mentioned env variable is not set. Although I do not know the reason behind it.
According to the manual page, the syntax should be the following:
systemctl [OPTIONS...] COMMAND [NAME...]
Thanks for noticing it.
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 (rsyslog bug fix and enhancement update), 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-2023:2831
Version-Release number of selected component (if applicable): rsyslog-8.2102.0-5.el8.x86_64 bash-4.4.20-2.el8.x86_64 #cat /etc/logrotate.d/syslog /var/log/cron /var/log/maillog /var/log/messages /var/log/secure /var/log/spooler { missingok sharedscripts postrotate /usr/bin/systemctl kill -s HUP rsyslog.service >/dev/null 2>&1 || true endscript } How reproducible: [root@rhel85 ~]# echo $POSIXLY_CORRECT [root@rhel85 ~]# /usr/bin/systemctl kill -s HUP rsyslog.service [root@rhel85 ~]# systemctl status rsyslog.service ● rsyslog.service - System Logging Service Loaded: loaded (/usr/lib/systemd/system/rsyslog.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2022-03-31 11:18:04 CEST; 10min ago Docs: man:rsyslogd(8) https://www.rsyslog.com/doc/ Main PID: 877 (rsyslogd) Tasks: 3 (limit: 23464) Memory: 2.5M CGroup: /system.slice/rsyslog.service └─877 /usr/sbin/rsyslogd -n Mar 31 11:18:04 rhel85.example.com systemd[1]: Starting System Logging Service... Mar 31 11:18:04 rhel85.example.com systemd[1]: Started System Logging Service. Mar 31 11:18:04 rhel85.example.com rsyslogd[877]: [origin software="rsyslogd" swVersion="8.2102.0-5.el8" x-pid="> Mar 31 11:18:04 rhel85.example.com rsyslogd[877]: imjournal: journal files changed, reloading... [v8.2102.0-5.e> Mar 31 11:22:23 rhel85.example.com rsyslogd[877]: [origin software="rsyslogd" swVersion="8.2102.0-5.el8" x-pid="> Mar 31 11:28:12 rhel85.example.com rsyslogd[877]: [origin software="rsyslogd" swVersion="8.2102.0-5.el8" x-pid="> [root@rhel85 ~]# export POSIXLY_CORRECT=1 [root@rhel85 ~]# /usr/bin/systemctl kill -s HUP rsyslog.service Failed to kill unit -s.service: Unit -s.service not loaded. Failed to kill unit HUP.service: Unit HUP.service not loaded. [root@rhel85 ~]# systemctl status rsyslog.service ● rsyslog.service - System Logging Service Loaded: loaded (/usr/lib/systemd/system/rsyslog.service; enabled; vendor preset: enabled) Active: inactive (dead) since Thu 2022-03-31 11:28:47 CEST; 4s ago Docs: man:rsyslogd(8) https://www.rsyslog.com/doc/ Process: 877 ExecStart=/usr/sbin/rsyslogd -n $SYSLOGD_OPTIONS (code=exited, status=0/SUCCESS) Main PID: 877 (code=exited, status=0/SUCCESS) Mar 31 11:18:04 rhel85.example.com systemd[1]: Starting System Logging Service... Mar 31 11:18:04 rhel85.example.com systemd[1]: Started System Logging Service. Mar 31 11:18:04 rhel85.example.com rsyslogd[877]: [origin software="rsyslogd" swVersion="8.2102.0-5.el8" x-pid="> Mar 31 11:18:04 rhel85.example.com rsyslogd[877]: imjournal: journal files changed, reloading... [v8.2102.0-5.e> Mar 31 11:22:23 rhel85.example.com rsyslogd[877]: [origin software="rsyslogd" swVersion="8.2102.0-5.el8" x-pid="> Mar 31 11:28:12 rhel85.example.com rsyslogd[877]: [origin software="rsyslogd" swVersion="8.2102.0-5.el8" x-pid="> Mar 31 11:28:47 rhel85.example.com rsyslogd[877]: [origin software="rsyslogd" swVersion="8.2102.0-5.el8" x-pid="> Mar 31 11:28:47 rhel85.example.com rsyslogd[877]: [origin software="rsyslogd" swVersion="8.2102.0-5.el8" x-pid="> Mar 31 11:28:47 rhel85.example.com systemd[1]: rsyslog.service: Succeeded.