You are not logged in.

#1 2014-09-09 02:50:09

gnunn
Member
Registered: 2013-10-21
Posts: 102

Cannot set timezone

I'm having a very weird issue where I cannot use timedatectl to set the timezone. When I run it the following occurs:

[gnunn@gnunn-laptop2 ~]$ timedatectl set-timezone Canada/Mountain
Failed to set time zone: Access denied

When I look at /etc/localtime I can see that it is still symlinked to the old timezone rather then being symlinked to the new file. /etc/localtime is owned by root as per below:

[root@gnunn-laptop2 ~]# ls -l /etc/localtime
lrwxrwxrwx 1 root root 37 Sep  8 20:45 /etc/localtime -> ../usr/share/zoneinfo/Canada/Mountain

I tried running systemd-timedated as root using strace and surprise, surprise everything works as expected when I subsequently run timedatectl so I'm stumped as to the issue is. I can't understand why for the life of me why it works when I run systemd-timedated manually but fails when it gets run in response to timedatectl. When systemd-timedated runs automatically it is run at root so it's not a case of it running under the local user.

When I ran strace against systemd-timedated I can see it is creating the symlink as follows:

stat("/usr/share/zoneinfo/Canada/Mountain", {st_mode=S_IFREG|0644, st_size=2388, ...}) = 0
open("/dev/urandom", O_RDONLY|O_NOCTTY|O_CLOEXEC) = 7
read(7, "\17\17\25\277\25\203\215.", 8) = 8
close(7)                                = 0
symlink("../usr/share/zoneinfo/Canada/Mountain", "/etc/.localtimef0f051fb5138d8e2") = 0
rename("/etc/.localtimef0f051fb5138d8e2", "/etc/localtime") = 0
stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=2388, ...}) = 0

I'm not sure if this is what is causing the access denied, when I try creating the symlink and moving it in the shell as root it works fine.

Any pointers as to what I could be missing here? Alternatively is there a way to run strace against systemd-timedated when it starts in response to timedatectl so I can debug this?

Offline

#2 2014-09-09 03:17:58

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,722

Re: Cannot set timezone

Run that as root.  Preferably using sudo.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#3 2014-09-09 03:40:21

gnunn
Member
Registered: 2013-10-21
Posts: 102

Re: Cannot set timezone

I should have mentioned that I have tried running timedatectl as root with the same results:

[gnunn@gnunn-laptop2 ~]$ sudo timedatectl set-timezone Canada/Eastern
[sudo] password for gnunn: 
Failed to set time zone: Access denied

Offline

#4 2014-09-09 18:26:59

gnunn
Member
Registered: 2013-10-21
Posts: 102

Re: Cannot set timezone

It looks like this is related to DBus, if I start the systemd-timedated service manually with systemctl everything works fine until it stops running. If try to change the time zone and DBus starts it up it fails with "Access Denied" yet I can see the process is running as root. Really stumped on this one, any advice?

Offline

Board footer

Powered by FluxBB