Jammy verification:

Installed package from proposed:
root@build-jammy:~# apt list powermgmt-base
Listing... Done
powermgmt-base/jammy-proposed,now 1.36ubuntu0.22.04.1 all [installed,automatic]

Running on_ac_power and unattended upgrades while connected to power:

root@build-jammy:~# cat /sys/class/power_supply/AC/online 
1

root@build-jammy:~# on_ac_power

root@build-jammy:~# echo $?
0

root@build-jammy:~# unattended-upgrade --dry-run -v
Starting unattended upgrades script
Allowed origins are: o=Ubuntu,a=jammy, o=Ubuntu,a=jammy-security, 
o=UbuntuESMApps,a=jammy-apps-security, o=UbuntuESM,a=jammy-infra-security
Initial blacklist: 
Initial whitelist (not strict): 
Removing unused kernel packages: linux-headers-5.15.0-143-generic 
linux-headers-5.15.0-143
Packages that were successfully auto-removed: 
Packages that are kept back: 
No packages found that can be upgraded unattended and no pending auto-removals
The list of kept packages can't be calculated in dry-run mode.

We can see that the power state is correctly detected and that
unattended upgrades does run.

Test on battery:

root@build-jammy:~# cat /sys/class/power_supply/AC/online 
0

root@build-jammy:~# on_ac_power
root@build-jammy:~# echo $?
1
root@build-jammy:~# unattended-upgrade --dry-run -v
System is on battery power, stopping


The system correctly detects that it is running on battery and avoids running 
unattended-upgrades

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1980991

Title:
  /usr/sbin/on_ac_power incorrectly reporting ac power status

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/powermgmt-base/+bug/1980991/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to