Powerdown package for unRAID v5 and v6 (DEPRECATED)


dlandon

Recommended Posts

Well... i am running unraid beta 6 with IronicBadger's ArchVm appliance running as a VM.

I have installed powerdown 2.0 and installed it with installpkg etc.

If i enter the powerdown command, nothing happens:

 

root@Tower:/# powerdown
root@Tower:/#

 

Except for 2 beeps from the computer, and all networkshares and the webgui is lost. So it probably is doing something, it just doesnt show ANYHTING on screen.

Also, the archVM is NOT stopped. It keeps on running.

 

For some reason i have to use xl destroy archVM because a local poweroff or xl shutdown is not working.

 

Once i do that, the powerdown 2.0 script, which is probably pausing or halted, continues. In the meantime nothing happens... once the vm is killed, it does show ' Powerdown 2.0' but you have to be fast to see it.

 

So... for me, this powerdown script is not working. I would like a powerdown script that, once called by an unraid user, or triggered by the APCUPSD, will first shutdown all vm's, and finally shutdown the unraid machine itself.

 

Is this something that can be done? If not, how do i go about shutting down an unraid server with some vm's running, in an automated, orderly fashion?

Link to comment
  • Replies 678
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Well... i am running unraid beta 6 with IronicBadger's ArchVm appliance running as a VM.

I have installed powerdown 2.0 and installed it with installpkg etc.

If i enter the powerdown command, nothing happens:

 

root@Tower:/# powerdown
root@Tower:/#

 

Except for 2 beeps from the computer, and all networkshares and the webgui is lost. So it probably is doing something, it just doesnt show ANYHTING on screen.

Also, the archVM is NOT stopped. It keeps on running.

 

For some reason i have to use xl destroy archVM because a local poweroff or xl shutdown is not working.

 

Once i do that, the powerdown 2.0 script, which is probably pausing or halted, continues. In the meantime nothing happens... once the vm is killed, it does show ' Powerdown 2.0' but you have to be fast to see it.

 

So... for me, this powerdown script is not working. I would like a powerdown script that, once called by an unraid user, or triggered by the APCUPSD, will first shutdown all vm's, and finally shutdown the unraid machine itself.

 

Is this something that can be done? If not, how do i go about shutting down an unraid server with some vm's running, in an automated, orderly fashion?

 

There is a new feature in powerdown 2.00 to enable shutting down VMs.  Please read the OP and you can see the instructions on how to do that.  Basically you add your own script to perform the VM shutdown.

Link to comment

There is a new feature in powerdown 2.00 to enable shutting down VMs.  Please read the OP and you can see the instructions on how to do that.  Basically you add your own script to perform the VM shutdown.

Ah ok, will do that. I was under the assumption that shutting down vm's was part of this new script.

Link to comment

Ok, 2 things.

 

The op says: If the Kxx script is not provided, powerdown will kill the VM and this may not be the cleanest way to shutdown the VM.

I have no scripts there, still powerdown hangs and does not kill the vm's...

 

Second, you talk about vmware, is that what we are running? iI thought unraid is using xen?

Link to comment

Ok, 2 things.

 

The op says: If the Kxx script is not provided, powerdown will kill the VM and this may not be the cleanest way to shutdown the VM.

I have no scripts there, still powerdown hangs and does not kill the vm's...

 

Second, you talk about vmware, is that what we are running? iI thought unraid is using xen?

 

I am not that familiar with VMs.  Apparently powerdown cannot shut it down.  You will have to provide a script to shut it down and put it in the /etc/rc.d/rc.unRAID.d/ directory.  The name should be Kxx where xx is 00-99.

 

VMware was previously stopped in powerdown because of a special need of a user.  The way powerdown handles it now is to use custom scripts in the /etc/rc.d/rc.unRAID.d/ directory.  The VMware stop was removed from powerdown.

 

Can you also provide a syslog so I can see where powerdown is pausing?

Link to comment

Ok, 2 things.

 

The op says: If the Kxx script is not provided, powerdown will kill the VM and this may not be the cleanest way to shutdown the VM.

I have no scripts there, still powerdown hangs and does not kill the vm's...

 

Second, you talk about vmware, is that what we are running? iI thought unraid is using xen?

 

