Bug 14370 - Toaster fails to start in CentOS 8 because it can't detect the timezone
Summary: Toaster fails to start in CentOS 8 because it can't detect the timezone
Status: RESOLVED WONTFIX
Alias: None
Product: Toaster
Classification: Build System, Metadata & Runtime
Component: toaster (show other bugs)
Version: 3.2.3
Hardware: x86 Multiple
: Medium normal
Target Milestone: 5.2 M3
Assignee: David Reyna
QA Contact: Toaster default assignee
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2021-05-01 11:11 UTC by spynet314
Modified: 2025-03-13 04:49 UTC (History)
1 user (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description spynet314 2021-05-01 11:11:30 UTC
Hello,

in my CentOS 8 setup, the script 'bitbake/lib/toaster/toastermain/settings.py' generates the following exception on start:

  File "/home/paolo/poky/bitbake/lib/toaster/toastermain/settings.py", line 86, in <module>
    if pytz.timezone(zonename) is not None:
  File "/usr/lib/python3.6/site-packages/pytz/__init__.py", line 168, in timezone
    _tzinfo_cache[zone] = build_tzinfo(zone, fp)
  File "/usr/lib/python3.6/site-packages/pytz/tzfile.py", line 33, in build_tzinfo
    assert magic == _byte_string('TZif'), 'Got magic %s' % repr(magic)
AssertionError: Got magic b'# Al'

After digging for a while, I found that the above assertion is generated because the folder /usr/share/zoneinfo, that is scanned by the script, contains files that are not timezone descriptors, like for example 'leapseconds', 'zone1970.tab' and 'zone.tab'.

It is possible to avoid this error by exporting the timezone with:
TZ='Europe/Rome'; export TZ

It would be better to modify the script like this:

            try:
                import pytz
                from pytz.exceptions import UnknownTimeZoneError
                try:
                    if pytz.timezone(zonename) is not None:
                        zonefilelist[hashlib.md5(open(filepath, 'rb').rea$
                except UnknownTimeZoneError as ValueError:
                    # we expect timezone failures here, just move over
                    pass
  -->           except AssertionError:
  -->               # there may be files in the folder that generate assertion
  -->               pass
            except ImportError:
                zonefilelist[hashlib.md5(open(filepath, 'rb').read()).hex

Regards,
Paolo
Comment 1 David Reyna 2025-03-13 04:49:25 UTC
CentOS 8 is EOL