Bug 12316

Summary: tzdata fails to install with empty "default local time"
Product: buildroot Reporter: Andrew Trapani <andrew.trapani>
Component: OtherAssignee: Yann E. MORIN <yann.morin.1998>
Status: RESOLVED FIXED    
Severity: normal CC: andrew.trapani, buildroot, yann.morin.1998
Priority: P5    
Version: 2019.02.2   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target: aarch64 on Nvidia TX2
Build:
Attachments: Config with Etc/UTC installed (tzdata completes)
After applying tzpatch output

Description Andrew Trapani 2019-11-15 18:56:33 UTC
Option #1:

Under menuconfig
System configuration  --->
-*- Install timezone info
 (default) timezone list
 ()    default local time 

My understanding after doing internet searches was that an empty "default local time" field would be set to Etc/UTC.


However, the build failed here:
>>> host-tzdata 2018e Installing to host directory
>>> tzdata 2018e Extracting
>>> tzdata 2018e Patching
>>> tzdata 2018e Configuring
>>> tzdata 2018e Building
>>> tzdata 2018e Installing to target
Error: '' is not a valid timezone, check your BR2_TARGET_LOCALTIME setting
package/pkg-generic.mk:331: recipe for target '/build/output/tx2_basecamp/build/tzdata-2018e/.stamp_target_installed' failed
make[1]: *** [/build/output/tx2_basecamp/build/tzdata-2018e/.stamp_target_installed] Error 1
Makefile:23: recipe for target '_all' failed
make: *** [_all] Error 2
Could not create rootfs... not building image
Makefile:89: recipe for target 'docker_build_image' failed


Option #2:
Then Under menuconfig

 -*- Install timezone info
 (default) timezone list
 (Etc/UTC) default local time 

Then tzdata works and the build continues.



Do a symsearch for TZDATA to find out what is required:
Symbol: BR2_PACKAGE_TZDATA [=y]
Type  : bool
  Defined at package/tzdata/Config.in:4
  Selected by [y]:
  - BR2_TARGET_TZ_INFO [=y] && BR2_TOOLCHAIN_USES_GLIBC [=y]
  Selected by [n]:
  - BR2_TARGET_TZ_INFO [=y] && BR2_TOOLCHAIN_USES_MUSL [=n] 


The config is attached, but please be warned that it references local paths to local things and won't build for you.

It also has Etc/UTC set as the "default local time". This is how I got tzdata to complete.
Comment 1 Andrew Trapani 2019-11-15 18:58:48 UTC
Created attachment 8281 [details]
Config with Etc/UTC installed (tzdata completes)

.config file saved from menuconfig with default local time set to Etc/UTC

Warning: This config references local paths and to local things, and won't build for you.
Comment 2 Yann E. MORIN 2019-11-16 09:11:32 UTC
Andrew,
Thanks for the report.

I just sent a patch that I believe handles this case:
    https://patchwork.ozlabs.org/patch/1196072/

Care to test that, and report, please?

Regards,
Yann E. MORIN.
Comment 3 Andrew Trapani 2019-11-19 17:52:36 UTC
Created attachment 8286 [details]
After applying tzpatch output
Comment 4 Andrew Trapani 2019-11-19 17:53:11 UTC
I replied to the email, but it didn't respond here. Inconvenient....

Thank Yann,

(This is my first time with a patch)

How to make sure it re-builds tzdata? Or maybe it worked?


Looks like the "mbox" button gives me a .patch file on the webpage. Excellent

I could add it to "br2-patches" and it gets used when I go to menuconfig:
Applying patch: system-allow-not-setting-a-default-system-wide-time-zone.patch...
patching file package/tz/tz.mk
patching file package/tzdata/tzdata.mk
Hunk #1 succeeded at 25 (offset -1 lines).
Hunk #2 succeeded at 47 (offset -1 lines).
patching file system/Config.in
Hunk #1 succeeded at 481 (offset -13 lines).
Removing intermediate container e9bde13f6ee5
 ---> 8bc39f5e0e49

1. Copy ".patch" file into br2-patches
2. Go to menuconfig.
3. Note the patch is actually applied
4. Go to System Configuration
5. Modify "default local time"
6. Change from "Etc/UTC" to empty.
7. F6 to save and F9 to exit
8. Note: No errors on save and exit
9. Start the build and save all output to a file (stdout and stderr)
10. Wasn't able to find "tzdata" in the output