On 1st November 2023 was one of the worst ever day in my working life. One super strongest ever lightning strike completely shut off the the whole house electric supply! I have UPS connected to my laptop which the laptop also shut off abruptly. I would say "lucky" ? that that the laptop managed to boot up unfortunately the USBs are all broken, it does not function anymore. Never in my life would think that even with a laptop protected by an APC UPS, the device would be damage, well partially. Closer inspection show that laptop power adapter socket, the live connector got burned mark. It is just how strong was the lightning strike! So lesson learn, this time I bought a new APC UPS which connected in serial fashion and behind a surge protector (Targus) and hoping that with 2x protections, I will survive in the incoming lightning storm. hopefully. 🤞🙏
Let's see the APC UPS
and when it is connected and running
$ sudo apt install apcupsdReading package lists... DoneBuilding dependency tree... DoneReading state information... DoneThe following packages were automatically installed and are no longer required:hunspell-gl-es hunspell-sv-se libnvidia-compiler libu2f-udev libwpe-1.0-1 libwpebackend-fdo-1.0-1 linux-headers-6.1.0-17-commonUse 'sudo apt autoremove' to remove them.The following additional packages will be installed:apcupsd-doc libusb-0.1-4Suggested packages:apcupsd-cgiThe following NEW packages will be installed:apcupsd apcupsd-doc libusb-0.1-40 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.Need to get 670 kB of archives.After this operation, 1,779 kB of additional disk space will be used.Do you want to continue? [Y/n] YGet:1 http://deb.debian.org/debian bookworm/main amd64 libusb-0.1-4 amd64 2:0.1.12-32 [23.4 kB]Get:2 http://deb.debian.org/debian bookworm/main amd64 apcupsd amd64 3.14.14-3.1+b1 [256 kB]Get:3 http://deb.debian.org/debian bookworm/main amd64 apcupsd-doc all 3.14.14-3.1 [390 kB]Fetched 670 kB in 0s (3,160 kB/s)Selecting previously unselected package libusb-0.1-4:amd64.(Reading database ... 438864 files and directories currently installed.)Preparing to unpack .../libusb-0.1-4_2%3a0.1.12-32_amd64.deb ...Unpacking libusb-0.1-4:amd64 (2:0.1.12-32) ...Selecting previously unselected package apcupsd.Preparing to unpack .../apcupsd_3.14.14-3.1+b1_amd64.deb ...Unpacking apcupsd (3.14.14-3.1+b1) ...Selecting previously unselected package apcupsd-doc.Preparing to unpack .../apcupsd-doc_3.14.14-3.1_all.deb ...Unpacking apcupsd-doc (3.14.14-3.1) ...Setting up libusb-0.1-4:amd64 (2:0.1.12-32) ...Setting up apcupsd-doc (3.14.14-3.1) ...Setting up apcupsd (3.14.14-3.1+b1) ...Created symlink /etc/systemd/system/multi-user.target.wants/apcupsd.service → /lib/systemd/system/apcupsd.service.Processing triggers for man-db (2.11.2-2) ...Processing triggers for libc-bin (2.36-9+deb12u7) ...Scanning processes...Scanning processor microcode...Scanning linux images...Running kernel seems to be up-to-date.The processor microcode seems to be up-to-date.No services need to be restarted.No containers need to be restarted.No user sessions are running outdated binaries.No VM guests are running outdated hypervisor (qemu) binaries on this host.$
and then start it.
$ sudo systemctl start apcupsd$ sudo systemctl status apcupsd● apcupsd.service - UPS power management daemonLoaded: loaded (/lib/systemd/system/apcupsd.service; enabled; preset: enabled)Active: active (running) since Mon 2024-11-11 21:32:23 +08; 2s agoDocs: man:apcupsd(8)Process: 212186 ExecStartPre=/lib/apcupsd/prestart (code=exited, status=0/SUCCESS)Process: 212190 ExecStart=/sbin/apcupsd (code=exited, status=0/SUCCESS)Main PID: 212191 (apcupsd)Tasks: 3 (limit: 37451)Memory: 584.0KCPU: 8msCGroup: /system.slice/apcupsd.service└─212191 /sbin/apcupsdNov 11 21:32:23 debby systemd[1]: Starting apcupsd.service - UPS power management daemon...Nov 11 21:32:23 debby systemd[1]: apcupsd.service: Can't open PID file /run/apcupsd.pid (yet?) after start: No such file or directoryNov 11 21:32:23 debby apcupsd[212191]: apcupsd 3.14.14 (31 May 2016) debian startup succeededNov 11 21:32:23 debby apcupsd[212191]: NIS server startup succeededNov 11 21:32:23 debby systemd[1]: Started apcupsd.service - UPS power management daemon.
and even better, gnome automatically detect it. I was really impress how little effort require to make things work.
one thing it does not work out of the box is communication with UPS also lost... but not sure how gnome able to detect the battery percentage..anyway, guess this is the work require.
$ sudo apcaccess
APC : 001,018,0437
DATE : 2024-11-11 21:33:20 +0800
HOSTNAME : debby
VERSION : 3.14.14 (31 May 2016) debian
UPSNAME : debby
CABLE : USB Cable
DRIVER : USB UPS Driver
UPSMODE : Stand Alone
STARTTIME: 2024-11-11 21:32:23 +0800
STATUS : COMMLOST
MBATTCHG : 5 Percent
MINTIMEL : 3 Minutes
MAXTIME : 0 Seconds
NUMXFERS : 0
TONBATT : 0 Seconds
CUMONBATT: 0 Seconds
XOFFBATT : N/A
STATFLAG : 0x05000100
END APC : 2024-11-11 21:33:20 +0800
In any case, I really like this unit come with monitoring system. I guess just need to find out how to fix the communication problem and it would be a blast!
Reference:
https://opensource.com/article/21/12/linux-apcupsd
https://wiki.debian.org/apcupsd