networkupstools / nut

The Network UPS Tools repository. UPS management protocol Informational RFC 9271 published by IETF at https://www.rfc-editor.org/info/rfc9271 Please star NUT on GitHub, this helps with sponsorships!
https://networkupstools.org/
Other
2.07k stars 351 forks source link

Question about building on Debian - Do we have to build nut-client and nut-server seperately from the main tools? #2128

Open Jsalas424 opened 1 year ago

Jsalas424 commented 1 year ago

Please forgive me if this is an elementary question, I don't compile all that often. I am trying to resolve issues https://github.com/networkupstools/nut/issues/2001 and https://github.com/networkupstools/nut/issues/2121 by running the latest NUT build.

I easily followed the wiki instructions here, but don't have the nut-client service I'm used to starting to get this going.

As far as I can tell, I succesfully compiled:

user@server:/tmp/nut# upsc -V
Network UPS Tools upscmd 2.8.0-2727-g37289c117

After moving my old config files back into /etc/nut/ and running /usr/sbin/upsdrvsvcctl reconfigure, I'm able to see my UPS

user@server:~# lsusb
Bus 002 Device 002: ID 0764:0501 Cyber Power System, Inc. CP1500 AVR UPS

user@server:~# upsdrvsvcctl -D start
=== The currently defined service units are:
Starting nut-driver@Power.service ...

user@server:~# /lib/nut/usbhid-ups -a Power  -DD
Network UPS Tools - Generic HID driver 0.52 (2.8.0-2727-g37289c117)
USB communication driver (libusb 0.1) 0.45

user@server:~# upsmon
Network UPS Tools upsmon 2.8.0-2727-g37289c117
fopen /var/run/nut/upsmon.pid: No such file or directory
Could not find PID file to see if previous upsmon instance is already running!
UPS: Power@10.0.0.3 (primary) (power value 1)
Using power down flag file /etc/killpower

user@server:~# cat /etc/nut/ups.conf
[Power]
 driver = usbhid-ups
 port = auto

When I install from .deb, I get something to this effect:

root@Server:~# systemctl status nut-client
● nut-monitor.service - Network UPS Tools - power device monitor and shutdown controller
     Loaded: loaded (/lib/systemd/system/nut-monitor.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2023-08-02 18:56:42 EDT; 4s ago
    Process: 3142243 ExecStart=/sbin/upsmon (code=exited, status=0/SUCCESS)
   Main PID: 3142245 (upsmon)
      Tasks: 3 (limit: 38361)
     Memory: 924.0K
        CPU: 6ms
     CGroup: /system.slice/nut-monitor.service
             ├─3142244 /lib/nut/upsmon
             └─3142245 /lib/nut/upsmon

Aug 02 18:56:42 Server upsmon[3142243]: fopen /run/nut/upsmon.pid: No such file or directory
Aug 02 18:56:42 Server upsmon[3142243]: Using power down flag file /etc/killpower
Aug 02 18:56:42 Server upsmon[3142243]: UPS: TrippLiteUPS@localhost (master) (power value 1)
Aug 02 18:56:42 Server upsmon[3142244]: Startup successful
Aug 02 18:56:42 Server systemd[1]: nut-monitor.service: Can't open PID file /run/nut/upsmon.pid (yet?) after start>
Aug 02 18:56:42 Server systemd[1]: nut-monitor.service: Supervising process 3142245 which is not our child. We'll >
Aug 02 18:56:42 Server systemd[1]: Started Network UPS Tools - power device monitor and shutdown controller.

root@Server:~# cat /lib/systemd/system/nut-monitor.service
[Unit]
Description=Network UPS Tools - power device monitor and shutdown controller
After=local-fs.target network.target nut-server.service

[Service]
ExecStart=/sbin/upsmon
PIDFile=/run/nut/upsmon.pid
Type=forking

[Install]
WantedBy=multi-user.target

Should I just manually define the contents of /lib/systemd/system/nut-monitor.service or was I supposed to do something beyond make install from the base directory?

jimklimov commented 1 year ago

Please also check the end of https://github.com/networkupstools/nut/wiki/Building-NUT-for-in%E2%80%90place-upgrades-or-non%E2%80%90disruptive-tests - it goes about doing the make install (which would deliver the service unit files if applicable to the OS) and disabling/enabling them to register.