Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#825107: unattended-upgrades: Cannot enable/disable automatic upgrades using debconf with noninteractive frontend

153 views
Skip to first unread message

Michael Weghorn

unread,
May 23, 2016, 1:00:03 PM5/23/16
to
Package: unattended-upgrades
Version: 0.92
Severity: normal

Dear Maintainer,

as far as I can see, changing the setting whether upgrades should
automatically be downloaded and applied does not work with debconf in
noninteractive mode.

The corresponding debconf parameter is
"unattended-upgrades/enable_auto_updates"

By default, it is set to 'true':

root@debian:~# debconf-show unattended-upgrades
unattended-upgrades/enable_auto_updates: true
unattended-upgrades/origins_pattern: "origin=Debian,codename=${distro_codename},label=Debian-Security";

The following command changes the value to 'false':

root@debian:~# echo "unattended-upgrades unattended-upgrades/enable_auto_updates boolean false" | debconf-set-selections
root@debian:~# debconf-show unattended-upgrades
* unattended-upgrades/enable_auto_updates: false
unattended-upgrades/origins_pattern: "origin=Debian,codename=${distro_codename},label=Debian-Security";

However, that new value is not taken into account when running
"dpkg-reconfigure" with the noninteractive frontend:

root@debian:~# dpkg-reconfigure -fnoninteractive unattended-upgrades
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
root@debian:~# debconf-show unattended-upgrades
* unattended-upgrades/enable_auto_updates: true
unattended-upgrades/origins_pattern: "origin=Debian,codename=${distro_codename},label=Debian-Security";

I would have expected the value to still be "false" and the automatic
downloading and installing of newer packages disabled in the configuration
file. This is not the case.

This might - among others - break the possibility to configure
unattended-upgrades using systems for automatic deployment that rely on
the noninteractive debconf interface.

The reason seems to be the following section in the config script (which
seems to be related to the following GitHub issue:
https://github.com/mvo5/unattended-upgrades/issues/18):

# Load configuration from disk, if it exists.
if [ -e "$AUTO_UPGRADE" ]; then
if grep -q 'APT::Periodic::Unattended-Upgrade "1";' $AUTO_UPGRADE ; then
db_set unattended-upgrades/enable_auto_updates true
elif grep -q 'APT::Periodic::Unattended-Upgrade "0";' $AUTO_UPGRADE ; then
db_set unattended-upgrades/enable_auto_updates false
fi
fi

Best regards,
Michael

-- System Information:
Debian Release: stretch/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.5.0-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages unattended-upgrades depends on:
ii apt 1.2.12
ii apt-utils 1.2.12
ii debconf [debconf-2.0] 1.5.59
ii init-system-helpers 1.33
ii lsb-base 9.20160110
ii lsb-release 9.20160110
ii python3 3.5.1-3
ii python3-apt 1.1.0~beta2
ii ucf 3.0036
ii xz-utils 5.1.1alpha+20120614-2.1

Versions of packages unattended-upgrades recommends:
ii cron [cron-daemon] 3.0pl1-128

Versions of packages unattended-upgrades suggests:
pn bsd-mailx <none>
ii exim4-daemon-light [mail-transport-agent] 4.87-3

-- debconf information:
* unattended-upgrades/origins_pattern: "origin=Debian,codename=${distro_codename},label=Debian-Security";
* unattended-upgrades/enable_auto_updates: false

James Valleroy

unread,
May 23, 2016, 10:30:03 PM5/23/16
to
Is there a way to accommodate this, while also preserving local changes
during an upgrade?

This post has a good explanation of the problem that arises during upgrade:
https://lists.debian.org/debian-edu/2014/10/msg00177.html

--
James

signature.asc

Michael Weghorn

unread,
May 26, 2016, 7:10:03 AM5/26/16
to
On 2016-05-24 04:20, James Valleroy wrote:
> Is there a way to accommodate this, while also preserving local
> changes during an upgrade?

Thank you for your quick reply. Reading that post helped me better
understand the problem and how everything is related with each other.

On further research, I found that the man page of debconf-devel (7)
(section "Config file handling") describes how config files should be
handled by debconf.
The way unattended-upgrades does it is totally according to that.

This showed me that my understanding of debconf so far was not
sufficient and my first approach of changing the value was not
appropriate.
I checked how FAI [1] does it and the appropriate way seems to be to
use the "DEBCONF_DB_OVERRIDE" environment variable as described in the
man page of debconf (7).

Example:

root@debian:~# cat /tmp/override.dat
Name: unattended-upgrades/enable_auto_updates
Template: unattended-upgrades/enable_auto_updates
Value: false
Owners: unattended-upgrades

root@debian:~# DEBCONF_DB_OVERRIDE="File{/tmp/override.dat
readonly:true}" DEBIAN_FRONTEND=noninteractive dpkg-reconfigure
unattended-upgrades
Replacing config file /etc/apt/apt.conf.d/20auto-upgrades with new
version
update-rc.d: warning: start and stop actions are no longer
supported; falling back to defaults
debconf: DbDriver "_ENV_stack": unable to save changes to:
unattended-upgrades/enable_auto_updates

Then, to also update the debconf cache:

root@debian:~# debconf-copydb override_db config
--config=Name:override_db --config=Driver:File
--config=Filename:"/tmp/override.dat"


Therefore, this bug should possibly closed as "invalid".

Regards,
Michael

[1] http://fai-project.org/

Balint Reczey

unread,
Jul 15, 2017, 9:00:03 PM7/15/17
to
Control: notfound -1 0.92

Hi Michael,

On Thu, 26 May 2016 12:56:29 +0200 Michael Weghorn <m.we...@posteo.de>
wrote:
Doing so.

Cheers,
Balint
0 new messages