Rob Groner
2015-Jul-07 20:12 UTC
[Nut-upsuser] upsd not starting sometimes (Porteus 3.1, nut 2.7.2)
I am running tests on my system and UPS, making sure that it is reliably able to come up, detect power loss, shutdown safely, and then come back up when the power returns. It does that MOST of the time. However, a significant part of the time, the system comes up, and then doesn't respond to loss of power. Doing some checking, I find that the reason is because upsd never started. Capturing its output, I see that it says : Fatal error: A previous upsd instance is already running! Either stop the previous instance first, or use the 'reload' command. Again note that this only happens SOME of the time....all other times, all 3 things get started that are supposed to (upsdrvctl, upsd, upsmon). Even when upsd fails, the other two services start. This is being run in Porteus 3.1 with nut 2.7.2. I'm calling my script from /etc/rc.d/rc.local. This script contains: #!/bin/sh /usr/local/ups/sbin/upsdrvctl -u ups start sleep 2 /usr/local/ups/sbin/upsd -u ups sleep 2 /usr/local/ups/sbin/upsmon -u ups I checked that upsd wasn't getting started from anywhere else, and I looked in the NUT code to see if I could figure out why it thought upsd was already started, but nothing was obvious. Does anyone have any other suggestions for tracking down why upsd errors out like that sometimes? Sincerely, Rob Groner Software Engineer RTD Embedded Technologies, Inc. ISO 9001 and AS9100 Certified Ph: 814-234-8087 www.rtd.com<http://www.rtd.com/> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20150707/1ee9ea1b/attachment.html>
Charles Lepple
2015-Jul-08 00:25 UTC
[Nut-upsuser] upsd not starting sometimes (Porteus 3.1, nut 2.7.2)
On Jul 7, 2015, at 4:12 PM, Rob Groner <rgroner at RTD.com> wrote:> It does that MOST of the time. However, a significant part of the time, the system comes up, and then doesn?t respond to loss of power. Doing some checking, I find that the reason is because upsd never started. Capturing its output, I see that it says : > > Fatal error: A previous upsd instance is already running! > Either stop the previous instance first, or use the 'reload' command.What might be happening is that the PID file is left over from the last test, and another process got that PID instead. Due to history and conflicting requirements, the path selection is not as simple as it could be. From ./configure --help: --with-statepath=PATH path for ups state files (/var/state/ups) --with-altpidpath=PATH path for driver/upsd .pid files (<statepath>) [...] --with-pidpath=PATH path for .pid files (/var/run) You might not want to use the default for --with-altpidpath: /var/state/* is not generally cleared at boot time, whereas /var/run is either wiped or mounted on a RAM filesystem. However, you might want the statepath protected - Debian uses the following: $ ls -ld /var/run/nut drwxrwx--- 2 root nut 60 Jun 24 17:13 /var/run/nut -- Charles Lepple clepple at gmail
Roger Price
2015-Jul-08 08:53 UTC
[Nut-upsuser] upsd not starting sometimes (Porteus 3.1, nut 2.7.2)
On Tue, 7 Jul 2015, Rob Groner wrote:> This is being run in Porteus 3.1 with nut 2.7.2.My first thought was that this is more systemd wierdness, but I believe that Porteus is based on Slackware which doesn't use systemd - is that correct? Roger
Rob Groner
2015-Jul-08 12:54 UTC
[Nut-upsuser] upsd not starting sometimes (Porteus 3.1, nut 2.7.2)
Correct, Porteus is based on Debian. I'm trying Charles' advice, initially just by making sure the /var/state dir is empty on boot. That's pretty easy to do with Porteus since you can prevent any permanent changes to the file system. Sincerely, Rob Groner Software Engineer RTD Embedded Technologies, Inc. ISO 9001 and AS9100 Certified Ph: 814-234-8087 www.rtd.com -----Original Message----- From: Nut-upsuser [mailto:nut-upsuser-bounces+rgroner=rtd.com at lists.alioth.debian.org] On Behalf Of Roger Price Sent: Wednesday, July 08, 2015 4:54 AM To: nut-upsuser Mailing List Subject: Re: [Nut-upsuser] upsd not starting sometimes (Porteus 3.1, nut 2.7.2) On Tue, 7 Jul 2015, Rob Groner wrote:> This is being run in Porteus 3.1 with nut 2.7.2.My first thought was that this is more systemd wierdness, but I believe that Porteus is based on Slackware which doesn't use systemd - is that correct? Roger _______________________________________________ Nut-upsuser mailing list Nut-upsuser at lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser
Rob Groner
2015-Jul-08 17:50 UTC
[Nut-upsuser] upsd not starting sometimes (Porteus 3.1, nut 2.7.2)
That seems to have fixed it...I've run it twice now through our tests and no recurrence of the problem. So I'll use the --with-altpidpath configure option to move it to /var/run instead of /var/state. Thanks! Sincerely, Rob Groner Software Engineer RTD Embedded Technologies, Inc. ISO 9001 and AS9100 Certified Ph: 814-234-8087 www.rtd.com -----Original Message----- From: Charles Lepple [mailto:clepple at gmail.com] Sent: Tuesday, July 07, 2015 8:25 PM To: Rob Groner Cc: nut-upsuser Mailing List Subject: Re: [Nut-upsuser] upsd not starting sometimes (Porteus 3.1, nut 2.7.2) On Jul 7, 2015, at 4:12 PM, Rob Groner <rgroner at RTD.com> wrote:> It does that MOST of the time. However, a significant part of the time, the system comes up, and then doesn't respond to loss of power. Doing some checking, I find that the reason is because upsd never started. Capturing its output, I see that it says : > > Fatal error: A previous upsd instance is already running! > Either stop the previous instance first, or use the 'reload' command.What might be happening is that the PID file is left over from the last test, and another process got that PID instead. Due to history and conflicting requirements, the path selection is not as simple as it could be. From ./configure --help: --with-statepath=PATH path for ups state files (/var/state/ups) --with-altpidpath=PATH path for driver/upsd .pid files (<statepath>) [...] --with-pidpath=PATH path for .pid files (/var/run) You might not want to use the default for --with-altpidpath: /var/state/* is not generally cleared at boot time, whereas /var/run is either wiped or mounted on a RAM filesystem. However, you might want the statepath protected - Debian uses the following: $ ls -ld /var/run/nut drwxrwx--- 2 root nut 60 Jun 24 17:13 /var/run/nut -- Charles Lepple clepple at gmail