Ok.  I think I've found a potential race condition.  The custom scripts in /etc/rc.d/rc.unRAID.d/ are processed after unraid tries to shut down Xen.  The rc.unRAID script is called after that occurs so Xen shutdown is waiting, and rc.unRAID doesn't run and process the scripts to shutdown the VMs.  i.e a race condition where everyone is stuck.

 

I'm making a change to handle this situation and will release the fix as 2.01 after I do some testing.

Link to comment
There is a new feature in this version of powerdown for customization.  The directory /etc/rc.d/rc.unRAID.d/ is created by powerdown for script files to be executed on shutdown.  The files are named Kxx* where xx is 00-99.  File names not in this format will be ignored.  The numbers are used so you can control the order of the file processing.  These scripts are executed with the ‘stop’ parameter.

 

Anyone give an example script to stop a virtual machine?

Link to comment

There is a new feature in this version of powerdown for customization.  The directory /etc/rc.d/rc.unRAID.d/ is created by powerdown for script files to be executed on shutdown.  The files are named Kxx* where xx is 00-99.  File names not in this format will be ignored.  The numbers are used so you can control the order of the file processing.  These scripts are executed with the ‘stop’ parameter.

 

Anyone give an example script to stop a virtual machine?

I guess it will be something like: 'xl shutdown [yourVM]' or 'xm shutdown [id]' ?

A script would iterate through the xl list id's and send that command to all vm's but the dom0 (id's >0?) or is there a smarter way to do it?

Link to comment

I need some help from one of you Linux gurus.

 

I am trying to have the powerdown script execute when the power button is pressed.  I am doing this to the acpi_handler.sh script:

sed -i -e "s/init 0/powerdown/" /etc/acpi/acpi_handler.sh 

 

#!/bin/sh
# Default acpi script that takes an entry for all actions

IFS=${IFS}/
set $@

case "$1" in
  button)
    case "$2" in
      power) /sbin/powerdown
         ;;
      *) logger "ACPI action $2 is not defined"
         ;;
    esac
    ;;
  *)
    logger "ACPI group $1 / action $2 is not defined"
    ;;
esac

 

When the power button is pressed, it appears to be running the init 0 runtime level.  And executing "shutdown" and not my "powerdown" script.

 

EDIT: I got it.  When the power button is pressed, echo messages do not show up on the tty, but the script is running anyway.

Link to comment

From the opening post: The directory /etc/rc.d/rc.unRAID.d/ is created by powerdown for script files to be executed on shutdown.

 

I've looked, but there is no such directory... do i have to create it myself?

 

root@Tower:/etc/rc.d# ls -l
total 204
lrwxrwxrwx 1 root root     4 Jan 31 18:49 rc.0 -> rc.6*
-rwxr-xr-x 1 root root  1282 Mar 26  2007 rc.4*
-rwxr-xr-x 1 root root  7707 Sep 22 16:43 rc.6*
-rwxr-xr-x 1 root root  2893 Apr 16  2011 rc.K*
-rwxr-xr-x 1 root root 13582 Jan 31 18:49 rc.M*
-rwxr-xr-x 1 root root 14841 Jan 31 18:49 rc.S*
-rwxr-xr-x 1 root root   552 Jul  9  2013 rc.acpid*
-rwxr-xr-x 1 root root  1230 Jan 31 18:49 rc.atalk*
-rwxr-xr-x 1 root root  1569 Dec 17 21:54 rc.avahidaemon*
-rwxr-xr-x 1 root root  1627 Dec 17 21:54 rc.avahidnsconfd*
-rwxr-xr-x 1 root root  1893 Dec 17 21:56 rc.fuse*
-rwxr-xr-x 1 root root 13230 Jan 31 18:49 rc.inet1*
-rw-r--r-- 1 root root  2619 Jan 31 18:49 rc.inet1.conf
-rwxr-xr-x 1 root root  5039 Jan 31 18:49 rc.inet2*
-rwxr-xr-x 1 root root   497 Sep 11  2003 rc.inetd*
-rw-r--r-- 1 root root  3781 May 18  2013 rc.ip_forward
-rwxr-xr-x 1 root root  2487 Dec 18 14:58 rc.libvirt*
-rwxr-xr-x 1 root root  1598 Jan 31 18:49 rc.local*
-rwxr-xr-x 1 root root   588 Jan 31 18:49 rc.local_shutdown*
-rwxr-xr-x 1 root root   168 Apr 23  2011 rc.loop*
-rwxr-xr-x 1 root root  1893 Jul  9  2013 rc.messagebus*
-rwxr-xr-x 1 root root  2449 May 21  2013 rc.nfsd*
-rwxr-xr-x 1 root root  1481 Oct 14 00:59 rc.ntpd*
-rwxr-xr-x 1 root root  1402 Oct 14  2008 rc.rpc*
-rwxr-xr-x 1 root root  4202 Jan 31 18:49 rc.samba*
-rw-r--r-- 1 root root  1170 Jul 12  2013 rc.saslauthd
-rw-r--r-- 1 root root  2895 Aug  7  2013 rc.serial
-rwxr-xr-x 1 root root  1991 Jan 31 18:49 rc.sshd*
-rwxr-xr-x 1 root root  1034 Jan 31 18:49 rc.syslog*
-rwxr-xr-x 1 root root  1740 Sep 11  1999 rc.sysvinit*
-rwxr-xr-x 1 root root  6366 Jan 17  2013 rc.udev*
-rwxr-xr-x 1 root root  1476 Oct 30 01:18 rc.xen-watchdog*
-rwxr-xr-x 1 root root  4597 Oct 30 01:18 rc.xencommons*
-rwxr-xr-x 1 root root  1703 Oct 30 01:18 rc.xend*
-rwxr-xr-x 1 root root 13729 Oct 30 01:18 rc.xendomains*

