Bug 1870814 - fedora-minimal contains broken tzdata package
Summary: fedora-minimal contains broken tzdata package
Keywords:
Status: NEW
Alias: None
Product: Fedora Container Images
Classification: Fedora
Component: fedora-container-image
Version: 40
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Clement Verna
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-08-20 19:31 UTC by Simon Krenger
Modified: 2024-02-15 22:53 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1668185 0 unspecified CLOSED rhel8-beta container contains broken tzdata package 2024-03-25 15:12:39 UTC
Red Hat Bugzilla 1722233 0 unspecified CLOSED tzdata: Allow complete removal of tzdata. 2024-02-01 16:53:19 UTC

Description Simon Krenger 2020-08-20 19:31:32 UTC
Description of problem:

In the `fedora-minimal:32` container image, the `tzdata` package seems to be installed but broken:

```
$ podman run -it registry.fedoraproject.org/fedora-minimal:32 bash
bash-5.0# rpm -V tzdata
missing     /usr/share/zoneinfo
missing     /usr/share/zoneinfo/Africa
[..]
```

This will lead to application errors (PHP errors in my case) regarding the TZ database. A very similar issue was resolved for the `rhel8-beta` image in BZ#1668185.

Version-Release number of selected component (if applicable):

registry.fedoraproject.org/fedora-minimal:32

How reproducible:

Always

Steps to Reproduce:
1. `podman run -it registry.fedoraproject.org/fedora-minimal:32 bash`
2. `rpm -V tzdata`

Actual results:

```
# rpm -V tzdata
missing     /usr/share/zoneinfo
missing     /usr/share/zoneinfo/Africa
missing     /usr/share/zoneinfo/Africa/Abidjan
missing     /usr/share/zoneinfo/Africa/Accra
missing     /usr/share/zoneinfo/Africa/Addis_Ababa
missing     /usr/share/zoneinfo/Africa/Algiers
# ls -l /usr/share/zoneinfo
ls: cannot access '/usr/share/zoneinfo': No such file or director
```

Expected results:

`microdnf reinstall tzdata` will resolve the issue, `rpm -V` will then succeed:

```
# microdnf reinstall tzdata
Downloading metadata...
Downloading metadata...
Downloading metadata...
Downloading metadata...
Downloading metadata...
Package                                                                                                         Repository                                  Size
Reinstalling:
 tzdata-2020a-1.fc32.noarch                                                                                     updates                          440.1\xc2\xa0kB
Transaction Summary:
 Installing:        0 packages
 Reinstalling:      1 packages
 Upgrading:         0 packages
 Removing:          0 packages
 Downgrading:       0 packages
Downloading packages...
Running transaction test...
Reinstalling: tzdata;2020a-1.fc32;noarch;updates
Complete.
bash-5.0# rpm -V tzdata
# ls -l /usr/share/zoneinfo/
total 420
drwxr-xr-x  2 root root   4096 Aug 20 19:29 Africa
drwxr-xr-x  6 root root   4096 Aug 20 19:29 America
drwxr-xr-x  2 root root   4096 Aug 20 19:29 Antarctica
drwxr-xr-x  2 root root   4096 Aug 20 19:29 Arctic
drwxr-xr-x  2 root root   4096 Aug 20 19:29 Asia
[..]
```

Additional info:

Workaround is to execute `microdnf reinstall tzdata`, see also Bug 1668185

Comment 1 Simon Krenger 2020-08-26 09:57:32 UTC
Removing these files seems to be a deliberate decision: https://pagure.io/fedora-kickstarts/blob/master/f/fedora-container-base-minimal.ks#_39

```
# if you want to change the timezone, bind-mount it from the host or reinstall tzdata
rm -fv /etc/localtime
mv /usr/share/zoneinfo/UTC /etc/localtime
rm -rfv  /usr/share/zoneinfo
```

