Server not restarting after shutdown -r now command
Running RHEL 7.4 on an dual quad core Xeon server (Nehalem chipset).
I ran Ubuntu for years without this problem but now every time I restart the server it fails to boot and I have to manually power cycle it. Very annoying to have to go to the server room after every kernel upgrade |
Try "shutdown -r 0" instead. 2 less characters to type.
However, "shutdown -r now" also should work. Note that if there is something preventing stop of services shutdown can fail (regardless of Linux distro). If you're having to power cycle every time you might want to open a console to do your shutdown and see where it hangs and/or what messages it is showing. Also you might want to see what is in your system log (/var/log/system or using systemctl) before the power cycle. |
|
Quote:
However, it is just a "suggestion". The article notes the existing (non-sytemctl) commands still work. Quote:
|
Yeah I've tried all variations of shutdown, reboot, poweroff. There are no PolicyKit rules set that restriction shutdowns, I have verified that shutdown -r now works as expected at the server.
So it only fails when connected via ssh. I have a few more ideas to try tomorrow, but I had to quit for today. |
Quote:
|
SUCCESS! I finally found a work-around that will surely yield an explanation for this problem.
If I log in using ssh as root then all is well: 'shutdown -h now' works as expected. It is only when the command. is executed using sudo or in a root shell started with sudo that there is a problem. Must be an issue with a process dying during the shutdown process when initiated using sudo to elevate privileges. Very strange, as there was no indication that permissions were involved. |
Or start using the new commands?
Table 10.8. Comparison of Power Management Commands with systemctl ssh to root is bound to lead to trouble. |
Quote:
It seems unlikely sudo is the culprit. In my tests I ran via sudo for both "shutdown -r 0" and "shutdodwn -r now" and didn't see the issue you had. Also those tests were run via PuTTY (ssh) sessions into the system as myself then doing the "sudo su -" to become root. Is it possible you did "sudo su" instead of "sudo su -" to become root. The former wouldn't invoke root's environment files (bashrc, profile, etc...). There's a lot in PATH for root that non-root users typically wouldn't have. |
Sorry for the typo - it was '-r' of course.
|
If
su - or sudo su - works but not su or sudo then there might be a check for the real uid in shutdown/reboot. Then it should say so ("need to really be root"), or there is a bug. Furthermore, there might be a bug in systemd, wrongly relying on the privileges of systemd-login. One of the reasons I dislike systemd: they are excellent programmers who dare to integrate some powerful mechanisms, but they do not have the full picture i.e. have not understood the principles that make Unix so secure and flexible. |
Quote:
I explained that the environment for the root user is NOT invoked if you don't add the "-" to the su and that there are things in the root user's environment that typically are not in regular user environments. If you do it without the "-" then you're telling root to keep (inherit) the environment of the reguluar user that ran the su. This is true whether you do it with su and password or sudo su. |
Quick Reboot (forcefully) Linux.
Quote:
#reboot -f use this command. this used for quick reboot(forcefully) the System. |
All times are GMT -5. The time now is 04:48 AM. |