timedatectl on ubuntu server 20.04

I could not duplicate your error on a plain Ubuntu 20.04 image. You should be checking if the command changes /etc/timezone and the /etc/localtime symlink. Also check what the permissions on those files are. If you are running selinux or other security software then that is another possible cause for the error.

root@ubuntu:~# date
Wed Aug 11 16:05:25 UTC 2021
root@ubuntu:~# timedatectl
               Local time: Wed 2021-08-11 16:05:28 UTC
           Universal time: Wed 2021-08-11 16:05:28 UTC
                 RTC time: Wed 2021-08-11 16:05:29
                Time zone: Etc/UTC (UTC, +0000)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no
root@ubuntu:~# cat /etc/timezone
Etc/UTC
root@ubuntu:~# ls -l /etc/localtime
lrwxrwxrwx 1 root root 29 Aug 11 15:39 /etc/localtime -> ../usr/share/zoneinfo/Etc/UTC


root@ubuntu:~# timedatectl set-timezone Europe/London
root@ubuntu:~# date
Wed Aug 11 17:05:51 BST 2021
root@ubuntu:~# timedatectl
               Local time: Wed 2021-08-11 17:05:59 BST
           Universal time: Wed 2021-08-11 16:05:59 UTC
                 RTC time: Wed 2021-08-11 16:06:00
                Time zone: Europe/London (BST, +0100)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no
root@ubuntu:~# cat /etc/timezone
Europe/London
root@ubuntu:~# ls -l /etc/localtime
lrwxrwxrwx 1 root root 35 Aug 11 17:05 /etc/localtime -> ../usr/share/zoneinfo/Europe/London

These steps are another way to automate changing the timezone.

  1. Update the /etc/localtime symlink
  2. Run dpkg-reconfigure --frontend noninteractive tzdata

You can see these steps will update the /etc/timezone file as well.

root@ubuntu:~# date
Wed Aug 11 16:09:30 UTC 2021
root@ubuntu:~# ln -f -s /usr/share/zoneinfo/Europe/London /etc/localtime
root@ubuntu:~# dpkg-reconfigure --frontend noninteractive tzdata

Current default time zone: 'Europe/London'
Local time is now:      Wed Aug 11 17:10:30 BST 2021.
Universal Time is now:  Wed Aug 11 16:10:30 UTC 2021.

root@ubuntu:~# date
Wed Aug 11 17:10:34 BST 2021
root@ubuntu:~# cat /etc/timezone
Europe/London
root@ubuntu:~# ls -l /etc/localtime
lrwxrwxrwx 1 root root 33 Aug 11 17:10 /etc/localtime -> /usr/share/zoneinfo/Europe/London