Message boards :
Number crunching :
Boinc on Ubuntu 18 LTS not detecting "on battery"
Message board moderation
Author | Message |
---|---|
![]() ![]() Send message Joined: 20 May 04 Posts: 76 Credit: 45,752,966 RAC: 8 ![]() |
I have a Ubuntu 18.04.3 LTS, Boinc manager 7.14.2 (x64), I have APC SmartUPS SMT1500i. Ubuntu correctly detects UPS, apcupsd works ok, reporting status correctly, see below. When going on battery, it correctly displays battery discharging status etc... Under Options->Computing Preferances I select "Suspend when computer is on battery", but when goes on battery, Boinc still continue to work. Of course, selected is "Run based on preferances". Any idea? P.S. Same works correctly in Windows 10 (dual boot), but not in Ubuntu. root@ubuntu:~$ apcaccess APC : 001,028,0732 DATE : 2019-10-03 22:06:38 +0200 HOSTNAME : korisnik-ubuntu VERSION : 3.14.14 (31 May 2016) debian UPSNAME : SmartUPS 1500 CABLE : USB Cable DRIVER : USB UPS Driver UPSMODE : Stand Alone STARTTIME: 2019-10-03 21:59:33 +0200 MODEL : Smart-UPS 1500 STATUS : ONLINE BCHARGE : 90.0 Percent TIMELEFT : 34.0 Minutes MBATTCHG : 5 Percent MINTIMEL : 2 Minutes MAXTIME : 0 Seconds ALARMDEL : No alarm BATTV : 27.3 Volts NUMXFERS : 1 XONBATT : 2019-10-03 22:01:15 +0200 TONBATT : 0 Seconds CUMONBATT: 96 Seconds XOFFBATT : 2019-10-03 22:02:51 +0200 STATFLAG : 0x05000008 MANDATE : 2014-10-20 NOMBATTV : 24.0 Volts FIRMWARE : UPS 09.2 / ID=18 END APC : 2019-10-03 22:06:41 +0200 |
![]() ![]() ![]() Send message Joined: 29 Apr 01 Posts: 13164 Credit: 1,160,866,277 RAC: 1,873 ![]() ![]() |
Probably should create a new issue at Github on the problem. Obviously, whatever mechanism that the Manager hooks into in the Windows environment is not available in the Linux environment. The signaling that Windows does should be the key. I didn't find anything promising in the code other than where the option is defined. Don't know what process I should be looking for. Seti@Home classic workunits:20,676 CPU time:74,226 hours ![]() ![]() A proud member of the OFA (Old Farts Association) |
![]() ![]() ![]() Send message Joined: 29 Apr 01 Posts: 13164 Credit: 1,160,866,277 RAC: 1,873 ![]() ![]() |
I found an existing open issue and added a comment. Could you look at it and add your observations or corrections as to what is observed and wanted. https://github.com/BOINC/boinc/issues/1471#issuecomment-538165443 Seti@Home classic workunits:20,676 CPU time:74,226 hours ![]() ![]() A proud member of the OFA (Old Farts Association) |
Richard Haselgrove ![]() Send message Joined: 4 Jul 99 Posts: 14686 Credit: 200,643,578 RAC: 874 ![]() ![]() |
Please note that the OP is referring to an APC UPS. I've used those in connection with Windows servers, and at the time I did so (several years ago), they required bespoke OEM software and an external hard-wired control connection (originally RS232 serial, later USB) to implement status monitoring and initiate system shutdown when the remaining battery level reached a critical level. BOINC's battery monitoring was implemented primarily for laptops, where the battery and its monitoring software are integrated into the operating system at build time by the manufacturer. @ Keith - your report at GitHub mentions that you've confirmed that the Windows implementation works. May I ask whether that is the same 'external OEM UPS' use case, or the internal laptop battery case? I'm not 100% certain that they use the same control software APIs. |
Ian&Steve C. ![]() Send message Joined: 28 Sep 99 Posts: 4267 Credit: 1,282,604,591 RAC: 6,640 ![]() ![]() |
I had the same impression, that the “on battery†option was aimed at laptop batteries, not an external UPS. Seti@Home classic workunits: 29,492 CPU time: 134,419 hours ![]() ![]() |
![]() ![]() ![]() Send message Joined: 29 Apr 01 Posts: 13164 Credit: 1,160,866,277 RAC: 1,873 ![]() ![]() |
Please note that the OP is referring to an APC UPS. I've used those in connection with Windows servers, and at the time I did so (several years ago), they required bespoke OEM software and an external hard-wired control connection (originally RS232 serial, later USB) to implement status monitoring and initiate system shutdown when the remaining battery level reached a critical level. The OP is using an APC UPS model SMT-1500i. I am using mostly APC Backups 1500G's, SMT1500C's or a SMT2200C. All use the USB connection via the apcupsd daemon. The upowerd daemon controls monitoring of all battery powered devices. This is what is used to detect whether the device is on battery or not. keith@Serenity:~$ upower -d Device: /org/freedesktop/UPower/devices/ups_hiddev0 native-path: /sys/devices/pci0000:00/0000:00:08.1/0000:0d:00.3/usb9/9-4/9-4:1.0/usbmisc/hiddev0 vendor: American Power Conversion model: Smart-UPS_1500 FW:UPS 03.5 / ID=1015 serial: 3S1831X12519 power supply: yes updated: Fri 04 Oct 2019 08:04:57 AM PDT (6 seconds ago) has history: yes has statistics: yes ups present: yes state: fully-charged warning-level: none time to empty: 7.2 minutes percentage: 100% icon-name: 'battery-full-charged-symbolic' Device: /org/freedesktop/UPower/devices/keyboard_hidpp_battery_0 native-path: hidpp_battery_0 model: K520 serial: 2011-1c-ea-e8-7f power supply: no updated: Fri 04 Oct 2019 08:04:03 AM PDT (60 seconds ago) has history: yes has statistics: yes keyboard present: yes rechargeable: yes state: discharging warning-level: none battery-level: high percentage: 70% icon-name: 'battery-full-symbolic' Device: /org/freedesktop/UPower/devices/mouse_hidpp_battery_1 native-path: hidpp_battery_1 model: Wireless Mouse M510 serial: 4051-4d-87-b1-46 power supply: no updated: Fri 04 Oct 2019 08:03:12 AM PDT (111 seconds ago) has history: yes has statistics: yes mouse present: yes rechargeable: yes state: discharging warning-level: none battery-level: normal percentage: 55% icon-name: 'battery-good-symbolic' Device: /org/freedesktop/UPower/devices/DisplayDevice power supply: yes updated: Fri 04 Oct 2019 08:04:57 AM PDT (6 seconds ago) has history: no has statistics: no ups present: yes state: fully-charged warning-level: none time to empty: 7.2 minutes percentage: 100% icon-name: 'battery-full-charged-symbolic' Daemon: daemon-version: 0.99.7 on-battery: no lid-is-closed: no lid-is-present: no critical-action: PowerOff keith@Serenity:~$ This is used to detect whether a laptop is on battery or has the lid closed and is in hibernation for example. So the same type of mechanism that works for detecting on battery status in Windows is available in Linux. What I need to do is find out which module in the client controls this behavior for Windows and duplicate it for Linux. Seti@Home classic workunits:20,676 CPU time:74,226 hours ![]() ![]() A proud member of the OFA (Old Farts Association) |
![]() ![]() ![]() Send message Joined: 29 Apr 01 Posts: 13164 Credit: 1,160,866,277 RAC: 1,873 ![]() ![]() |
To clarify, the monitoring of the UPS status is done by the apcupsd daemon via the USB connection. When the the conf file settings for that daemon are tripped, that signals the upowerd daemon to initialize the host shutdown based on the conf file parameters like time remaining on battery. That mechanism works fine in Linux. But preferably, we would like to see the client shed computing load to preserve more of the battery time remaining during a longer power outage that is past the normal load runtime of the battery. The daemons would still have final control over shutting the system down once the UPS battery can't sustain the system load so the that the host is powered down gracefully and filesystem integrity is maintained. The OP says that a Windows host correctly observes the setting in the Manager. P.S. Same works correctly in Windows 10 (dual boot), but not in Ubuntu. Seti@Home classic workunits:20,676 CPU time:74,226 hours ![]() ![]() A proud member of the OFA (Old Farts Association) |
![]() ![]() Send message Joined: 20 May 04 Posts: 76 Credit: 45,752,966 RAC: 8 ![]() |
seems that upower correctly detect when the power is on-battery, but Boinc still doesn't react... power on-line (idle): user@ubuntu:~$ upower -d Device: /org/freedesktop/UPower/devices/ups_hiddev0 native-path: /sys/devices/pci0000:00/0000:00:01.3/0000:02:00.0/usb1/1-5/1-5:1.0/usbmisc/hiddev0 vendor: American Power Conversion model: Smart-UPS 1500 FW:UPS 09.2 / ID=18 serial: 3S1442X06625 power supply: yes updated: петак, 04. октобар 2019. 21:47:45 CEST (22 seconds ago) has history: yes has statistics: yes ups present: yes state: fully-charged warning-level: none time to empty: 1,5 hours percentage: 100% icon-name: 'battery-full-charged-symbolic' on UPS power (idle): user@ubuntu:~$ upower -d Device: /org/freedesktop/UPower/devices/ups_hiddev0 native-path: /sys/devices/pci0000:00/0000:00:01.3/0000:02:00.0/usb1/1-5/1-5:1.0/usbmisc/hiddev0 vendor: American Power Conversion model: Smart-UPS 1500 FW:UPS 09.2 / ID=18 serial: 3S1442X06625 power supply: yes updated: петак, 04. октобар 2019. 21:50:45 CEST (12 seconds ago) has history: yes has statistics: yes ups present: yes state: discharging warning-level: discharging time to empty: 1,5 hours percentage: 96% icon-name: 'battery-full-symbolic' |
![]() ![]() ![]() Send message Joined: 29 Apr 01 Posts: 13164 Credit: 1,160,866,277 RAC: 1,873 ![]() ![]() |
Yes, that is what I concluded also. This would be the proper interface to interrogate. upower -i /org/freedesktop/UPower/devices/ups_hiddev0 I have finally found where the client checks for a host being on battery. Unfortunately the code is about 5 years out of date and is interrogating interfaces that no longer exist in modern Linux distros. The code is in the /client/hostinfo_unix.cpp file. That is the file that needs to be updated to interrogate the upower interface for the status of whether the system is on UPS battery. Now all we have to do if find a Linux programmer that can write the code. That will be the hard part. Seti@Home classic workunits:20,676 CPU time:74,226 hours ![]() ![]() A proud member of the OFA (Old Farts Association) |
![]() ![]() Send message Joined: 20 May 04 Posts: 76 Credit: 45,752,966 RAC: 8 ![]() |
Thanks Keith. I see you already also reported to Github, and you started discussion on Boinc message board. Please also report in Boinc message board your finding where in code this should be fixed, and we shall keep our fingers crossed that it shall be fixed soon... :) |
![]() ![]() ![]() Send message Joined: 29 Apr 01 Posts: 13164 Credit: 1,160,866,277 RAC: 1,873 ![]() ![]() |
I have asked for help from the upower developers on Launchpad. I also sent a DM to one of our BOINC developers asking for assistance over at Discord BOINC channel. Seti@Home classic workunits:20,676 CPU time:74,226 hours ![]() ![]() A proud member of the OFA (Old Farts Association) |
![]() ![]() ![]() Send message Joined: 29 Apr 01 Posts: 13164 Credit: 1,160,866,277 RAC: 1,873 ![]() ![]() |
Well I got ignored on the Upower Launchpad interface. My post was expired after no activity for 15 days. So no help there. I need a programmer to figure out which interface to look at. I am totally confused now. My research shows that the dbus messaging system notifies of a change in a device state like hiddev0 changing from charging to discharging. So is that the interface we need to look at? https://upower.freedesktop.org/docs/Device.html Seti@Home classic workunits:20,676 CPU time:74,226 hours ![]() ![]() A proud member of the OFA (Old Farts Association) |
![]() ![]() ![]() Send message Joined: 29 Apr 01 Posts: 13164 Credit: 1,160,866,277 RAC: 1,873 ![]() ![]() |
So what do I need to do to get some traction on this issue in the Linux client? Works on Windows but does not in Linux. Seti@Home classic workunits:20,676 CPU time:74,226 hours ![]() ![]() A proud member of the OFA (Old Farts Association) |
©2025 University of California
SETI@home and Astropulse are funded by grants from the National Science Foundation, NASA, and donations from SETI@home volunteers. AstroPulse is funded in part by the NSF through grant AST-0307956.