fedora-minimal: Broken tzdata

For my own container images, I often like to use the Fedora Container Images as the base image. This means I often use the “fedora:32” or “fedora-minimal:32” image when building my own images.

Yesterday, while playing around with an image based on the “fedora-minimal” image that then uses nginx and php-fpm, I came across this curious error:

Invalid date.timezone value 'UTC', we selected the timezone 'UTC' for now

Very strange, looks like PHP does not know which timezones are valid. The complete error message reads like this:

[error] 9#0: *91 FastCGI sent in stderr: "PHP message: PHP Warning:  timezone_open(): Unknown or bad timezone (Europe/Zurich) in /usr/share/nginx/html/wp-includes/functions.php on line 5686PHP message: PHP Warning:  date_create(): Invalid date.timezone value 'UTC', we selected the timezone 'UTC' for now. in /usr/share/nginx/html/wp-includes/functions.php on line 5687PHP message: PHP Fatal error:  date_create(): Timezone database is corrupt - this should *never* happen! in /usr/share/nginx/html/wp-includes/functions.php on line 5687" while reading response header from upstream, client: 127.0.0.1, server: _, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm/www.sock:", host: "localhost:8080"

Upon investigation, I found that the relevant /usr/share/zoneinfo folder did not exist, even though the tzdata package was installed:

# microdnf install tzdata
[..]
# ls -l /usr/share/zoneinfo
ls: cannot access '/usr/share/zoneinfo': No such file or director

It turns out that while the tzdata package is installed, it is indeed broken in the base image:

# 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
[..]

This seems to be a known issue, at least for the RHEL8 UBI images, as I found in BugZilla 1668185, but the fix has not made its way into the Fedora images.

I filed BugZilla 1870814, the current workaround is to reinstall the package using microdnf reinstall tzdata , which will reinstall the files.

Hello world

My name is Simon Krenger, I am a Technical Account Manager (TAM) at Red Hat. I advise our customers in using Kubernetes, Containers, Linux and Open Source.

Elsewhere

  1. GitHub
  2. LinkedIn
  3. GitLab