By default, unattended-upgrades is trigger by anacron and it only start when running on AC power, and don’t start when running on battery. This beviavor is easy to understand to avoid waste power. Anyway, I wish to allow unattended-upgrades to start even if machine running on battery, because some peoples of my friends, including me, always use their laptop only on battery. The following trick doesn’t work on 16.04 :
Set ANACRON_RUN_ON_BATTERY_POWER=yes
in /etc/default/anacron
For Ubuntu 16.04, is there another way to allow anacron, or unattended-upgrades, to start even running on battery ?
The tricks on the following topic doesn't work on 16.04 : Run anacron even when on battery (laptop)
Edit 1:
As requested, I used the command dpkg -L anacron | xargs grep -lwi power 2>/dev/null
from the comment of waltinator.
Then, I change like this, but no change, unattended-upgrades still doesn't start on battery:
. Comment the following lines in /etc/init.d/anacron
# if test x"$ANACRON_RUN_ON_BATTERY_POWER" != x"yes" && test -x /usr/bin/on_ac_power
# then
# /usr/bin/on_ac_power >/dev/null
# if test $? -eq 1
# then
# log_progress_msg "deferred while on battery power"
# log_end_msg 0
# exit 0
# fi
#fi
dpkg -L anacron | xargs grep -lwi power 2>/dev/null
will show you all the files in theanacron
package that mention "power". Have you read each of them? – waltinator Oct 26 '17 at 14:26