System Time Set to UTC During Init

Discussion in general that pertains to Sabayon Linux - Must Pertain to Sabayon Linux

Moderator: Moderators

Post Reply
nomadicME
Baby Hen
Posts: 4
Joined: Sat Jan 26, 2013 22:33

System Time Set to UTC During Init

Post by nomadicME » Tue Jul 08, 2014 20:11

I'm having trouble getting my clock setup worked out. My hwclock is UTC, but when I login to my awesome wm the clock there also reads UTC time.

I've read the wiki page on this. One question I have is whether or not I am using Baselayout-2 and OpenRC. I believe I am using systemd as that is where I have been editing my init scripts, but /etc/conf.d/hwclock was installed not /etc/conf.d/clock which it says on the wiki is the the systemd config file for the clock. Which config file should I be using?

Also why is openrc still installed by the livecd (just installed a couple days ago) and required by so many packages if it is no longer supported. Just wondering (no attitude) :)

I can set the system time fine, and that is what I'm currently doing. What I'm wondering is why the system clock is set to UTC during the init process and not the local time. I'd like to get that worked out first before I mask the problem by setting the clock manually with a script in local.d. Thanks.

User avatar
sabayonino
Sagely Hen
Posts: 3190
Joined: Sun Sep 21, 2008 1:12
Location: Italy
Contact:

Re: System Time Set to UTC During Init

Post by sabayonino » Tue Jul 08, 2014 23:19

Hi

sabayon runs SystemD : please read Time Zone & System Clock & Hardware Clock wikies
[Che Cos'è Il Calcolo Distribuito (BOINC)

BOINC ready ! Sabayon+BOINC = BILD ,my Sabayon spin :cyclops: - Ready to crunch for the Science everywhere :)

nomadicME
Baby Hen
Posts: 4
Joined: Sat Jan 26, 2013 22:33

Re: System Time Set to UTC During Init

Post by nomadicME » Wed Jul 09, 2014 3:34

sabayonino I read that whole wiki page as well as the relevant wiki pages for sabayon, and I am not getting anywhere.

I tried: timedatectl set-local-rtc 0 result -> system clock reports UTC time.
I tried: timedatectl set-local-rtc 1 result -> system clock reports UTC time. with the additional warning (in the output of timedatectl):
Warning: The RTC is configured to maintain time in the local timezone. This
mode is not fully supported and will create various problems with time
zone changes and daylight saving adjustments. If at all possible use
RTC in UTC, by calling 'timedatectl set-local-rtc 0'.
So I set it back: timedatectl set-local-rtc 0

I tried CLOCK="UTC" in /etc/conf.d/clock result -> system clock reports UTC time.
I tried CLOCK="local" in /etc/conf.d/clock result -> system clock reports UTC time.

Out of desperation I even tried (even though I know this is the openrc time conf file):
CLOCK="UTC" in /etc/conf.d/hwclock result -> system clock reports UTC time.
CLOCK="local" in /etc/conf.d/hwclock result -> system clock reports UTC time.

Of course I rebooted each time I made these changes. I have verified that I don't have any scripts in local.d that are changing the time during init.

The accurate localtime is reported by hwclock:
$ sudo hwclock --utc --show
Tue 08 Jul 2014 11:43:01 PM MDT -0.625875 seconds
A few seconds later:
$ timedatectl
Local time: Wed 2014-07-09 05:43:05 MDT
Universal time: Wed 2014-07-09 11:43:05 UTC
Timezone: America/Denver (MDT, -0600)
NTP enabled: yes
NTP synchronized: no
RTC in local TZ: no
DST active: yes
Last DST change: DST began at
Sun 2014-03-09 01:59:59 MST
Sun 2014-03-09 03:00:00 MDT
Next DST change: DST ends (the clock jumps one hour backwards) at
Sun 2014-11-02 01:59:59 MDT
Sun 2014-11-02 01:00:00 MST
This is really driving me nuts. It seems no matter what I do the system time comes up UTC. What am I missing?
Last edited by nomadicME on Wed Jul 09, 2014 16:54, edited 4 times in total.

User avatar
linuxfluesterer
Old Dear Hen
Posts: 864
Joined: Thu Sep 20, 2012 19:47
Location: Germany

Re: System Time Set to UTC During Init

Post by linuxfluesterer » Wed Jul 09, 2014 7:42

This is the directory, where all timzones are stored:

Code: Select all

/usr/share/zoneinfo
Now, assumed, you want to set Denver time, then open a root console and copy first the following to /etc/localtime:

Code: Select all

cp /usr/share/zoneinfo/America/Denver /etc/localtime
Now, you may check with

Code: Select all

date
Wed Jul  9 00:28:05 MDT 2014
In addition to keep your (local) time up to date, you may add:

Code: Select all

0 * * * *       root    /usr/sbin/ntpdate us.pool.ntp.org
to your /etc/crontab file.
Hope, this will help.
Btw. To simply check, you run systemd, type:

Code: Select all

systemctl --all
(a list should appear...).

-Linuxfluesterer (I love KDE ...)
Take away Facebook from me and let there be real people again...

nomadicME
Baby Hen
Posts: 4
Joined: Sat Jan 26, 2013 22:33

Re: System Time Set to UTC During Init

Post by nomadicME » Wed Jul 09, 2014 16:43

linuxfluesterer, thank you for the ideas.

ls /etc/localtime
lrwxrwxrwx 1 root root 36 2014-07-03 21:19 /etc/localtime -> ../usr/share/zoneinfo/America/Denver

This was setup by the livecd installer.

I don't want to run NTP as I set my time (once I get this straightened out) from a gps on the network via gpsd. And again setting the clock manually is not the problem here. I can do that no problem. The problem is that the system clock is set to UTC instead of localtime during the init process.

User avatar
linuxfluesterer
Old Dear Hen
Posts: 864
Joined: Thu Sep 20, 2012 19:47
Location: Germany

Re: System Time Set to UTC During Init

Post by linuxfluesterer » Thu Jul 10, 2014 3:42

Hmmm, it seems your hardware clock is set to URL time...
So, then, how about to set your hardware clock to system time (provided a correct local time) with this command:

Code: Select all

hwclock --systohc
-Linuxfluesterer (I love KDE ...)
Take away Facebook from me and let there be real people again...

Post Reply