Tutorials / Shut Down Proxmox Cleanly on a Power Cu…
Power cuts are a fact of life in Kenya, and a server that loses power mid-write can corrupt databases, file shares and virtual disks. In this tutorial you will connect a UPS to a Proxmox VE host by USB and configure NUT (Network UPS Tools) so the host shuts every VM down cleanly, then powers itself off, before the battery runs out.
Time: about 45 minutes. Level: intermediate (comfortable with the Linux shell).

usbhid-ups driver).apt update
apt install nut
nut-scanner -U
nut-scanner -U lists USB UPS devices it finds, with the driver to use. If nothing shows up, check the cable and run lsusb to confirm the UPS is visible.
Edit /etc/nut/nut.conf and set NUT to standalone mode (the UPS, the server software and the monitor all on this host):
MODE=standalone
Then add the UPS to /etc/nut/ups.conf:
[ups]
driver = usbhid-ups
port = auto
desc = "Server room UPS"
Add a user to /etc/nut/upsd.users. Use a long random password of your own:
[upsmon]
password = CHANGE-ME-to-a-long-random-password
upsmon primary
Then tell the monitor to watch the UPS and how to shut down, in /etc/nut/upsmon.conf:
MONITOR ups@localhost 1 upsmon CHANGE-ME-to-a-long-random-password primary
SHUTDOWNCMD "/sbin/shutdown -h +0"
Protect the files, since they contain the password:
chown root:nut /etc/nut/upsd.users /etc/nut/upsmon.conf
chmod 640 /etc/nut/upsd.users /etc/nut/upsmon.conf
Reboot the host, or restart the NUT services, then read the UPS:
upsc ups@localhost
You should see values such as battery.charge, battery.runtime (in seconds) and ups.status. OL means on line (mains power), OB means on battery and LB means low battery.
By default the host shuts down when the UPS reports low battery, which on many units leaves only a minute or two. A Proxmox host with several VMs needs more time than that. Tell the driver to raise the low-battery mark by adding these lines to the [ups] section of /etc/nut/ups.conf:
ignorelb
override.battery.charge.low = 50
override.battery.runtime.low = 600
With these settings the host starts shutting down when the battery falls to 50% or the estimated runtime drops below 10 minutes, whichever comes first. Adjust them to your UPS and load, then restart NUT.
When the host shuts down, Proxmox stops every guest first. To make that clean and orderly:
Pick a quiet time and tell users first. Then either unplug the UPS from the wall and watch upsc ups@localhost count down, or force a full shutdown sequence straight away with:
upsmon -c fsd
This really shuts the host and every VM down. Watch that the VMs stop in the order you expect, and time the whole sequence. If it takes longer than the runtime your UPS has left at the threshold, raise the threshold.
If a NAS, a second server or a firewall shares the UPS, NUT can serve the UPS status over the network so they shut down too (NUT's netserver mode on the Proxmox host, and a NUT client on the others). Most NAS systems have a built-in NUT client in their UPS settings.
Power protection is point 3 in our 10-point IT checklist for Kenyan SMEs. If you would rather have it done for you, with ordered shutdown across your whole server room and alerts to your phone, get in touch.
Tell us what you are trying to run — we will tell you the honest way to run it. Free consultation, no obligation.
Talk to the team