The officially official Devuan Forum!

You are not logged in.

#1 2020-08-27 21:06:33

tlathm
Member
Registered: 2017-11-25
Posts: 103  

dpkg-reconfigure -f noninteractive tzdata not working in Beowulf?

Wow...did this one have me going nuts. Writing the timezone to /etc/timezone and then using dpkg-reconfigure seems wildly broken in Beowulf. This definitely worked in Jessie:

# date
Thu 27 Aug 2020 04:44:20 PM EDT
# cat /etc/timezone 
America/New_York
# ll /etc/localtime 
lrwxrwxrwx 1 root root 36 Aug 27 16:43 /etc/localtime -> /usr/share/zoneinfo/America/New_York
# echo America/Chicago > /etc/timezone 
# dpkg-reconfigure -f noninteractive tzdata

Current default time zone: 'America/New_York'
Local time is now:      Thu Aug 27 16:44:53 EDT 2020.
Universal Time is now:  Thu Aug 27 20:44:53 UTC 2020.

# date
Thu 27 Aug 2020 04:44:56 PM EDT
# cat /etc/timezone 
America/New_York

So it's rewriting /etc/timezone to the old timezone and apparently using that? Anyone else run into this? Again, under Jessie this would have configured it to central time correctly.

On thing that may be related: In Beowulf /etc/localtime is a symbolic link to the actual file in /usr/share/zoneinfo and under Jessie it was a physical copy of the file. I always thought that links for that were not advised, because in cases where /usr is not part of / it might not be available during boot(???).

We do this in a setup wizard for our product and started getting burned really bad by this. For the time being I may just work around it by doing an "ln -snf <zonefile> /etc/localtime.

Thanks in advance.

Tom

Last edited by tlathm (2020-08-27 21:17:41)

Offline

#2 2020-08-29 10:30:19

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Re: dpkg-reconfigure -f noninteractive tzdata not working in Beowulf?

tlathm wrote:

For the time being I may just work around it by doing an "ln -snf <zonefile> /etc/localtime.

That's exactly what the postinst script does:

if [ "$1" = configure ]; then
    # If the user prefers to manage the time zone by itself, let him doing that.

    if ! [ -e /etc/timezone ] && [ -z "$DEBCONF_RECONFIGURE" ] ; then
        db_stop
        echo
        echo "User defined time zone, leaving /etc/localtime unchanged."
    else
    
        # Get the values from debconf
        AREA=Etc
        ZONE=UTC
        db_get tzdata/Areas && AREA="$RET"
        db_get tzdata/Zones/$AREA && ZONE="$RET"
        db_stop
    
        # Update the time zone
        echo $AREA/$ZONE > /etc/timezone
        ln -nsf /usr/share/zoneinfo/$AREA/$ZONE /etc/localtime.dpkg-new && \
            mv -f /etc/localtime.dpkg-new /etc/localtime
        which restorecon >/dev/null 2>&1 && restorecon /etc/localtime
    
        echo 
        echo "Current default time zone: '$AREA/$ZONE'"
    fi

    # Show the new setting to the user
    TZBase=$(LC_ALL=C TZ=UTC0 date)
    UTdate=$(LC_ALL=C TZ=UTC0 date -d "$TZBase")
    TZdate=$(unset TZ ; LANG=C date -d "$TZBase")
    echo "Local time is now:      $TZdate."
    echo "Universal Time is now:  $UTdate."
    if [ -z "$DEBCONF_RECONFIGURE" ] ; then
        echo "Run 'dpkg-reconfigure tzdata' if you wish to change it."
    fi
    echo
fi

EDIT: added the rest of the configure option.

Last edited by Head_on_a_Stick (2020-08-29 10:31:44)


Brianna Ghey — Rest In Power

Offline

#3 2020-08-29 11:03:39

tlathm
Member
Registered: 2017-11-25
Posts: 103  

Re: dpkg-reconfigure -f noninteractive tzdata not working in Beowulf?

Yea, that's what I ended up doing in out stuff. Odd though...I have no idea what dpkg-reconfigure with the noninteractive frontend is doing as compared to what it used to do. It seems to be basing it on the existing /etc/localtime link instead of the timezone in /etc/timezone.

Tom

Offline

Board footer