NUT is not shutdown UPS

Bug #839490 reported by Dmitriy Altuhov
20
This bug affects 3 people
Affects Status Importance Assigned to Milestone
nut (Ubuntu)
Confirmed
Medium
Unassigned

Bug Description

Description: Ubuntu 11.04
Release: 11.04
nut version 2.6.0-1ubuntu3

Problem:
upsmon working under nut user (not root). nut user can't create file /etc/killpower

Example:
1) Mains out. UPS on battery
2) Battery low. set FSD
3) upsmon executes shutdowncmd but fails to create /etc/killpower
4) /etc/init.d/halt executes /etc/init.d/ups-monitor poweroff
5) /etc/init.d/ups-monitor poweroff executes upsmon -K to check /etc/killpower (but file does not exist)
6) not sending shutdown command to UPS (upsdrvctl shutdown is not executed)
7) system halted, but UPS stays on battery
8) mains come back, ups going on mains, but load is not switched off/on
9) PC stays OFF (need manual start)

Revision history for this message
Dmitriy Altuhov (altuhovsu) wrote :

Temp. solution:

1) rm -f /etc/killpower
2) chmod -R g+w /etc/nut/
3) edit upsmon.conf and change POWERDOWNFLAG /etc/nut/killpower
4) service nut restart

After this all fine! UPS shutdowns correctly. PC starts up when UPS goes on.

Robie Basak (racb)
Changed in nut (Ubuntu):
importance: Undecided → Medium
description: updated
Changed in nut (Ubuntu):
status: New → Confirmed
Revision history for this message
Arnaud Quette (aquette) wrote : Re: [Bug 839490] [NEW] NUT is not shutdown UPS

Hi Dmitriy,

2011/9/2 Dmitriy Altuhov <email address hidden>

> Public bug reported:
>
> Description: Ubuntu 11.04
> Release: 11.04
> nut version 2.6.0-1ubuntu3
>
> Problem:
> upsmon working under nut user (not root). nut user can't create file
> /etc/killpower
>

upsmon forks 2 instances:
- 1 running unprivileged (ie "nut" user), listening on the network interface
- 1 running with "root" privileges to be able to launch
upsmon.conf->SHUTDOWNCMD

have a 2nd look at your processes list.

> Example:
> 1) Mains out. UPS on battery
> 2) Battery low. set FSD
> 3) upsmon executes shutdowncmd but fails to create /etc/killpower
> 4) /etc/init.d/halt executes /etc/init.d/ups-monitor poweroff
> 5) /etc/init.d/ups-monitor poweroff executes upsmon -K to check
> /etc/killpower (but file does not exist)
> 6) not sending shutdown command to UPS (upsdrvctl shutdown is not executed)
> 7) system halted, but UPS stays on battery
> 8) mains come back, ups going on mains, but load is not switched off/on
> 9) PC stay OFF (need manual start)
>

I'll have to have another look, but I recently made a full test with 2.6.1
and everything was fine.

I need more info on your setup, ie:
- your .conf files (trimmed of passwords and sensitive info)
- your ups name and type

Moreover, have you checked your BIOS for the power setting (ie "power on
after a power failure" or whatever its name is)?

cheers,
Arnaud
--
Linux / Unix Expert R&D - Eaton - http://powerquality.eaton.com
Network UPS Tools (NUT) Project Leader - http://www.networkupstools.org/
Debian Developer - http://www.debian.org
Free Software Developer - http://arnaud.quette.free.fr/

Revision history for this message
Dmitriy Altuhov (altuhovsu) wrote :

I have nut version 2.6.0-1ubuntu3

"upsmon forks 2 instances" - yes, I have they. But why killpower is setting by unprivileded instance ("nut")? I confirm, SHUTDOWNCMD is launched proper (by privileged instance).

I have 3 servers on Ubuntu 11.04 with UPS APC on each. Config files,daemons are identical. Differents only in UPS. APC SmartUPS 750i (SUA750I), BackUPS CS 500 (BK500EI), BackUPS ES 550. All connected with driver = usbhid-ups.

So, many info:

root@gwlin:/etc/nut# ps faux | grep ups
root 231 0.0 0.1 2412 556 ? S Sep03 0:00 upstart-udev-bridge --daemon
root 668 0.0 0.0 2412 468 ? S Sep03 0:00 upstart-socket-bridge --daemon
root 12368 0.0 0.1 5304 852 pts/1 S+ 15:22 0:00 \_ grep --color=auto ups
nut 2510 0.0 0.0 2196 444 ? Ss Sep03 5:20 /lib/nut/usbhid-ups -a ippon
nut 2512 0.0 0.0 2128 456 ? Ss Sep03 0:53 /sbin/upsd
root 2514 0.0 0.1 2108 568 ? Ss Sep03 0:00 /sbin/upsmon
nut 2516 0.0 0.1 2108 576 ? S Sep03 0:30 \_ /sbin/upsmon

root@gwlin:/etc/nut# cat /etc/nut/nut.conf | egrep -v "(^#.*|^$)"
MODE=netserver

root@gwlin:/etc/nut# cat /etc/nut/ups.conf | egrep -v "(^#.*|^$)"
[ippon]
driver = usbhid-ups
port = auto

root@gwlin:/etc/nut# cat /etc/nut/upsd.conf | egrep -v "(^#.*|^$)"
LISTEN 127.0.0.1
LISTEN 10.0.0.1

root@gwlin:/etc/nut# cat /etc/nut/upsd.users | egrep -v "(^#.*|^$)"
[local_mon]
password = XXXXXX
upsmon master
[server_mon]
password = XXXXXX
upsmon slave
[root]
password = XXXXXX
actions = SET
instcmds = ALL

root@gwlin:/etc/nut# cat /etc/nut/upsmon.conf | egrep -v "(^#.*|^$)"
MONITOR ippon@localhost 1 local_mon XXXXXX master
MINSUPPLIES 1
SHUTDOWNCMD "/sbin/shutdown -h +0"
NOTIFYCMD /usr/local/bin/upsmail
POLLFREQ 5
POLLFREQALERT 5
HOSTSYNC 15
DEADTIME 15
POWERDOWNFLAG /etc/nut/killpower
NOTIFYFLAG ONLINE EXEC+SYSLOG
NOTIFYFLAG ONBATT EXEC+SYSLOG
NOTIFYFLAG LOWBATT EXEC+SYSLOG
NOTIFYFLAG FSD EXEC+SYSLOG
NOTIFYFLAG COMMOK EXEC+SYSLOG
NOTIFYFLAG COMMBAD EXEC+SYSLOG
NOTIFYFLAG SHUTDOWN EXEC+SYSLOG
NOTIFYFLAG REPLBATT EXEC+SYSLOG
NOTIFYFLAG NOCOMM EXEC+SYSLOG
RBWARNTIME 43200
NOCOMMWARNTIME 300
FINALDELAY 5

root@gwlin:/etc/default# cat ./halt | egrep -v "(^#.*|^$)"
HALT=poweroff

root@gwlin:/etc/init.d# upsmon -K
Network UPS Tools upsmon 2.6.0
UPS: ippon@localhost (master) (power value 1)
Using power down flag file /etc/nut/killpower
Power down flag is not set

Revision history for this message
Anatoly Zapadinsky (zapadinsky) wrote :

It doesn't work on 16.04 and 17.10 for different reason. The file /etc/killpower is created but the script /etc/init.d/halt have never executed on 16.04 and isn't present at all on 17.10. No one is calling nut-client and nut-server with the "poweroff" parameter. I've tested it on vm with debug print to serial port. I don't get how it is supposed to work.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.