LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-10-2018, 06:22 AM   #1
mackeyma
LQ Newbie
 
Registered: Apr 2018
Location: Iowa City, Iowa
Distribution: Red Hat Enterprise Linux (University has a site license) - I otherwise use Ubuntu
Posts: 4

Rep: Reputation: Disabled
Angry 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
 
Old 04-10-2018, 10:33 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
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.
 
Old 04-10-2018, 01:11 PM   #3
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,008

Rep: Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629
https://access.redhat.com/documentat..._systemd-power

systemd maybe?
 
1 members found this post helpful.
Old 04-10-2018, 03:30 PM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Quote:
Originally Posted by jefro View Post
Thanks for pointing out the article. I should probably start doing what it suggests.

However, it is just a "suggestion". The article notes the existing (non-sytemctl) commands still work.
Quote:
The commands listed in Table 10.8, “Comparison of Power Management Commands with systemctl” are still available in the system for compatibility reasons, but it is advised that you use systemctl when possible.
I tested both "shutdown -r 0" and "shutdown -r now" on RHEL7 before my initial reply to OP. That is why I opined he may be having other issues preventing the shutdown from completing.
 
Old 04-10-2018, 03:33 PM   #5
mackeyma
LQ Newbie
 
Registered: Apr 2018
Location: Iowa City, Iowa
Distribution: Red Hat Enterprise Linux (University has a site license) - I otherwise use Ubuntu
Posts: 4

Original Poster
Rep: Reputation: Disabled
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.
 
Old 04-10-2018, 03:35 PM   #6
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Quote:
Originally Posted by mackeyma View Post
it fails to boot and I have to manually power cycle it.
So on reread I noticed you're saying it "fails to boot". Does that mean it is in fact shutting down but not coming up after the shutdown? This sounds more like an issue with your BIOS settings than the shutdown itself.
 
Old 04-10-2018, 03:58 PM   #7
mackeyma
LQ Newbie
 
Registered: Apr 2018
Location: Iowa City, Iowa
Distribution: Red Hat Enterprise Linux (University has a site license) - I otherwise use Ubuntu
Posts: 4

Original Poster
Rep: Reputation: Disabled
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.
 
Old 04-10-2018, 04:23 PM   #8
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,008

Rep: Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629
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.
 
Old 04-11-2018, 09:03 AM   #9
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Quote:
Originally Posted by mackeyma View Post
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.
Here you say "-h" but your original question was about "-r". "-h" is not a reboot but rather a halt so you would of course have to power up after a halt.

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.

Last edited by MensaWater; 04-11-2018 at 09:25 AM.
 
1 members found this post helpful.
Old 04-11-2018, 09:21 AM   #10
mackeyma
LQ Newbie
 
Registered: Apr 2018
Location: Iowa City, Iowa
Distribution: Red Hat Enterprise Linux (University has a site license) - I otherwise use Ubuntu
Posts: 4

Original Poster
Rep: Reputation: Disabled
Sorry for the typo - it was '-r' of course.
 
Old 04-15-2018, 05:38 AM   #11
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,816

Rep: Reputation: 1211Reputation: 1211Reputation: 1211Reputation: 1211Reputation: 1211Reputation: 1211Reputation: 1211Reputation: 1211Reputation: 1211
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.
 
Old 04-16-2018, 08:08 AM   #12
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Quote:
Originally Posted by MadeInGermany View Post
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.
The OP never wrote about one working and the other not. However, I did and I disagree with what you say about a bug.

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.
 
Old 04-25-2018, 12:18 AM   #13
Shahbaz_Mansuri
LQ Newbie
 
Registered: Feb 2018
Posts: 5

Rep: Reputation: Disabled
Smile Quick Reboot (forcefully) Linux.

Quote:
Originally Posted by mackeyma View Post
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








#reboot -f
use this command. this used for quick reboot(forcefully) the System.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
restarting system via ssh access when shutdown does not work coenvh Linux - Newbie 2 07-22-2011 06:10 PM
[SOLVED] After shutdown the system restarting in Red Hat saritha4259@yahoo.in Linux - Newbie 4 02-11-2011 09:36 AM
Why can't this machine shutdown without automaticaly restarting? >SOL Linux - Newbie 10 08-04-2009 07:06 AM
Screen Blank While restarting/shutdown kushalkoolwal Debian 76 08-10-2006 08:50 PM
shutdown and restarting in terminal chrismiceli Linux - General 1 10-26-2002 08:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration