I have a remote Pi4 running Buster and Network UPS Tools 2.7.4.

Most of the time it works fine, but after a long power outage and NUT shutdown, the Pi cannot connect to the UPS.

pi@raspmountain:~/webcam $ upsc apc500
Error: Connection failure: Connection refused

If I reboot, it connects fine:

pi@raspmountain:~/webcam $ upsc apc500
Init SSL without certificate database
battery.charge: 100
battery.charge.low: 10

I don't know why this is or how to fix it. I have searched extensively and while I have found answers to similar questions, none about this specific problem.

I have tried restarting the nut-driver.service, but that doesn't work.

Note that this is a standalone NUT installation. The Server and client services are not needed. There is no networking involved. The NUT driver service never starts because the UPS doesn't show up on the USB bus after a cold boot. It takes a warm boot to get the UPS to connect. I need to figure out how to get the UPS to connect without having to boot the Pi.

  • Have you checked to see if it's got a systemd unit? Have you searched the Internet with the symptoms you've described? If not - why? If so - why isn't it mentioned in your question?
    – Seamus
    Apr 23, 2022 at 8:59
  • I have edited my question to show that I have searched the Internet and found similar questions but nothing like this. I did mention in my original question that I had tried restarting the nut-driver.service. On the Pi the NUT services are located in /lib/systemd/system. But, you'd already know that had you done sufficient research to be truly helpful.
    – Buadhai
    Apr 23, 2022 at 12:28
  • Buadhai: Please know that it is not my job (or anyone's here) to do "sufficient research" to answer your question. Unless I didn't get that memo, you are entitled to nothing here beyond simple courtesy. It is your job to do the research - REFERENCE. As a consolation, here's a free opinion: An overly-developed sense of entitlement is not the best way to get help.
    – Seamus
    Apr 23, 2022 at 21:38
  • I apologize for the snide remark. I was reacting to my perception that you seemed more interested in being critical than helpful.
    – Buadhai
    Apr 24, 2022 at 1:46
  • Are you sure you don't need the nut-server service? I'm pretty sure that nut-monitor needs it and upsc won't work without it. Possibly you need to restart both nut-server.service and nut-driver.service (driver first). The driver systemd file probably should have systemd-udev-settle.service in both After= and Wants= so it doesn't start too soon. If that doesn't help, it might be useful to either add an autorestart with a delay or add a prereq that loops until the UPS shows up on USB.
    – user10489
    Apr 24, 2022 at 23:40

1 Answer 1


Connection refused indicates that there is nothing listening on the network port. Most likely the nut daemon has died. Rebooting fixes this by restarting the daemons.

You could fix this without rebooting by manually restarting the daemons, possibly with systemctl restart nut-server nut-monitor or similar.

For a more permanent fix, you need to check your logs and determine why the daemon is dying and either correct that or adjust the systemd config for the daemon to restart it on failure.


Since you indicate in your comments that the UPS doesn't show up on the usb bus after cold start, it might be helpful to put your usb rescan commands into a script. Add some tests to make sure it does not reset the USB if the UPS is there, and maybe some delays too, and then add that script as a ExecStartPre= for the nut-driver.service.

  • I have edited the OP to note that this is a standalone installation of NUT so that the server and monitor services are not needed. The driver service never starts because no UPS is detected on the USB bus after a cold boot. It takes a warm reboot to get the UPS to show up. I hadn't figured all this out at the time of the OP.
    – Buadhai
    Apr 24, 2022 at 21:55
  • @Buadhai: Are you sure there's a difference between warm & cold boots on a RPi? I've always assumed there's not, but...??
    – Seamus
    Apr 25, 2022 at 0:42
  • @Seamus - What I was calling a "cold boot" was when the Pi had been without power for a while and then boots when power is restored. In this case NUT has shut down the Pi with this /sbin/shutdown -h +0 before the power goes down. What I'm calling a warm boot is when you reboot the Pi from the command line and the Pi is never without power.
    – Buadhai
    Apr 25, 2022 at 1:25
  • @Buadhai: Yes - that's true, but all processing is stopped. And if all processing is stopped, then it all must be re-started again. This is why I asked initially about systemd - I guessed that there was a unit file that controlled its startup - have you looked for that? Also - unless you physically remove power (pull the plug), your RPi is never without power - shutdown & poweroff are essentially the same as halt in RPi OS. You'll find +5V present, and except for "low power mode", you'll find 3V3 as well.
    – Seamus
    Apr 25, 2022 at 5:27
  • @Buadhai: I'm surprised your research hasn't led you to the nut GitHub site. There's a lot of activity, and a lot of contributors - ordinarily a good sign - but there are also 451 open issues going back to 2013. Don't know what that means, but you'll only learn if you try. My experience with nut was very poor initially (~8 yrs ago) - I've not tried it since. Finally, there are 27 nut-related Q&A here on RPi SE - maybe look at those? Again, this is mostly about research.
    – Seamus
    Apr 25, 2022 at 5:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.