If you have one of the ups devices which doesn’t have an easy way to disable annoying beep sounds when the main power gets down, you can turn off the beep behaviour in most cases, even if the seller says that “there is no way to stop beep”.
But it will take about 3-5 minutes to make all the setup under Linux properly. We need to run a upscmd
at last, but there are a few steps before that.
- First of all, install
nut
package:
$ sudo apt install nut
- Append following lines to
/etc/nut/ups.conf
according to your ups device (desc parameter not important, you don’t need to give correct brand name either but the given section name will be used later to identify configured ups device, we’re using eaton as config section name here):
[eaton]
driver = usbhid-ups
port = auto
desc = "Eaton 5E"
- Now start the upsdriver with
upsdrvctl
:
$ sudo upsdrvctl start
Network UPS Tools - UPS driver controller 2.7.4
Network UPS Tools - Generic HID driver 0.41 (2.7.4)
USB communication driver 0.33
Can't claim USB device [0463:ffff]: could not detach kernel driver from interface 0: Operation not permitted
Driver failed to start (exit status=1)
If you got errors like above, nut daemon in the system doesn’t have access to usb interface. To give the correct permission, we have to declare new udev rules.
Now it is time to learn vendor id and product id of ups device:
$ lsusb | grep UPS
Bus 003 Device 005: ID 0463:ffff MGE UPS Systems UPS
We can see that vendor id is 0x0463 and product id is 0xffff. Create a file named /etc/udev/rules.d/90-ups.rules
and append following line into it:
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0463", ATTR{idProduct}=="ffff", MODE="0660", GROUP="nut"
and restart the udev daemon:
$ sudo service udev restart
In order to take affect, you need to remove usb cable of the ups device and connect it again.
- start the ups driver again:
$ sudo upsdrvctl start
Network UPS Tools - UPS driver controller 2.7.4
Network UPS Tools - Generic HID driver 0.41 (2.7.4)
USB communication driver 0.33
Using subdriver: MGE HID 1.39
- Now it is started properly. We can try with ups client upsc (second parameter is the same as the config section in ups.conf):
$ upsc eaton
Error: Connection failure: Connection refused
We couldn’t connect to upsd daemon because it is not configured yet.
- Edit
/etc/nut/nut.conf
and change the line starts with MODE as:
MODE=standalone
- Edit
/etc/nut/upsd.conf
and uncomment the line:
LISTEN 127.0.0.1 3493
- Restart the nut server:
$ sudo service nut-server restart
- Run upsc command the get beeper status:
$ upsc eaton ups.beeper.status
enabled
- We’re so close, now append following lines to
/etc/nut/upsd.users
, change the username admin or password as you want:
[admin]
password = "test1234"
actions = SET
instcmds = ALL
- Reload upsd with the new users config:
$ sudo upsd -c reload
- You can query the list of the commands which will be supported by your ups device with the upscmd:
$ upscmd -l eaton
Instant commands supported on UPS [eaton]:
beeper.disable - Disable the UPS beeper
beeper.enable - Enable the UPS beeper
beeper.mute - Temporarily mute the UPS beeper
beeper.off - Obsolete (use beeper.disable or beeper.mute)
beeper.on - Obsolete (use beeper.enable)
load.off - Turn off the load immediately
load.off.delay - Turn off the load with a delay (seconds)
shutdown.stop - Stop a shutdown in progress
- As you can see, there is a command named beeper.disable and we’ll be execute this command (give the username and password which we configured just before):
$ upscmd eaton beeper.disable
Username (greg): admin
Password:
OK
- Now check the beeper status again:
$ upsc eaton ups.beeper.status
disabled
That’s it. It takes some time but your ears will be happy.