Your message dated Thu, 16 Feb 2023 21:48:21 +0000
with message-id <c7a4268fbcf3662b0b2ce75f376d035d646adb41.ca...@debian.org>
and subject line Re: Bug#704089: tzdata config script prevents non-interactive 
(re)configuration
has caused the Debian Bug report #704089,
regarding tzdata config script prevents non-interactive (re)configuration
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
704089: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=704089
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Package: tzdata
Version: 2012j-1

The configuration script of the tzdata package, wich uses debconf, prevents
non-interactive (re)configuration of the package.

To reproduce:

- feed debconf with new values for tzdata keys (ex. debconf-set-selections)
- run 'dpkg-reconfigure -fnoninteractive tzdata'
- configuration is unchanged

I propose the following change which makes non-interactive reconfiguration 
possible:

  
  --- /var/lib/dpkg/info/tzdata.config.orig       2013-03-27 18:58:53.000000000 
+0100
  +++ /var/lib/dpkg/info/tzdata.config    2013-03-27 18:35:53.000000000 +0100
  @@ -370,8 +370,10 @@
   
   # Initializes debconf default values from the ones found in
   # configuration files
  -db_set tzdata/Areas "$AREA"
  -db_set tzdata/Zones/$AREA "$ZONE"
  +if [ -z "$DEBCONF_RECONFIGURE" ]; then
  +  db_set tzdata/Areas "$AREA"
  +  db_set tzdata/Zones/$AREA "$ZONE"
  +fi
   
   STATE=1
   while [ "$STATE" -ge 0 ]; do
  

Note: the comment could make us believe that keys are initialized with the
current values of the debconf database, but it is not the case. These values
are computed from /etc/timezone.

Thanks,

-- 
Sebastien Bocahu

--- End Message ---
--- Begin Message ---
On Wed, 16 Jan 2019 11:43:57 +0100 Aurelien Jarno <aurel...@aurel32.net> wrote:
> I don't think the patch is correct. Debconf is not a registry, the
> canonical location for the configuration is the configuration files, not
> the debconf database. Quoting debconf-devel(7):
> 
> "The issue to watch out for here is that debconf is not intended to be,
> and must not be used as a registry."
> 
> I think it also applies when DEBCONF_RECONFIGURE is set.

On Mon, 25 Feb 2019 00:35:51 +0100 Aurelien Jarno <aurel...@aurel32.net> wrote:

> Let's look at another example, the locales package prefers debconf to the
> file configuration, just like to ask for tzdata. People consider that as
> a bug, see for example bug #793368.
> 
> It doesn't seem to be possible to support both reconfiguration from
> preseed and from a config file at the same time. It seems some people
> expect one to work the other expect the other. I therefore prefer to not
> change the current behavior and keep the status quo. Also the current
> behavior implemented in tzdata seems to more or less match the "debconf
> ... must not be used as a registry".

I agree with what Aurelien wrote. I am closing this bug, because there
are ways to non-interactively reconfigure tzdata.

Following ways can be used to (re)configure tzdata:

1. If tzdata is not installed yet, feed debconf with values for tzdata
keys and install tzdata afterwards. Example:

```
printf "tzdata tzdata/Areas select Europe\ntzdata tzdata/Zones/Europe select 
Berlin\n" | debconf-set-selections
DEBIAN_FRONTEND=noninteractive apt install tzdata
```

2. Feed debconf with values for tzdata keys. Remove /etc/localtime and
/etc/timezone and reconfigure tzdata to generate these files again.
Example:

```
printf "tzdata tzdata/Areas select Europe\ntzdata tzdata/Zones/Europe select 
Berlin\n" | debconf-set-selections
rm -f /etc/localtime /etc/timezone
dpkg-reconfigure -fnoninteractive tzdata
```

This has a time window where no localtime is configured.

3. Replace /etc/localtime with a symlink to your preferred timezone and
then reconfigure tzdata to update /etc/timezone. Example:

```
ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
dpkg-reconfigure -fnoninteractive tzdata
```

Note: tzdata in Debian 13 "Trixie" will remove /etc/timezone. Then non-
interactively configuring tzdata will be reduced to just replacing the
/etc/localtime symlink. Calling dpkg-reconfigure will not be needed any
more then. Example:

```
ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
```

-- 
Benjamin Drung
Debian & Ubuntu Developer

--- End Message ---

Reply via email to