Bug 2372668 - Use `systemctl kill` in logrotate postrotate script
Summary: Use `systemctl kill` in logrotate postrotate script
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: sec
Version: 42
Hardware: Unspecified
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Stefan Schulze Frielinghaus
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2025-06-13 12:15 UTC by Marcos Mello
Modified: 2026-02-21 01:41 UTC (History)
1 user (show)

Fixed In Version: sec-2.9.4-1.fc43
Clone Of:
Environment:
Last Closed: 2026-02-21 01:41:23 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Marcos Mello 2025-06-13 12:15:17 UTC
`systemctl kill` leverages systemd's knowledge of the daemon's main PID, eliminating the need to rely on PID files or external tools like `killall` or `pkill`. This ensures precise signal sending to the intended process, reducing the risk of errors in process identification. Additionally, using `systemctl kill` logs the signal sending in the service's journal, providing a record of actions taken. Requires selinux-policy-41.43 or higher (see https://bugzilla.redhat.com/show_bug.cgi?id=2369644), available as an update for F41, F42, and Rawhide.

https://bodhi.fedoraproject.org/updates/FEDORA-2025-eb98eb9e24 (F41 -- will go to stable in a few days)
https://bodhi.fedoraproject.org/updates/FEDORA-2025-f9f097f491 (F42 -- stable)
https://bodhi.fedoraproject.org/updates/FEDORA-2025-3db4c0ec1c (Rawhide)

The logrotate configuration snippet:

# cat /etc/logrotate.d/sec
/var/log/sec {
    missingok
    notifempty
    sharedscripts
    postrotate
        [ ! -f /run/sec.pid ] || kill -USR2 `cat /run/sec.pid`
    endscript
}

In the postrotate script, everything can be replaced by:

/usr/bin/systemctl kill --signal=USR2 --kill-whom=main sec.service 2>/dev/null || true

Because:

# systemctl show -P MainPID sec.service
1962
# cat /run/sec.pid
1962

Reproducible: Always




Additional Information:
sec-2.9.3-2.fc42.noarch

Comment 1 Fedora Update System 2026-02-12 19:45:18 UTC
FEDORA-2026-0bbc171e2b (sec-2.9.4-1.fc43) has been submitted as an update to Fedora 43.
https://bodhi.fedoraproject.org/updates/FEDORA-2026-0bbc171e2b

Comment 2 Fedora Update System 2026-02-13 01:15:53 UTC
FEDORA-2026-0bbc171e2b has been pushed to the Fedora 43 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2026-0bbc171e2b`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2026-0bbc171e2b

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 3 Fedora Update System 2026-02-21 01:41:23 UTC
FEDORA-2026-0bbc171e2b (sec-2.9.4-1.fc43) has been pushed to the Fedora 43 stable repository.
If problem still persists, please make note of it in this bug report.


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