Score:3

Intel NUC unattended-upgrades battery power error

cn flag

I have an Intel NUC running Ubuntu 21.10 server. When testing my unattended-upgrades setup (via sudo unattended-upgrades --dry-run --debug) I am receiving the following error:

System is on battery power, stopping

The NUC doesn't have a battery so there appears to be a system configuration error. After repeated searches I haven't found any reports of similar problems. Does anyone have an idea of what the issue is and how to fix it?

EDIT: Here is the output of the on_ac_power script referenced below. I was unable to determine what is causing it to return false when the NUC is certainly on AC power:

deploy@deploy-nuc:~▶ ./on_ac_power.sh
+ OFF_LINE_P=no
+ [ -d /sys/class/power_supply/ ]
+ test -d /sys/class/power_supply/ucsi-source-psy-USBC000:001
+ test -r /sys/class/power_supply/ucsi-source-psy-USBC000:001/type
+ cat /sys/class/power_supply/ucsi-source-psy-USBC000:001/type
+ type=USB
+ [ -r /sys/class/power_supply/ucsi-source-psy-USBC000:001/online ]
+ cat /sys/class/power_supply/ucsi-source-psy-USBC000:001/online
+ online=0
+ [ 0 = 1 ]
+ [ 0 = 0 ]
+ OFF_LINE_P=yes
+ test -d /sys/class/power_supply/ucsi-source-psy-USBC000:002
+ test -r /sys/class/power_supply/ucsi-source-psy-USBC000:002/type
+ cat /sys/class/power_supply/ucsi-source-psy-USBC000:002/type
+ type=USB
+ [ -r /sys/class/power_supply/ucsi-source-psy-USBC000:002/online ]
+ cat /sys/class/power_supply/ucsi-source-psy-USBC000:002/online
+ online=0
+ [ 0 = 1 ]
+ [ 0 = 0 ]
+ OFF_LINE_P=yes
+ [ yes = yes ]
+ exit 1
surfearth avatar
cn flag
I posted the output of the `on_ac_power` script above in case anyone can help determine why it is returning `1` for false.
Score:1
jp flag

I don't know why your system believes it is on battery, but it looks like unattended-upgrades calls the external command on_ac_power to determine if on battery.

The command on_ac_power is just a fairly basic shell script, so you might be able to walk through it and figure out why it is returning the wrong value.

As a workaround, you can add to your apt configuration this setting that will tell unattended-upgrades to continue when on battery.

Unattended-Upgrade::OnlyOnACPower "false";
surfearth avatar
cn flag
The apt configuration successfully enabled `unattended-upgrades` to work. The script is outputting false for some reason although I wasn't able to understand why.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.