Proposed fix would be to copy the "/usr/share/zoneinfo/UTC" file back to avoid applications not being able to fall back to UTC.

Comment 2 Carlos O'Donell 2021-02-17 14:31:10 UTC
This needs more work to fix and test.

See: https://bugzilla.redhat.com/show_bug.cgi?id=1722233

Removing files without solving the technical packaging problem is always a bad design choice since it breaks validation.

Comment 3 Fedora Program Management 2021-04-29 17:05:48 UTC
This message is a reminder that Fedora 32 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 32 on 2021-05-25.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '32'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 32 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 4 Simon Krenger 2021-04-29 17:29:44 UTC
Still applies to the latest container image, setting version to 34:

~~~
$ podman run -it registry.fedoraproject.org/fedora-minimal:34 bash
[..]
bash-5.1# rpm -V tzdata
missing     /usr/share/zoneinfo
missing     /usr/share/zoneinfo/Africa
missing     /usr/share/zoneinfo/Africa/Abidjan
missing     /usr/share/zoneinfo/Africa/Accra
missing     /usr/share/zoneinfo/Africa/Addis_Ababa
missing     /usr/share/zoneinfo/Africa/Algiers
missing     /usr/share/zoneinfo/Africa/Asmara
[..]
~~~

Comment 5 Carlos O'Donell 2021-04-29 18:20:55 UTC
(In reply to Simon Krenger from comment #4)
> Still applies to the latest container image, setting version to 34:
> 
> ~~~
> $ podman run -it registry.fedoraproject.org/fedora-minimal:34 bash
> [..]
> bash-5.1# rpm -V tzdata
> missing     /usr/share/zoneinfo
> missing     /usr/share/zoneinfo/Africa
> missing     /usr/share/zoneinfo/Africa/Abidjan
> missing     /usr/share/zoneinfo/Africa/Accra
> missing     /usr/share/zoneinfo/Africa/Addis_Ababa
> missing     /usr/share/zoneinfo/Africa/Algiers
> missing     /usr/share/zoneinfo/Africa/Asmara
> [..]
> ~~~

My team is still looking at how to fix this. Right now Patsy is engaging the python devs to see if the removal of the files can break some of their APIs in various modules. We want the removal of the files to trigger appropriate API error messages and not just crash or terminate the process.

Comment 6 Simon Krenger 2021-11-05 07:51:18 UTC
Still applies to the latest container image, setting version to 35:

~~~
$ podman run -it registry.fedoraproject.org/fedora-minimal:35 bash
bash-5.1# rpm -V tzdata
missing     /usr/share/zoneinfo
missing     /usr/share/zoneinfo/Africa
missing     /usr/share/zoneinfo/Africa/Abidjan
missing     /usr/share/zoneinfo/Africa/Accra
missing     /usr/share/zoneinfo/Africa/Addis_Ababa
missing     /usr/share/zoneinfo/Africa/Algiers
missing     /usr/share/zoneinfo/Africa/Asmara
[..]
~~~

Comment 7 Carlos O'Donell 2022-02-14 20:53:46 UTC
We are still working on this issue for tzdata. It still applies to Fedora Rawhide.

The fix will be in glibc and tzdata followed by coordinating with the image creation process to remove tzdata.

Comment 8 Ben Cotton 2022-08-09 13:11:06 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 37 development cycle.
Changing version to 37.

Comment 9 ivanov17 2023-10-24 06:10:19 UTC
The same thing happens with the Fedora 38 minimal container:

bash-5.2# rpm -V tzdata
missing     /usr/share/zoneinfo
missing     /usr/share/zoneinfo/Africa
missing     /usr/share/zoneinfo/Africa/Abidjan
missing     /usr/share/zoneinfo/Africa/Accra
missing     /usr/share/zoneinfo/Africa/Addis_Ababa
missing     /usr/share/zoneinfo/Africa/Algiers
missing     /usr/share/zoneinfo/Africa/Asmara
missing     /usr/share/zoneinfo/Africa/Asmera
missing     /usr/share/zoneinfo/Africa/Bamako
missing     /usr/share/zoneinfo/Africa/Bangui
missing     /usr/share/zoneinfo/Africa/Banjul
missing     /usr/share/zoneinfo/Africa/Bissau
missing     /usr/share/zoneinfo/Africa/Blantyre
missing     /usr/share/zoneinfo/Africa/Brazzaville
missing     /usr/share/zoneinfo/Africa/Bujumbura
...

As a result, PHP does not work:

PHP Warning:  PHP Startup: Invalid date.timezone value 'UTC', using 'UTC' instead in Unknown on line 0
PHP Fatal error:  Uncaught Error: Timezone database is corrupt. Please file a bug report as this should never happen in /usr/share/php/Composer/Util/Silencer.php:67

Comment 10 Carlos O'Donell 2023-10-24 11:20:41 UTC
(In reply to ivanov17 from comment #9)
> The same thing happens with the Fedora 38 minimal container:

Fedora 38 will remain broken.

Starting with Fedora 39:
https://fedoraproject.org/wiki/Changes/AllowRemovalOfTzdata

We can have tzdata correctly uninstalled.

Which means that a PHP dependency on tzdata should install it correctly.

The next step would be to modify the kickstarts like this:
* include tzdata in the base container image (no matter what)
* remove tzdata from the minimal image (such that installing php into it would install it again)

e.g.
diff --git a/fedora-container-base-minimal.ks b/fedora-container-base-minimal.ks
index 9a92ce9..5d62aa9 100644
--- a/fedora-container-base-minimal.ks
+++ b/fedora-container-base-minimal.ks
@@ -6,7 +6,7 @@
 
 %packages --excludedocs --instLangs=en --nocore --excludeWeakdeps
 microdnf
-
+-tzdata
 %end
 
 %post --erroronfail --log=/root/anaconda-post.log
@@ -33,11 +33,6 @@ rm -fv /usr/bin/pinky
 # we lose presets by removing /usr/lib/systemd but we do not care
 rm -rfv /usr/lib/systemd
 
-# if you want to change the timezone, bind-mount it from the host or reinstall tzdata
-rm -fv /etc/localtime
-mv /usr/share/zoneinfo/UTC /etc/localtime
-rm -rfv  /usr/share/zoneinfo
-
 # Final pruning
 rm -rfv /var/cache/* /var/log/* /tmp/*
 
diff --git a/fedora-container-common.ks b/fedora-container-common.ks
index 3637c89..644859d 100644
--- a/fedora-container-common.ks
+++ b/fedora-container-common.ks
@@ -35,6 +35,7 @@ fedora-release-container
 bash
 coreutils
 glibc-minimal-langpack
+tzdata
 rpm
 util-linux-core
 -kernel
---
https://pagure.io/fedora-kickstarts

Comment 11 Carlos O'Donell 2023-10-24 11:37:22 UTC
I've submitted a blind pull request to update the kickstarts:
https://pagure.io/fedora-kickstarts/pull-request/1001

The instructions to use imagefactory didn't work for me to test locally.

Comment 12 ivanov17 2023-10-24 16:14:27 UTC
Thank you for the detailed explanation. Carlos, am I correct in understanding that there are no longer plans to create a minimal tzdata package containing only UTC zones?

Comment 13 Carlos O'Donell 2023-10-25 04:32:31 UTC
(In reply to ivanov17 from comment #12)
> Thank you for the detailed explanation. Carlos, am I correct in
> understanding that there are no longer plans to create a minimal tzdata
> package containing only UTC zones?

Correct.

Either tzdata is installed and you get all the zones.

or

Tzdata is not installed and the system is assumed UTC.

Comment 14 Aoife Moloney 2024-02-15 22:53:40 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 40 development cycle.
Changing version to 40.


Note You need to log in before you can comment on or make changes to this bug.