ACPI Questions? Will server Power button gracefully shut down the server?


Recommended Posts

While testing the power button shutdown (which works okay) I've noticed that a lot of the shutdown activities are performed twice.  For instance, there are two syslog copies made each time (10 - 15 seconds apart), the hdparm, smartctl and cfg file information etc is duplicated.  I'm guessing that this is happening because the LimeTech processing is taking place as well as Bubba's Powerdown from unMenu.  The result is that it takes more than one minute for the powerdown to complete and there are several bursts of disk activity.

 

Is this as it should be, or has something gone wrong in the installation of the powerdown package?

Link to comment

Or it could be the powerdown script is hooked in via the ACPI Power Button Event trigger and also from the /etc/rc.d/rc.local_shutdown script.

 

Well, it also happens when the power down is initiated by the apcupsd.

 

During the 10 to 15 seconds between the 'two shutdowns', the syslog grows by approx 100kB!

 

===============

 

Okay, looking at rc.local_shutdown, I can see that it calls rc.unRAID, if present.  Looking at rc.unRAID, it would seem that it is being invoked twice - whether that is because rc.local_shutdown is invoked twice, or because rc.unRAID is being called from two different places, I don't know.

 

===============

 

Ah, the double shutdown also occurs if I use the 'powerdown' command from a telnet session.

 

===============

 

Hmmm .... I find this comment in the cache_dirs script, and wonder whether this has anything to do with the double shutdown:

# if we detect an attempt to stop the array without quiting this cache_dirs program we will
# suspend the scanning of directories for a duration to allow a clean Stop of the array.
# (Basically, press the "Stop" button again within this window of time as first will NOT
# stop the array since we have forced  all the disks busy. )

 

===============

 

What I see in the logfiles is:

 

......
Sep 17 16:21:13 Tower rc.unRAID[16613]: Umounting the drives
Sep 17 16:21:13 Tower rc.unRAID[16617]: umount: /mnt/disk1: device is busy
Sep 17 16:21:13 Tower rc.unRAID[16617]: umount: /mnt/disk1: device is busy
Sep 17 16:21:19 Tower kernel: mdcmd (280): spindown 2
Sep 17 16:21:22 Tower rc.unRAID[16617]: /dev/md2 umounted
Sep 17 16:21:28 Tower rc.unRAID[16624]: Stopping the Array
Sep 17 16:21:28 Tower kernel: mdcmd (282): stop 
Sep 17 16:21:28 Tower kernel: md: 2 devices still in use.

 

This is where the first log finishes, but the second one continues with:

 

Sep 17 16:21:31 Tower root: Initiating Shutdown with 
Sep 17 16:21:31 Tower shutdown[16645]: shutting down for system halt
Sep 17 16:21:32 Tower init: Switching to runlevel: 0
Sep 17 16:21:35 Tower rc.unRAID[16656]: Stopping unRAID.
Sep 17 16:21:35 Tower version[16657]: Linux version 2.6.32.9-unRAID (root@Develop) (gcc version 4.2.3) #5 SMP Wed Jun 16 20:45:26 MDT 2010
......

Link to comment

Okay, so it shouldn't be cache_dirs doing it, but something is causing the shutdown procedure to be repeated and something is causing syslog to be copied to the flash drive immediately after the 'md: 2 devices still in use' message.

 

 

Oh, and it seems that I've polluted the ACPI powerdown thread with a problem that turns out to be more general, and not specifically related to ACPI.  Am I able to split this out into a separate thread?

Link to comment
  • 8 months later...

Would anyone happen to know if there would be a reason that in 4.7 the power button would gracefully shut down the server, but after upgrading to 5.0b6a (and no other changes), it no longer works?  Any direction on how to recover that functionality would be a huge help!

Link to comment

Would anyone happen to know if there would be a reason that in 4.7 the power button would gracefully shut down the server, but after upgrading to 5.0b6a (and no other changes), it no longer works?  Any direction on how to recover that functionality would be a huge help!

Can you go through the steps described in the FIRST post in this thread?  If you do, you'll be able to tell us what is happening, and what is not.

 

Without those clues, nobody will be able to help you diagnose what is happening on your hardware.

 

Joe L.

Link to comment
  • 5 months later...

To test if the power button will send an ACPI message, do as I outlined

 

Type

killall acpid

cat /proc/acpi/event

 

