Bug 193058 - "service ups restart" fails when MODEL=upsdrvctl
Summary: "service ups restart" fails when MODEL=upsdrvctl
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: nut
Version: 12
Hardware: i686
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Michal Hlavinka
QA Contact: Brian Brock
URL:
Whiteboard:
: 248263 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-05-24 20:19 UTC by Jordan Russell
Modified: 2010-09-07 12:24 UTC (History)
1 user (show)

Fixed In Version: nut-2.4.3-5.fc12
Clone Of:
Environment:
Last Closed: 2010-09-07 12:24:13 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Jordan Russell 2006-05-24 20:19:43 UTC
Description of problem:
When MODEL is set to "upsdrvctl" in /etc/sysconfig/ups, "service ups restart"
does not properly wait until the currently running driver has completely shut
down, causing a "/dev/ttyS0 is locked by another process" error message when it
tries to restart the driver.

Version-Release number of selected component (if applicable):
nut-2.0.3-0.1.fc5

How reproducible:
Always

Steps to Reproduce:
1. Set MODEL=upsdrvctl in /etc/sysconfig/ups
2. Configure your UPS in /etc/ups/ups.conf
3. Run "service start ups"
4. Run "service restart ups"
  
Actual results:

# service ups start
Starting upsdrvctl: Network UPS Tools - UPS driver controller 2.0.3
Network UPS Tools (version 2.0.3) - APC Smart protocol driver
        Driver version 1.99.7, command table version 2.0
Detected Smart-UPS SC1000 [xxxxx] on /dev/ttyS0
                                                           [  OK  ]
Starting upsd: Network UPS Tools upsd 2.0.3
Connected to UPS [ups]: apcsmart-ttyS0
Synchronizing.....done
                                                           [  OK  ]
Starting UPS monitor (master): Network UPS Tools upsmon 2.0.3
UPS: ups@localhost (master) (power value 1)
Using power down flag file /etc/killpower
                                                           [  OK  ]


# service ups restart
Stopping UPS monitor:                                      [  OK  ]
Stopping upsd:                                             [  OK  ]
Shutting down upsdrvctl: Network UPS Tools - UPS driver controller 2.0.3
Stopping UPS: ups

Starting upsdrvctl: Network UPS Tools - UPS driver controller 2.0.3
Network UPS Tools (version 2.0.3) - APC Smart protocol driver
        Driver version 1.99.7, command table version 2.0
/dev/ttyS0 is locked by another process
Driver failed to start (exit status=1)
                                                           [FAILED]
[...more failures, snipped...]


Expected results:
It shouldn't try to restart the driver until the previously running driver has
relinquished control of the serial port.

Additional info:
Adding a "sleep 2" after "/sbin/upsdrvctl stop" in /etc/init.d/ups helps, but I
assume that isn't the "right" fix for this. (upsdrvctl should probably wait
until the driver process has terminated before returning?)

Comment 1 Jordan Russell 2007-06-25 05:47:23 UTC
Still happens in F7's nut-2.0.5-3 package.

Comment 2 Tomas Smetana 2007-08-15 11:45:21 UTC
*** Bug 248263 has been marked as a duplicate of this bug. ***

Comment 3 Michal Jaegermann 2007-08-18 18:20:44 UTC
An update to nut-2.0.5-4 is still broken.  After 'service ups restart' I got:
....
Network UPS Tools - Best UPS driver 1.03 (2.0.5)
/dev/ttyS0 is locked by another process
Driver failed to start (exit status=1)
                                                           [FAILED]
.....

and 'service ups status' shows "bestups is stopped".

A workaround described in bug 248263 is still required.  It works for
that particular case.

At least user "nut" is now in "uucp" group so it has a required
access to a monitoring serial port.

Comment 4 Tomas Smetana 2007-08-31 14:44:17 UTC
I have added the sleep in init script in 2.0.5-5, but I don't consider this to
be a hack...  Please try to update when the nev version gets released.

Comment 5 Michal Jaegermann 2007-09-24 15:05:45 UTC
Worksforme; only I have no idea if a delay value you added is ok
for other UPS makes.  No problems here as it was derived experimentally
for this particular setup.

Comment 6 Jordan Russell 2007-11-09 07:06:16 UTC
(In reply to comment #4)
> I have added the sleep in init script in 2.0.5-5,

nut-2.2.0-3.fc8 seems to be missing the sleep. Reopening.

> but I don't consider this to be a hack...

With sufficiently high load, it could take longer than X seconds for the process
to exit.

Comment 7 Bug Zapper 2008-11-26 06:58:13 UTC
This message is a reminder that Fedora 8 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 8.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '8'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 8's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 8 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 8 Bug Zapper 2009-01-09 06:57:10 UTC
Fedora 8 changed to end-of-life (EOL) status on 2009-01-07. Fedora 8 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 9 Jordan Russell 2010-04-11 20:19:20 UTC
This still exists in Fedora 12's nut-2.4.3-3.fc12.i686

(In reply to comment #4)
> I have added the sleep in init script in 2.0.5-5,

...and I still don't see a "sleep" in the init script.

Comment 10 Michal Hlavinka 2010-07-20 14:15:57 UTC
hi, I can't reproduce this bug in my environment, but I've patched to upsdrvctl to wait for all drivers to terminate which (I believe) should fix your problem. Could you please test following packages:

http://kojipkgs.fedoraproject.org/scratch/mhlavink/task_2331096/

thanks

Comment 11 Michal Hlavinka 2010-07-26 11:22:16 UTC
No more need to test packages mentioned above.

I've discussed this with upstream. It'd be wrong behaviour waiting for ups driver when nut is stopping (not restarting), because it should stop quite quickly and delaying shutdown process can be harmful. Better approach is sleep in restart between stop and start phases. I've added a few lines in restart function that waits up to 5 seconds for upsdriver to terminate with 1s steps so it won't delay too much if everything is ok.

Comment 12 Fedora Update System 2010-07-26 15:35:03 UTC
nut-2.4.3-5.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/nut-2.4.3-5.fc12

Comment 13 Fedora Update System 2010-07-26 15:35:22 UTC
nut-2.4.3-5.fc13 has been submitted as an update for Fedora 13.
http://admin.fedoraproject.org/updates/nut-2.4.3-5.fc13

Comment 14 Fedora Update System 2010-07-26 15:35:44 UTC
nut-2.2.0-7.el5 has been submitted as an update for Fedora EPEL 5.
http://admin.fedoraproject.org/updates/nut-2.2.0-7.el5

Comment 15 Fedora Update System 2010-08-12 04:07:47 UTC
nut-2.4.3-5.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 16 Fedora Update System 2010-08-12 04:08:53 UTC
nut-2.4.3-5.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 17 Fedora Update System 2010-08-19 21:58:27 UTC
nut-2.2.0-7.el5 has been pushed to the Fedora EPEL 5 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.