Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-09 Thread Roger Price

On Sun, 9 Aug 2020, Todd Benivegna wrote:


upssched.conf (on Synology):
CMDSCRIPT /usr/syno/bin/synoups

upssched-cmd (on Synology):
I don’t see this file.  


The CMDSCRIPT declaration says that in a Synology box the file that NUT calls 
upssched-cmd is called /usr/syno/bin/synoups.  Could we see this file?  Thanks.



  What is "Safe mode"?  Is it complete power down?, or some sort of 
hibernation? 
  If it's not a complete power down, how is the hibernation powered?

  "When the Synology NAS enters Safe Mode, it stops all services and 
unmounts volumes in order to prevent data loss and shut down (halt for
  EDS14) safely when the UPS device runs out of power. By default, the 
system enters Safe Mode when the UPS device starts running low on power.
  You can also specify the amount of time before the Synology NAS enters 
Safe Mode when power failure occurs. However, if the UPS device reaches
  low battery before the specified time, the system enters Safe Mode 
immediately.

  In situations where the Synology NAS shuts down during Safe Mode, it will 
automatically turn on when power is restored if you have enabled the
  Restart automatically after a power failure option (located at Control Panel > 
Hardware & Power > General)."


This reads like typical sales literature.  I admit to being none the wiser even 
after reading it several times.


I gather this puts it in a state where it is ready for imminent power loss and 
won’t damage or lose any data.  


How long can this last?  Who supplies the power to the NAS during "Safe mode"?

Ok, I will comment that back out.  That won’t interfere with anything?  What 
user would it run as?  Will it have access to upsmon.conf?


Ubuntu very probably has user nut set up to run NUT and has the permissions set 
accordingly.  If it's possible to execute "command ps -elf | grep nut" in a 
running NAS you will see user nut in action.


Roger___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-09 Thread Charles Lepple
On Aug 9, 2020, at 3:18 PM, Todd Benivegna wrote:
> 
> Now they will spin-up on their own, but it takes 5-10 seconds.  My thought 
> was if they can’t communicate initially, they assume the server is dead and 
> shut down.  Would that make sense at all?  

Sorry to jump in the middle here, but this can occur in certain cases, when 
upsmon sees a server go dead *after seeing it go on battery*. See "DEADTIME" 
description: https://networkupstools.org/docs/man/upsmon.conf.html (defaults to 
15 seconds)
___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-09 Thread Todd Benivegna
> Since it's NUT in the NAS which is deciding to order the shutdown, it would be
> useful to see upsmon.conf, upssched.conf and upssched-cmd (or whatever 
> Synology
> use if anything) from the NAS to see what criteria they use.
upsmon.conf (on Synology):
RUN_AS_USER root
MONITOR ups@localhost 1 monuser secret master
MINSUPPLIES 1
SHUTDOWNCMD ""
NOTIFYCMD /usr/sbin/upssched
POLLFREQ 5
POLLFREQALERT 5
HOSTSYNC 15
DEADTIME 15
POWERDOWNFLAG /etc/killpower
NOTIFYFLAG ONLINE EXEC
NOTIFYFLAG ONBATT EXEC
NOTIFYFLAG LOWBATT EXEC
NOTIFYFLAG NOCOMM EXEC
NOTIFYFLAG COMMBAD IGNORE
NOTIFYFLAG COMMOK IGNORE
NOTIFYFLAG SHUTDOWN IGNORE
NOTIFYFLAG FSD EXEC
NOTIFYFLAG NOPARENT SYSLOG
RBWARNTIME 43200
NOCOMMWARNTIME 300
FINALDELAY 5

upssched.conf (on Synology):
CMDSCRIPT /usr/syno/bin/synoups
PIPEFN /var/run/upssched.pipe
LOCKFN /var/run/upssched.lock
AT ONLINE * EXECUTE online
AT ONLINE * CANCEL-TIMER fsd
AT LOWBATT * EXECUTE lowbatt
AT NOCOMM * EXECUTE nocomm
AT FSD * EXECUTE fsd
AT ONBATT * EXECUTE onbatt

upssched-cmd (on Synology):
I don’t see this file.  Here are all the files in the ups folder:
nutscan-usb.h  ups.conf  upsd.conf  upsd.users  upsmon.conf  upssched.conf
> What is "Safe mode"?  Is it complete power down?, or some sort of hibernation?
> If it's not a complete power down, how is the hibernation powered?
"When the Synology NAS enters Safe Mode, it stops all services and 
unmounts volumes in order to prevent data loss and shut down (halt for EDS14) 
safely when the UPS device runs out of power. By default, the system enters 
Safe Mode when the UPS device starts running low on power. You can also specify 
the amount of time before the Synology NAS enters Safe Mode when power failure 
occurs. However, if the UPS device reaches low battery before the specified 
time, the system enters Safe Mode immediately.

In situations where the Synology NAS shuts down during Safe Mode, it 
will automatically turn on when power is restored if you have enabled the 
Restart automatically after a power failure option (located at Control Panel > 
Hardware & Power > General)."

I gather this puts it in a state where it is ready for imminent power loss and 
won’t damage or lose any data.  I have enabled “Shutdown UPS when the system 
enter Safe Mode” and I have also enabled “Restart automatically after a power 
failure” as noted above.  I have always had these two options enabled.

Yesterday I recently disabled HDD Advanced Hibernation option as I thought that 
may interfere with NUT on my servers being able to communicate with the NUT 
server on the NAS, hence the immediate shutdown.  Now they will spin-up on 
their own, but it takes 5-10 seconds.  My thought was if they can’t communicate 
initially, they assume the server is dead and shut down.  Would that make sense 
at all?

HDD Hibernation essentially spins down the hard drives when there has been no 
activity.  I had it set at one hour; I have since disabled that setting.  I 
have not ever set the Synology itself to go to sleep or to auto-shutdown.

From the Synology support site:
You can specify the period of time hard disks remain idle before 
entering HDD hibernation mode. During HDD hibernation, hard disks stop 
spinning, reducing power consumption and extending the lifespan of hard disks. 
You can specify different periods of time for internal hard disks and external 
eSATA/USB hard disks.

Phase 1: HDDs power down after a period of inactivity (idle time). You 
may go to DSM > Control Panel > Hardware & Power > HDD Hibernation to configure 
the length of inactivity for the HDDs to enter hibernation.

Phase 2: Advanced Hibernation/Deep Sleep will be implemented for the 
HDDs to further reduce power consumption. You may go to DSM > Control Panel > 
Hardware & Power > HDD Hibernation to enable advanced HDD hibernation.

> You should remove line 1 : RUN_AS_USER nut
Ok, I will comment that back out.  That won’t interfere with anything?  What 
user would it run as?  Will it have access to upsmon.conf?


Thanks,

Todd

--
Todd Benivegna // t...@benivegna.com
On Aug 9, 2020, 3:07 AM -0400, Roger Price , wrote:
> On Fri, 7 Aug 2020, Todd Benivegna wrote:
>
> Hello Todd, sorry for the delay replying, I was away for a while. It's ok to
> post configuration files in this list if blank lines and comments are removed.
>
> > On the Synology (I didn’t edit any of these files):
> > ups.conf:  https://hastebin.com/dedereqizi.shell
>
> pollinterval = 5
> [ups]
> driver = usbhid-ups
> port = auto
>
> > upsd.conf:  https://hastebin.com/pupeseweda.css
>
> LISTEN 192.168.1.70
> LISTEN 2601:cf:8200:43d0:211:32ff:fe63:60d7
> LISTEN fe80::211:32ff:fe63:60d7
> LISTEN 127.0.0.1
> LISTEN ::1
>
> > upsd.users:  https://hastebin.com/ocenamecex.cs
>
> [monuser]
> password = secret
> upsmon master
>
> Since it's NUT in the NAS which is deciding to order the shutdown, it would be
> useful to see upsmon.conf, upssched.conf and upssched-cmd (or whatever 
> 

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-09 Thread Roger Price

On Sat, 8 Aug 2020, Todd Benivegna wrote:

I just ran a manual test, killing power and see what happens.  I set the 
Synology “Time before DiskStation goes into Safe mode”


What is "Safe mode"?  Is it complete power down?, or some sort of hibernation? 
If it's not a complete power down, how is the hibernation powered?


to 5 minutes so I didn’t have to wait like an hour until it powered 
down.  Here is the log:


https://hastebin.com/ovuwilufeb.sql

 Aug  8 14:31:01 proton upsmon[1561]: UPS ups@192.168.1.70 on battery
 Aug  8 14:36:01 proton upsmon[1561]: UPS ups@192.168.1.70: forced shutdown in 
progress
 Aug  8 14:36:01 proton upsmon[1561]: Executing automatic power-fail shutdown
 Aug  8 14:36:01 proton upsmon[1561]: Auto logout and shutdown proceeding
 Aug  8 14:36:06 proton upsmon.conf: UPS status [FSD OB DISCHRG]:85

Notice the effect of the upsmon FINALDELAY 5 declaration in the last line. 
Status [FSD OB DISCHRG] is what one would expect in a slave.  I see the UPS has 
lost 15% of it's charge in 5 minutes.


Everything appeared to be normal; the servers powered off and the Synology 
went into safe mode.  Power was then cut to the Synology and my UPS turned 
off.  


I assume power was cut to the Synology because the UPS disconnected it's power 
outlets (often referred to as "UPS turns off").


Could it be something like the Synology drives were in hibernation and the 
Synology wasn’t responding (was probably coming out of hibernation - it takes 
maybe 5-10 seconds) and NUT thought the server was dead and shut everything 
down?  On that note, I did have the Synology set to hibernate/spin down the 
disks after 1 hour, but just disabled that just in case; will be on all the 
time now.  You think that was possibly the problem?


It would be interesting to see what the Synology log says for hibernation, upsd 
and upsmon for a) a manual test, and b) a real wall power failure.


Roger___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-09 Thread Roger Price

On Sat, 8 Aug 2020, Todd Benivegna wrote:


Updated upsmon.conf:  https://hastebin.com/jisinaquso.pl


You should remove line 1 : RUN_AS_USER nut

Lines 12-21: it would be possible to display more information, such as the UPS 
status, but this requires pointing NOTIFYCMD to upssched and then using 
a upssched-cmd script to display details of each event.


No, the Synology and the three servers are all on the one UPS (also my switch 
and spare monitor). All these are super low power devices (two Intel NUCs and 
a Raspberry Pi) so at idle the draw like 50-75w and at max load it’s like 
100-150w tops.  UPS is rated for 300w.


In that case, nothing stops you from using one of the "p" Ubuntu machines as the 
master with the Synology NAS as a slave. See 
https://community.synology.com/enu/forum/1/post/119995


Roger___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-09 Thread Roger Price

On Fri, 7 Aug 2020, Todd Benivegna wrote:


I don’t think I am able to run that script.  If you can, I wouldn’t know how.


You have to activate SSH on the NAS, log in to the NAS as root (admin) and 
create a temporary directory.  Based on what I read on a french language site, 
the commands are:


 mkdir /volume1/tmp
 cd /volume1/tmp

You can then install the script and run it:

 wget http://rogerprice.org/NUT/nut-report
 ./nut-report

Roger___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)

2020-08-09 Thread Roger Price

On Fri, 7 Aug 2020, Todd Benivegna wrote:

Hello Todd, sorry for the delay replying, I was away for a while. It's ok to 
post configuration files in this list if blank lines and comments are removed.



On the Synology (I didn’t edit any of these files):
ups.conf:  https://hastebin.com/dedereqizi.shell


pollinterval = 5
[ups]
driver = usbhid-ups
port = auto


upsd.conf:  https://hastebin.com/pupeseweda.css


LISTEN 192.168.1.70
LISTEN 2601:cf:8200:43d0:211:32ff:fe63:60d7
LISTEN fe80::211:32ff:fe63:60d7
LISTEN 127.0.0.1
LISTEN ::1


upsd.users:  https://hastebin.com/ocenamecex.cs


[monuser]
password = secret
upsmon master

Since it's NUT in the NAS which is deciding to order the shutdown, it would be 
useful to see upsmon.conf, upssched.conf and upssched-cmd (or whatever Synology 
use if anything) from the NAS to see what criteria they use.


Roger___
Nut-upsuser mailing list
Nut-upsuser@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser