Unable to set timezone with timedatectl when selinux is in "Enforcing mode".

Solution Verified - Updated -

Issue

  • timedatectl gives error asFailed to set time zone: Access denied while setting timezone.
[root@test]# timedatectl set-timezone Europe/Luxembourg
Failed to set time zone: Access denied

In the /var/log/audit/audit.log is possible to see following message

type=SERVICE_START msg=audit(1680395088.982:164441): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-timedated comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
type=AVC msg=audit(1680395093.387:164442): avc:  denied  { unlink } for  pid=54319 comm="systemd-timedat" name="localtime" dev="vda3" ino=146401 scontext=system_u:system_r:systemd_timedated_t:s0 tcontext=system_u:object_r:etc_t:s0 tclass=lnk_file permissive=0
type=SYSCALL msg=audit(1680395093.387:164442): arch=c000003e syscall=82 success=no exit=-13 a0=55f1afea7990 a1=55f1ae140d6a a2=0 a3=20 items=0 ppid=1 pid=54319 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="systemd-timedat" exe="/usr/lib/systemd/systemd-timedated" subj=system_u:system_r:systemd_timedated_t:s0 key=(null)
type=PROCTITLE msg=audit(1680395093.387:164442): proctitle="/usr/lib/systemd/systemd-timedated"

Environment

  • Red Hat Enterprise Linux 7

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content