then momentarily press the power button (press it for less than a second).

 

If you see a message like this:

button/power PWRF 00000080 00000001

the power button will work to send a message to shut down the server.

 

You can then type

"control-C" on the screen with the "cat" command to stop it.

 

then type

/etc/rc.d/rc.acpid restart

 

to re-start the acpi daemon process you killed earlier.

 

Then type

grep power /etc/acpi/acpi_handler.sh

 

If you see

 

# tmm - power off via webGui

#     power) /sbin/init 0

     power) /sbin/powerdown

 

It will indicate you installed WeeboTech's powerdown package through the most recent unMENU pagkage installer.  It (unMENU's package) updated /etc/acpi/acpi_handler.sh to have it invoke /sbin/powerdown instead of /usr/local/sbin/powerdown.  

 

This is the only way I know (so far) that will terminate processes holding disks busy, un-mount the disks, stop the array cleanly, save copies of log files, and then power down.  It does not depend on "emhttp" running at all.

 

As I said, when my server is idle I will simply type

/usr/local/sbin/powerdown

I'll watch it power down and see if it attempts to stop the array first.

 

If all of the above is true, in my situation, is that enough confirmation this will cleanly shut down my array, or is the only way to KNOW to actually just do it?

 

I ask because I have this setup, and things got messed up, in inexperienced and I hit the power button, thinking I was covered.  But, it didn't work properly; but that's because I'm stupid and hit the reset button instead :(

 

It's currently checking parity, and won't be done anytime soon it seems.  I'd like to confirm this will actually shut down properly without risking another parity check.  I read the entire thread, but I didn't see any other way to confirm.

 

thanks

 

***I have since tested this, and it worked flawlessly.  Full logging, graceful shutdown of SAB, CP, SB, then array, then machine.

Link to comment
  • 11 months later...

I'm almost positive that Tom's version DOES stop the array first, at least that was my impression when I inadvertently tried it some time ago.  But sorry 8) 8) 8) 8) 8)

 

this is nice post

Only if  all disks are idle. Otherwise, the stock  powerdown  will not stop the array. (or power down)
Link to comment
  • 10 months later...

We're now in v5.0 final.

Is this mod for powerdown still necessary or does the stock one do it clean?

 

How is it with the Power-button? Does it also trigger a clean shutdown?

 

How can I check that?

 

I already had some situations where the GUI server wasn't responding any more.

The only way is through telnet or power-button.

 

Link to comment

After reading through the whole thread and checking the corresponding files on my stick, I can answer my own question...

 

No, in v5.0 the stock powerdown routine still relies on the emhttp.

 

Imho that (the stock one) is a pretty useless script because I will only use the console or the power-button

in such situations where the GUI is not responding anymore.

Link to comment
  • 2 months later...

So let's say the server is completely functional, but I hit the power button on v5 final

 

will it cleanly shutdown?

 

How can I make it so it cleanly shuts down?

The only person who can answer the first question is YOU, assuming you can follow the instructions in the first posts of this thread to learn how you've set up your own server.  Any add-ons you've added vastly complicate the answer, as most older plugins will NOT stop themselves, and they will prevent the server from stopping.

 

As far as the second, if ACPI is enabled, and configured, and your MB implemented it correctly, you cannot do anything more.

If you rely upon the built-in powerdown and emhttp crashes or stops responding, it will not power down cleanly.

 

Joe L.

Link to comment

So let's say the server is completely functional, but I hit the power button on v5 final

 

will it cleanly shutdown?

 

How can I make it so it cleanly shuts down?

The only person who can answer the first question is YOU, assuming you can follow the instructions in the first posts of this thread to learn how you've set up your own server.  Any add-ons you've added vastly complicate the answer, as most older plugins will NOT stop themselves, and they will prevent the server from stopping.

 

As far as the second, if ACPI is enabled, and configured, and your MB implemented it correctly, you cannot do anything more.

If you rely upon the built-in powerdown and emhttp crashes or stops responding, it will not power down cleanly.

 

Joe L.

 

Well the reason I ask is I'm about to virtualize unRAID going back to bone stock on unRAID so out of the box, will it do it? If not, what do I need to do besides powerdown script to do that?

 

I'm trying to line all my shots before I get my time off from work so I can maximize my ESXi setup efficiency.

 

I wanna get the computer ready ASAP so I'm using my downtime to think of every scenario

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.