Link to comment

Given the old 1.02 version worked on my system, I want to be careful not to screw anything up.  ;D  APC plugin is also working fine on my rig.  I could use some confirmation on a few things before I start testing this new Powerdown package.

 

first, I ran unmenu in the past, but have disabled it my GO file.  My GO files is stock now.  I do not use unmenu at all.  I use stock gui too.

 

In looking at my /boot/packages/  directory, I see two version of the APC package,

apcupsd-3.14.10-i486-1_atv.tgz  (I think is just old junk left over and can be deleted)

apcupsd-3.14.10-i486-4_rlw.tgz  (I think this is the current one that the plugin is loading)

 

I see the powerdown 1.02 in the packages directory.  There are also a bunch of unmenu packages in there.

 

Can somebody please confirm that I can just delete all the packages in the /boot/packages/ directory without harm, as it's my understanding that anything needed will just be downloaded again on a reboot?  I'd like to clean up the stuff from unmenu, get rid of the 2nd APC package.

 

Once that is cleaned up, it's my understanding that I need to edit the APC plugin, so it calls for the new Powerdown 2.0 package.

 

I have the APC plugin in /boot/config/plugins/Apcupsd-3.14.10-i486-4_rlw-dl.fixed.plg

 

The APC plugin installs the following:

 

<FILE Name="/boot/packages/powerdown-1.02-noarch-unRAID.tgz" Run="CTRLALTDEL=YES upgradepkg --install-new">

<URL>http://unraid-powercontrol.googlecode.com/files/powerdown-1.02-noarch-unRAID.tgz</URL>

<MD5>10eff6bbb4a2f1428b4c57dbc292a2a5</MD5>

</FILE>

 

If I understand correctly, I need to edit this APC plugin by removing the above section and adding the following section from this thread:

 

<FILE Name="/boot/packages/powerdown-2.00-noarch-unRAID.tgz" Run="CTRLALTDEL=YES upgradepkg --install-new">

<URL>--no-check-certificate https://github.com/dlandon/unraid-snap/raw/master/powerdown-2.00-noarch-unRAID.tgz</URL>

</FILE>

 

Because I use the APC plugin and it will install he new Powerdown, I do not need the new Powerdown.plg file at all  - Correct?

 

Thanks for the help.

 

Link to comment

There is a new feature in this version of powerdown for customization.  The directory /etc/rc.d/rc.unRAID.d/ is created by powerdown for script files to be executed on shutdown.  The files are named Kxx* where xx is 00-99.  File names not in this format will be ignored.  The numbers are used so you can control the order of the file processing.  These scripts are executed with the ‘stop’ parameter.

 

Anyone give an example script to stop a virtual machine?

I guess it will be something like: 'xl shutdown [yourVM]' or 'xm shutdown [id]' ?

