Server takes long time to shutdown or reboot
Environment
- Red Hat Enterprise Linux 7
- Red Hat Enterprise Linux 8
- Red Hat Enterprise Linux 9
Issue
- Server taking long time to shutdown.
reboot.targettaking long time and forcefully stopped during reboot
Resolution
-
Remove or comment the configurations to start the service using /etc/rc.local file.
-
Write systemd unit file to start/stop the third party applications using proper dependencies.
Root Cause
-
The third party applications 'ctmemd' and 'ctmsrvd' were started with the help of rc.local file.
# vi /etc/rc.local -
The system had no mechanism to stop the application during system shutdown. Hence the reboot.target wait for the time (as per configured timeout value).
-
Starting from RHEL7 init scripts are considered as deprecated and any application should start using systemd unit files.
How to convert init scripts to systemd units files
Diagnostic Steps
-
The debug log shows additional logs during system shutdown and helps to find out possible culprit. Enable temporary debugging for systemd using below command.
# systemd-analyze set-log-level debug -
Check content of /etc/rc.local
# cat /etc/rc.local
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments