Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 577506

Summary: sys-power/nut-2.7.3 nut-server.service requires "Requires=nut-driver.service" string
Product: Gentoo Linux Reporter: RedEyedMan <kegalym2>
Component: Current packagesAssignee: Robin Johnson <robbat2>
Status: UNCONFIRMED ---    
Severity: normal CC: prometheanfire, rich0
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description RedEyedMan 2016-03-15 22:48:49 UTC
Hi!

It may be important for systemd users:

nut-2.7.3 works fine with Requires=nut-driver.service string in the nut-server.service file. It comes with commented string.

Otherwise systemd says nut-drivers service is unneeded anymore and finishes it.

I looked at the source of nut-2.7.4 and it has correct nut-server.service


Steps to reproduce:
1. Obtain >=sys-apps/systemd-228-r1
2. Install nut-2.7.4 
3. Run systemctl restart nut-driver nut-server
4. Check the UPS by upsc ups_name

#systemctl status nut-driver nut-server
● nut-driver.service - Network UPS Tools - power device driver controller
   Loaded: loaded (/etc/systemd/system/nut-driver.service; static; vendor preset: enabled)
   Active: inactive (dead) since Wed 2016-03-16 04:39:46 ALMT; 26s ago
  Process: 6647 ExecStop=/usr/sbin/upsdrvctl stop (code=exited, status=0/SUCCESS)
  Process: 6639 ExecStart=/usr/sbin/upsdrvctl start (code=exited, status=0/SUCCESS)
 Main PID: 6646 (code=exited, status=0/SUCCESS)

Mar 16 04:39:44 gentoo upsdrvctl[6639]: No values provided for battery high/low voltages in ups.conf
Mar 16 04:39:44 gentoo upsdrvctl[6639]: Using 'guestimation' (low: 10.400000, high: 13.000000)!
Mar 16 04:39:44 gentoo upsdrvctl[6639]: Battery runtime will not be calculated (runtimecal not set)
Mar 16 04:39:44 gentoo blazer_usb[6646]: Startup successful
Mar 16 04:39:44 gentoo systemd[1]: Started Network UPS Tools - power device driver controller.
Mar 16 04:39:44 gentoo systemd[1]: nut-driver.service: Unit not needed anymore. Stopping.
Mar 16 04:39:44 gentoo upsdrvctl[6639]: Network UPS Tools - UPS driver controller 2.7.3
Mar 16 04:39:44 gentoo systemd[1]: Stopping Network UPS Tools - power device driver controller...
Mar 16 04:39:44 gentoo upsdrvctl[6647]: Network UPS Tools - UPS driver controller 2.7.3
Mar 16 04:39:46 gentoo systemd[1]: Stopped Network UPS Tools - power device driver controller.

● nut-server.service - Network UPS Tools - power devices information server
   Loaded: loaded (/usr/lib/systemd/system/nut-server.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2016-03-16 04:39:46 ALMT; 26s ago
  Process: 6650 ExecStart=/usr/sbin/upsd (code=exited, status=0/SUCCESS)
 Main PID: 6651 (upsd)
   CGroup: /system.slice/nut-server.service
           └─6651 /usr/sbin/upsd

Mar 16 04:39:46 gentoo upsd[6650]: ACL in upsd.conf is no longer supported - switch to LISTEN
Mar 16 04:39:46 gentoo upsd[6650]: ACL in upsd.conf is no longer supported - switch to LISTEN
Mar 16 04:39:46 gentoo upsd[6650]: ACCEPT in upsd.conf is no longer supported - switch to LISTEN
Mar 16 04:39:46 gentoo upsd[6650]: REJECT in upsd.conf is no longer supported - switch to LISTEN
Mar 16 04:39:46 gentoo upsd[6650]: listening on 127.0.0.1 port 3493
Mar 16 04:39:46 gentoo systemd[1]: Started Network UPS Tools - power devices information server.
Mar 16 04:39:46 gentoo upsd[6650]: Can't connect to UPS [volta] (blazer_usb-volta): No such file or directory
Mar 16 04:39:46 gentoo upsd[6650]: allowfrom in upsd.users is no longer used
Mar 16 04:39:46 gentoo upsd[6651]: Startup successful
Mar 16 04:39:48 gentoo upsd[6651]: User galym@127.0.0.1 logged into UPS [volta]

And after uncommenting mentioned string I restarted it:

ed Mar 16_04:43 AM#systemctl restart nut-driver nut-server
Wed Mar 16_04:43 AM#systemctl status nut-driver nut-server
● nut-driver.service - Network UPS Tools - power device driver controller
   Loaded: loaded (/etc/systemd/system/nut-driver.service; static; vendor preset: enabled)
   Active: active (running) since Wed 2016-03-16 04:43:26 ALMT; 10s ago
  Process: 6689 ExecStart=/usr/sbin/upsdrvctl start (code=exited, status=0/SUCCESS)
 Main PID: 6691 (blazer_usb)
   CGroup: /system.slice/nut-driver.service
           └─6691 /lib64/nut/blazer_usb -a volta

Mar 16 04:43:24 gentoo systemd[1]: nut-driver.service: Failed to enqueue stop job, ignoring: Transaction is destructive.
Mar 16 04:43:24 gentoo systemd[1]: Starting Network UPS Tools - power device driver controller...
Mar 16 04:43:25 gentoo upsdrvctl[6689]: Supported UPS detected with mustek protocol
Mar 16 04:43:26 gentoo upsdrvctl[6689]: Vendor information unavailable
Mar 16 04:43:26 gentoo upsdrvctl[6689]: No values provided for battery high/low voltages in ups.conf
Mar 16 04:43:26 gentoo upsdrvctl[6689]: Using 'guestimation' (low: 10.400000, high: 13.000000)!
Mar 16 04:43:26 gentoo upsdrvctl[6689]: Battery runtime will not be calculated (runtimecal not set)
Mar 16 04:43:26 gentoo blazer_usb[6691]: Startup successful
Mar 16 04:43:26 gentoo systemd[1]: Started Network UPS Tools - power device driver controller.
Mar 16 04:43:27 gentoo upsdrvctl[6689]: Network UPS Tools - UPS driver controller 2.7.3

● nut-server.service - Network UPS Tools - power devices information server
   Loaded: loaded (/usr/lib/systemd/system/nut-server.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2016-03-16 04:43:26 ALMT; 10s ago
  Process: 6692 ExecStart=/usr/sbin/upsd (code=exited, status=0/SUCCESS)
 Main PID: 6693 (upsd)
   CGroup: /system.slice/nut-server.service
           └─6693 /usr/sbin/upsd

Mar 16 04:43:27 gentoo upsd[6692]: fopen /var/lib/nut/upsd.pid: No such file or directory
Mar 16 04:43:27 gentoo upsd[6692]: ACL in upsd.conf is no longer supported - switch to LISTEN
Mar 16 04:43:27 gentoo upsd[6692]: ACL in upsd.conf is no longer supported - switch to LISTEN
Mar 16 04:43:27 gentoo upsd[6692]: ACL in upsd.conf is no longer supported - switch to LISTEN
Mar 16 04:43:27 gentoo upsd[6692]: ACCEPT in upsd.conf is no longer supported - switch to LISTEN
Mar 16 04:43:27 gentoo upsd[6692]: REJECT in upsd.conf is no longer supported - switch to LISTEN
Mar 16 04:43:27 gentoo upsd[6692]: listening on 127.0.0.1 port 3493
Mar 16 04:43:27 gentoo upsd[6692]: Connected to UPS [volta]: blazer_usb-volta
Mar 16 04:43:27 gentoo upsd[6692]: allowfrom in upsd.users is no longer used
Mar 16 04:43:28 gentoo upsd[6693]: User galym@127.0.0.1 logged into UPS [volta]

Now it works.
Comment 1 Richard Freeman gentoo-dev 2016-12-21 14:41:23 UTC
This appears to be correct.

nut-driver is set to stop itself if it is unneeded, and nut-server says it doesn't need it, so nut-driver happily commits suicide.

Adding this to a drop-in fixes the issue:
[Unit]
Requires=nut-driver.service

It worked fine in 2.6.5, and it looks like 2.7.4 fixes it as well...