A script would iterate through the xl list id's and send that command to all vm's but the dom0 (id's >0?) or is there a smarter way to do it?

 

This would shutdown all running VM

 

 xl shutdown -a

 

But sometimes the Windows VM not proper be shutting down, so maybee we must do a force shutdown .. ?

 

Link to comment

Given the old 1.02 version worked on my system, I want to be careful not to screw anything up.  ;D  APC plugin is also working fine on my rig.  I could use some confirmation on a few things before I start testing this new Powerdown package.

 

first, I ran unmenu in the past, but have disabled it my GO file.  My GO files is stock now.  I do not use unmenu at all.  I use stock gui too.

 

In looking at my /boot/packages/  directory, I see two version of the APC package,

apcupsd-3.14.10-i486-1_atv.tgz  (I think is just old junk left over and can be deleted)

apcupsd-3.14.10-i486-4_rlw.tgz  (I think this is the current one that the plugin is loading)

 

Yes.

I see the powerdown 1.02 in the packages directory.  There are also a bunch of unmenu packages in there.

 

Can somebody please confirm that I can just delete all the packages in the /boot/packages/ directory without harm, as it's my understanding that anything needed will just be downloaded again on a reboot?  I'd like to clean up the stuff from unmenu, get rid of the 2nd APC package.

 

Yes.  All required packages will be re-downloaded.

 

Once that is cleaned up, it's my understanding that I need to edit the APC plugin, so it calls for the new Powerdown 2.0 package.

 

I have the APC plugin in /boot/config/plugins/Apcupsd-3.14.10-i486-4_rlw-dl.fixed.plg

 

The APC plugin installs the following:

 

<FILE Name="/boot/packages/powerdown-1.02-noarch-unRAID.tgz" Run="CTRLALTDEL=YES upgradepkg --install-new">

<URL>http://unraid-powercontrol.googlecode.com/files/powerdown-1.02-noarch-unRAID.tgz</URL>

<MD5>10eff6bbb4a2f1428b4c57dbc292a2a5</MD5>

</FILE>

 

If I understand correctly, I need to edit this APC plugin by removing the above section and adding the following section from this thread:

 

<FILE Name="/boot/packages/powerdown-2.00-noarch-unRAID.tgz" Run="CTRLALTDEL=YES upgradepkg --install-new">

<URL>--no-check-certificate https://github.com/dlandon/unraid-snap/raw/master/powerdown-2.00-noarch-unRAID.tgz</URL>

</FILE>

 

Yes.  But use the new 2.01 version.

Because I use the APC plugin and it will install he new Powerdown, I do not need the new Powerdown.plg file at all  - Correct?

 

Correct.

Thanks for the help.

Link to comment

From the opening post: The directory /etc/rc.d/rc.unRAID.d/ is created by powerdown for script files to be executed on shutdown.

 

I've looked, but there is no such directory... do i have to create it myself?

 

root@Tower:/etc/rc.d# ls -l
total 204
lrwxrwxrwx 1 root root     4 Jan 31 18:49 rc.0 -> rc.6*
-rwxr-xr-x 1 root root  1282 Mar 26  2007 rc.4*
-rwxr-xr-x 1 root root  7707 Sep 22 16:43 rc.6*
-rwxr-xr-x 1 root root  2893 Apr 16  2011 rc.K*
-rwxr-xr-x 1 root root 13582 Jan 31 18:49 rc.M*
-rwxr-xr-x 1 root root 14841 Jan 31 18:49 rc.S*
-rwxr-xr-x 1 root root   552 Jul  9  2013 rc.acpid*
-rwxr-xr-x 1 root root  1230 Jan 31 18:49 rc.atalk*
-rwxr-xr-x 1 root root  1569 Dec 17 21:54 rc.avahidaemon*
-rwxr-xr-x 1 root root  1627 Dec 17 21:54 rc.avahidnsconfd*
-rwxr-xr-x 1 root root  1893 Dec 17 21:56 rc.fuse*
-rwxr-xr-x 1 root root 13230 Jan 31 18:49 rc.inet1*
-rw-r--r-- 1 root root  2619 Jan 31 18:49 rc.inet1.conf
-rwxr-xr-x 1 root root  5039 Jan 31 18:49 rc.inet2*
-rwxr-xr-x 1 root root   497 Sep 11  2003 rc.inetd*
-rw-r--r-- 1 root root  3781 May 18  2013 rc.ip_forward
-rwxr-xr-x 1 root root  2487 Dec 18 14:58 rc.libvirt*
-rwxr-xr-x 1 root root  1598 Jan 31 18:49 rc.local*
-rwxr-xr-x 1 root root   588 Jan 31 18:49 rc.local_shutdown*
-rwxr-xr-x 1 root root   168 Apr 23  2011 rc.loop*
-rwxr-xr-x 1 root root  1893 Jul  9  2013 rc.messagebus*
-rwxr-xr-x 1 root root  2449 May 21  2013 rc.nfsd*
-rwxr-xr-x 1 root root  1481 Oct 14 00:59 rc.ntpd*
-rwxr-xr-x 1 root root  1402 Oct 14  2008 rc.rpc*
-rwxr-xr-x 1 root root  4202 Jan 31 18:49 rc.samba*
-rw-r--r-- 1 root root  1170 Jul 12  2013 rc.saslauthd
-rw-r--r-- 1 root root  2895 Aug  7  2013 rc.serial
-rwxr-xr-x 1 root root  1991 Jan 31 18:49 rc.sshd*
-rwxr-xr-x 1 root root  1034 Jan 31 18:49 rc.syslog*
-rwxr-xr-x 1 root root  1740 Sep 11  1999 rc.sysvinit*
-rwxr-xr-x 1 root root  6366 Jan 17  2013 rc.udev*
-rwxr-xr-x 1 root root  1476 Oct 30 01:18 rc.xen-watchdog*
-rwxr-xr-x 1 root root  4597 Oct 30 01:18 rc.xencommons*
-rwxr-xr-x 1 root root  1703 Oct 30 01:18 rc.xend*
-rwxr-xr-x 1 root root 13729 Oct 30 01:18 rc.xendomains*

 

No.  The powerdown package will create it.  It doesn't look like the package is installed.

Link to comment

So could this command "xl shutdown -a" just be added to the powerdown script directly?

 

No.  You create a script and add it to the /etc/rc.d/rc.unRAID.d/ directory with a name Kxx where xx - 00-99 and it will be run on shutdown.  The reason this capability was added was to prevent lots of customization to powerdown.  Each user has unique needs.

Link to comment

I've placed it in /boot/Packages, but it doesnt seem to be reinstalled after a reboot then?

 

The package is not installed automatically from there.  On the OP is a plugin that you can put in /boot/config/plugins and the package will be installed on each boot.  If you have apcupsd, then that can be used to install the package.

Link to comment
No.  You create a script and add it to the /etc/rc.d/rc.unRAID.d/ directory with a name Kxx where xx - 00-99 and it will be run on shutdown.  The reason this capability was added was to prevent lots of customization to powerdown.  Each user has unique needs.

 

How do you place the script in /etc/rc.d/rc.unRAID.d/ on the flash drive?

Link to comment

I've placed it in /boot/Packages, but it doesnt seem to be reinstalled after a reboot then?

 

The package is not installed automatically from there.  On the OP is a plugin that you can put in /boot/config/plugins and the package will be installed on each boot.  If you have apcupsd, then that can be used to install the package.

Ok, but that means the /etc/rc.d/rc.unRAID.d/ and it's content is not persistent, and the scripts needed there have to be copied there on reboot, probably by using the go script?

Link to comment

No.  You create a script and add it to the /etc/rc.d/rc.unRAID.d/ directory with a name Kxx where xx - 00-99 and it will be run on shutdown.  The reason this capability was added was to prevent lots of customization to powerdown.  Each user has unique needs.

 

How do you place the script in /etc/rc.d/rc.unRAID.d/ on the flash drive?

 

I'd suggest that you create the script file you want to use in the /boot/custom/ directory of the flash drive.

 

Then you will need to add a line to the go file like this:

cp /boot/custom/k00 /etc/rc.d/rc.unRAID.d/k00

 

That way the file will be copied on each boot.

 

Link to comment

Having followed the discussions on flash device lifetime in one of the other boards, it did occur to me that powerdown is one of the the major causes for writes to /boot, storing the logfiles there (particularly for me, experiencing an average of two power outages a day).

 

I note that rc.unRAID includes a configuration variable which specifies the storage area for the logfiles and I could, therefore, redirect to the cache drive.  The only problem is that rc.unRAID is copied straight from the .tgz file to volatile storage - I guess that I need to set up a script with a sed command to alter the setting.

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.