Affected versions: CentOS Stream 10

📖 ~1 min read

Table of contents
  1. Symptom & Impact
  2. Environment & Reproduction
  3. Root Cause Analysis
  4. Quick Triage
  5. Step-by-Step Diagnosis
  6. Solution – Primary Fix
  7. Solution – Alternative Approaches
  8. Verification & Acceptance Criteria
  9. Rollback Plan
  10. Prevention & Hardening
  11. Related Errors & Cross-Refs
  12. References & Further Reading

Symptom & Impact

needs-restarting -r reports services that have actually been restarted.

Environment & Reproduction

Service unit changed but PID file or cgroup is stale.

rpm -q dnf-utils
needs-restarting -r

Root Cause Analysis

needs-restarting compares mtimes and process maps which can lag.

Quick Triage

Cross-check with systemctl list-units and process maps.

systemctl list-units --state=running | head
lsof -p $(pidof httpd) 2>/dev/null | grep DEL | head

Step-by-Step Diagnosis

Inspect the offending PIDs.

needs-restarting -s
ps -eo pid,comm,etime --sort=-etime | head
Illustrative mockup for centos-stream-10 — needs_restart_false
False restart needed — Illustrative mockup — Progressive Robot

Solution – Primary Fix

Restart the truly affected services and clear stale state.

Still having issues? Our IT Solutions & Services team can diagnose and resolve this for you. Get in touch for a free consultation.

systemctl restart httpd php-fpm
Illustrative mockup for centos-stream-10 — needs_restart_clean
All clean — Illustrative mockup — Progressive Robot

Solution – Alternative Approaches

Force a reboot for kernel-affecting updates.

needs-restarting -r || systemctl reboot

Verification & Acceptance Criteria

needs-restarting reports a clean state.

needs-restarting -r; echo $?

Rollback Plan

No revert needed; rollback is a fresh service restart.

systemctl status httpd php-fpm

Prevention & Hardening

Bake needs-restarting -r into CI smoke tests.

echo 'needs-restarting -r' >> /usr/local/bin/postpatch.sh

Stale PIDs, ghost services, false reboot recommendations.

Related tutorial: View the step-by-step tutorial for centos-stream-10.

View all centos-stream-10 tutorials on the Tutorials Hub →

Browse all common problems & solutions on the Tutorials Hub.

References & Further Reading

dnf-utils docs, needs-restarting man.

Need Expert Help?

If you cannot resolve this yourself, our team offers hands-on Server Management, Managed IT Services, and flexible Support Plans. Contact us today — we respond within one business day.