unattended upgrade no longer actions on shutdown (when started on battery)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
unattended-upgrades (Ubuntu) |
Fix Released
|
Medium
|
Unassigned | ||
Xenial |
Fix Released
|
Medium
|
Unassigned | ||
Bionic |
Fix Released
|
Medium
|
Unassigned |
Bug Description
[Impact]
* Unattended-upgrades does not install upgrades when it is configured to install updates on shutdown and when it the system is started on battery, but installs updates on battery in other cases.
* This behaviour is unintended and confuses users, moreover installing updates on battery risks the system to be shut down in the middle of an upgrade due to depleting the battery.
* This upload changes u-u to skip updates or gracefully stop when the system is switching to batter-powered state by default minimizing the risk of breaking the system.
[Test Case]
* Run "unattended-upgrade --dry-run --verbose" on battery and on AC power
* With default configuration u-u should stop with the following message on battery:
Initial blacklisted packages:
Initial whitelisted packages:
Starting unattended upgrades script
Allowed origins are: o=Ubuntu,a=bionic, o=Ubuntu,
System is on battery power, stopping
* On AC power it should continue:
$ sudo ./unattended-
Initial blacklisted packages:
Initial whitelisted packages:
Starting unattended upgrades script
Allowed origins are: o=Ubuntu,a=bionic, o=Ubuntu,
No packages found that can be upgraded unattended and no pending auto-removals
* Add the following configuration file and check u-u continuing even on battery:
$ cat /etc/apt/
Unattended-
rbalint@
Initial blacklisted packages:
Initial whitelisted packages:
Starting unattended upgrades script
Allowed origins are: o=Ubuntu,a=bionic, o=Ubuntu,
No packages found that can be upgraded unattended and no pending auto-removals
[Regression Potential]
* Unattended-upgrades may fail to install updates even on AC power, but this is unlikely to happen due to the code changed being fairly simple. on_ac_power may return 255 (false) Power status could not be determined, but this is mapped to being on AC power and installing the updates, only subprocess.
[Original Bug Text]
Ubuntu 17.10 and 18.04 do not install updates with InstallOnShutdown flag set.
post-install script on 14.04 and 16.04 would set options in /etc/apt/
Description: Ubuntu 18.04 LTS
Release: 18.04
ii unattended-upgrades 1.1ubuntu1 all automatic installation of security upgrades
-------
Unattended-
// Extended Security Maintenance; doesn't necessarily exist for
// every release and this system may not have it installed, but if
// available, the policy for updates is such that unattended-upgrades
// should also install from here by default.
// "${distro_
// "${distro_
};
Unattended-
// "vim";
// "libc6";
// "libc6-dev";
// "libc6-i686";
};
Unattended-
Unattended-
Unattended-
-------
APT::Periodic:
APT::Periodic:
APT::Periodic:
APT::Periodic:
description: | updated |
Changed in unattended-upgrades (Ubuntu Xenial): | |
importance: | Undecided → Medium |
Changed in unattended-upgrades (Ubuntu Bionic): | |
importance: | Undecided → Medium |
summary: |
- unattended upgrade no longer actions on shutdown + unattended upgrade no longer actions on shutdown (when started on + battery) |
In my tests i found u-u operating properly on shutdown except when the system was started on battery, and in that case the u-u.service did not start - thus did not stop on shutdown:
$ service unattended-upgrades status upgrades. service - Unattended Upgrades Shutdown system/ unattended- upgrades. service; enabled; vendor preset: enabled) r=true was not met upgrade( 8)
● unattended-
Loaded: loaded (/lib/systemd/
Active: inactive (dead)
Condition: start condition failed at Fri 2018-05-25 20:18:34 UTC; 38s ago
└─ ConditionACPowe
Docs: man:unattended-
The change to not run on battery was introduced in 0.97, right before Artful's release.
Did you start your system on battery?