Description

Customer was unable to set Time-zone as Time-zone file is not available on our QFX switch.

Symptoms

Not able to set time zone using set system time-zone command as TZ file is missing from  /usr/share/zoneinfo/ directory. 

Getting below error:- 
# set system time-zone ? 
Possible completions: 
<time-zone> Time zone name or POSIX-compliant time zone string 
find: *: No such file or directory 

 

Solution

Download the latest TZ file from "https://www.iana.org/time-zones"

Log into the Junos device and open shell mode: 
            # start shell

Create a tz directory in the /var/tmp and navigate to that directory 
            # mkdir /var/tmp/tz
      # cd /var/tmp/tz


Upload the File Via FTP/SFTP to the newly created directory.

Extract the file with extension tar.lz
            # start shell user root
          # Tar -xvf tzdata2024a.tar.gz


After extracting the file, you would be able to see the TZ files from various continents and time zone.

Select the names of time zone files to compile and feed them to the following script.
For example, to generate asia tz files:
            # /usr/libexec/ui/compile-tz asia   
            # zic asia

Copy the extracted tz asia file in the directory /var/db/zoneinfo/ ----> (This is user created time zone directory)

             # cp asia/var/db/zoneinfo/

Using the CLI, configure the router or switch to enable the use of the generated tz files as follows:
             # set system use-imported-time-zones
             # commit

                  
Now the newly generated TZ file would be available in /var/db/zoneinfo and you can set the time zone:-
            
 # set system time-zone
 Possible completions:
 <time-zone>  Time zone name or POSIX-compliant time zone string
 Asia/Aden
 Asia/Almaty
 Asia/Amman
 Asia/Anadyr....

Modification History

2024-06-11: Article validated
2024-06-03 : Article Created

Related Information

https://www.juniper.net/documentation/us/en/software/junos/time-mgmt/topics/topic-map/configure-time-zone.html#importing-and-installing-time-zone-files:~:text=Custom%20Time%20Zone-,Import%20and%20Install%20Time%20Zone%20Files,-The%20IANA%20Time