📖 ~1 min read
Table of contents
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

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

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
Related Errors & Cross-Refs
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.