Unable to set timezone in linux

By default, the time is updated when I connect to the internet and the timezone is set to UTC.

I want to change it to “Asia/Kolkata” but I get an invalid timezone error. I do not have the external RTC powered. How can I fix this?

sh-4.4# timedatectl list-timezones | egrep -o "Asia/K.*"
Asia/Kabul
Asia/Kamchatka
Asia/Karachi
Asia/Kathmandu
Asia/Khandyga
Asia/Kolkata
Asia/Krasnoyarsk
Asia/Kuala_Lumpur
Asia/Kuching
Asia/Kuwait

sh-4.4# timedatectl set-timezone "Asia/Kolkata"
Failed to set time zone: Invalid time zone 'Asia/Kolkata'

Hi

Please have a look on this community post.

Max

Hi,

I already tried that but I get the following output:

root@colibri-imx7:~# opkg install tzdata-asia
Installing tzdata-asia (2017c) on root
Downloading http://feeds.toradex.com/angstrom/feeds/v2017.12/ipk/glibc/all/tzdata-asia_2017c-r0.0_all.ipk.
To remove package debris, try `opkg remove tzdata-asia`.
To re-attempt the install, try `opkg install tzdata-asia`.
Installing adwaita-icon-theme-symbolic (3.24.0) on root
Downloading http://feeds.toradex.com/angstrom/feeds/v2017.12/ipk/glibc/all/adwaita-icon-theme-symbolic_3.24.0-r0.0_all.ipk.
Configuring adwaita-icon-theme-symbolic.
Collected errors:
 * check_data_file_clashes: Package tzdata-asia wants to install file /usr/share/zoneinfo/Asia/Bangkok
        But that file is already provided by package  * tzdata

So I removed tzdata and tried again. Not working.

root@colibri-imx7:~# opkg remove tzdata
Removing tzdata (2018f) from root...
root@colibri-imx7:~# opkg install tzdata-asia
Installing tzdata (2017c) on root
Downloading http://feeds.toradex.com/angstrom/feeds/v2017.12/ipk/glibc/all/tzdata_2017c-r0.0_all.ipk.
Configuring tzdata.
root@colibri-imx7:~# timedatectl set-timezone "Asia/Kolkata"
Failed to set time zone: Invalid time zone 'Asia/Kolkata'

HI @design

I tried it on my side and it is working fine.

root@colibri-imx7-emmc:~# timedatectl set-timezone "Asia/Kolkata"
root@colibri-imx7-emmc:~# timedatectl 
      Local time: Mon 2020-01-06 21:36:07 IST
  Universal time: Mon 2020-01-06 16:06:07 UTC
        RTC time: Mon 2020-01-06 16:06:08
       Time zone: Asia/Kolkata (IST, +0530)
 Network time on: yes
NTP synchronized: yes
 RTC in local TZ: no
root@colibri-imx7-emmc:~# uname -a
Linux colibri-imx7-emmc 4.9.166-2.8.6+gd899927728be #1 SMP Mon Apr 1 13:16:28 UTC 2019 armv7l GNU/Linux

Best regards,
Jaski

Hi @jaski.tx,

I got it to work. I had to remove tzdata first because it causes clashes at “Bangkok”. I also had to remove tzdata-asia, since it had been installed incorrectly in the earlier attempts. This was my problem. After ensuring that both had been removed, the rest worked as expected.

Did you also have to uninstall tzdata?

Thanks

Perfect that it is working.

Yes.I removed tzdata too.

Best regards,
Jaski