Bug 841859

Summary: I can't disable UTC
Product: [openSUSE] openSUSE Tumbleweed Reporter: Segundo Luis Martín Díaz Sotomayor <smartinds>
Component: YaST2Assignee: Jiří Suchomel <jsuchome>
Status: RESOLVED FIXED QA Contact: Jiri Srain <jsrain>
Severity: Major    
Priority: P5 - None CC: fcrozat, forgotten_5bOUleMVRM, trenn, werner
Version: 13.1 Beta 1   
Target Milestone: ---   
Hardware: x86-64   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: Yast Log
Adjtime
/etc/sysconfig/clock
journalctl > output.log
patch for Timezone.rb

Description Segundo Luis Martín Díaz Sotomayor 2013-09-23 15:31:40 UTC
User-Agent:       Mozilla/5.0 (X11; Linux x86_64; rv:23.0) Gecko/20100101 Firefox/23.0

When I turn on my laptop, the time is incorrect.

So, I go to Yast > System > Configure time and disable the checkbox "UTC" and the time is correct again.

BUT, when I re-open Yast, the checkbox "UTC" is enabled again.


Reproducible: Always

Steps to Reproduce:
1. The time is incorrect.
2. Go to Yast > System > Configure time and disable the checkbox "UTC"
3. Re-open Yast
4. Go to Yast > System > Configure

Actual Results:  
The checkbox "UTC" is enabled again.

Expected Results:  
The checkbox "UTC" must be as I configured, in this case, disable.
Comment 1 Gabriele Mohr 2013-09-26 07:27:05 UTC
Please attach YaST logs, 
see http://en.opensuse.org/openSUSE:Report_a_YaST_bug.
Comment 2 Jiří Suchomel 2013-09-26 07:56:35 UTC
... and attach also your /etc/adjtime, /etc/sysconfig/clock, abd check if the output of hwclock --localtime shows your current time
Comment 3 Dr. Werner Fink 2013-09-26 08:08:48 UTC
Are you using dracut instead of mkinitrd?  ... Dracut is missing a major feature regarding UTC/localtime in CMOS.

Please report the outout of the command

       lsof /etc/adjtime

done as superuser root. Also please attach the output the command

       journalctl > output.log

done as superuser.

Beside this I'd like to know *why* you're using localtime in CMOS?  I'd like to understand the reasons to break this common rule.  Using localtime in CMOS causing trouble twice a year as the linux kernels system clock has to be always in UTC.
Comment 4 Segundo Luis Martín Díaz Sotomayor 2013-09-26 14:08:53 UTC
Created attachment 560337 [details]
Yast Log
Comment 5 Segundo Luis Martín Díaz Sotomayor 2013-09-26 14:12:26 UTC
Created attachment 560339 [details]
Adjtime
Comment 6 Segundo Luis Martín Díaz Sotomayor 2013-09-26 14:13:11 UTC
Created attachment 560340 [details]
/etc/sysconfig/clock
Comment 7 Segundo Luis Martín Díaz Sotomayor 2013-09-26 14:13:59 UTC
Created attachment 560341 [details]
journalctl > output.log
Comment 8 Segundo Luis Martín Díaz Sotomayor 2013-09-26 14:19:18 UTC
<<check if the output of hwclock --localtime shows your current time>>

kaede:/home/zchronos # hwclock --localtime
jue 26 sep 2013 08:56:01 PET  -0.141330 segundos

Yep, this is the current time.

<<Please report the outout of the command lsof /etc/adjtime>>

kaede:/home/zchronos # lsof /etc/adjtime
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
      Output information may be incomplete.
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /var/run/user/1000/gvfs
      Output information may be incomplete.

<<<Beside this I'd like to know *why* you're using localtime in CMOS?  I'd like to
understand the reasons to break this common rule.  Using localtime in CMOS
causing trouble twice a year as the linux kernels system clock has to be always
in UTC.>>

Because when I configure in UTC mode, the time wrong. In localtime the time is correct. My country is Peru (America/Lima  GMT-5)
Comment 9 Dr. Werner Fink 2013-09-27 06:40:52 UTC
(In reply to comment #8)

> Because when I configure in UTC mode, the time wrong. In localtime the time is
> correct. My country is Peru (America/Lima  GMT-5)

Then the localtime of the user space is not correct configured.

First of all the kernelßs system clock is in UTC.

Second the user space time (reported by e.f. the command date) is given by the file /etc/localtime which is a symbolic link to one of the zone file below /usr/share/zoneinfo/ which provides the correct teim offset to UTC ... in your case this is America/Lima  with UTC-5 *and* it provides the rules used for setting e.g. Daylight Saving Time (DST)

Third you can also use the environment variable TZ to override the /etc/localtime by any other zone file below /usr/share/zoneinfo/

E.g.

     werner@boole:~> TZ=UTC date                     <--- kernel's clock
     Fri Sep 27 06:33:44 UTC 2013
     werner@boole:~> date                            <--- User space clock
     Fri Sep 27 08:33:48 CEST 2013
     werner@boole:~> TZ=America/Lima date            <--- Overwritten with PET
     Fri Sep 27 01:34:24 PET 2013

Compare this with http://en.opensuse.org/SDB:Configuring_the_clock
Comment 10 Dr. Werner Fink 2013-09-27 06:48:10 UTC
From the journalctl log:

 sep 26 03:43:14 kaede kernel: rtc_cmos 00:05: setting system clock to 2013-09-26 08:43:11 UTC (1380184991)

that is that the kernel reads out the clock from the CMOS. If the clock in CMOS is in UTC then the kernel's clock is in UTC.  If the symbolic link /etc/localtime  points to /usr/share/zoneinfo/America/Lima the date command should report the correct time that is localtime.
Comment 11 Forgotten User 5bOUleMVRM 2013-09-28 15:56:48 UTC
I encountered the same problem on a dual boot system. Due to limitations of the other OS, the hardware clock is set to local time, therefore I left the check box "computer clock set to UTC" unchecked on the 2nd installation screen. This setup has worked for many years.

With openSUSE 13.1 beta the date command shows a local time 2 hours later then the hardware clock, which would be correct if the hardware clock was set to UTC. When I run the Date and Time module from YaST Control Center the mentioned check box is marked as checked although it was not during installation. When I uncheck this box, the time becomes displayed correctly, but this lasts only to next boot.
Comment 12 Dr. Werner Fink 2013-09-30 14:57:40 UTC
Which initrd are you using ... mkinitrd or dracut?

With mkinitrd and changing the CMSO local setting mkinitrd has to be called as well as the CMOS clock should be in localtime.
Comment 13 Segundo Luis Martín Díaz Sotomayor 2013-09-30 16:01:15 UTC
(In reply to comment #12)
> Which initrd are you using ... mkinitrd or dracut?
> 
> With mkinitrd and changing the CMSO local setting mkinitrd has to be called as
> well as the CMOS clock should be in localtime.

I don't change this, so my initrd is "default" I assume it will be mkinitrd.
Comment 14 Forgotten User 5bOUleMVRM 2013-09-30 17:52:04 UTC
Same for me. I noticed the issue immediately after installation from KDE live DVD 32bit Beta. I don't know what the installer used for building the initrd, but will be glad to check it if you give me a hint where to look.
Comment 15 Forgotten User 5bOUleMVRM 2013-09-30 18:45:02 UTC
(In reply to comment #12)
> With mkinitrd and changing the CMSO local setting mkinitrd has to be called as
> well as the CMOS clock should be in localtime.

I just ran mkinitrd after turning off UTC in the Date and Time module of YaST, but this did not help. After reboot the displayed time had an offset from the hardware clock again (and also the check box for UTC was marked again in the YaST module).
Comment 16 Jiří Suchomel 2013-10-01 06:22:05 UTC
It look like it _is_ YaST bug... probably did not save modified adjtime file...
Comment 17 Jiří Suchomel 2013-10-01 07:59:14 UTC
Created attachment 560974 [details]
patch for Timezone.rb

Please patch your Timezone.rb with this

(using e.g. "patch /usr/share/YaST2/modules/Timezone.rb < this_attachement")

and try calling yast2 timezone module again.
Comment 18 Forgotten User 5bOUleMVRM 2013-10-01 11:24:45 UTC
The patch works for me. After applying it, the setting to local time is retained across reboot in displayed time as well as in the check box of the Date and Time module.

Well done  :-)
Comment 19 Jiří Suchomel 2013-10-01 12:31:08 UTC
Fixed in yast2-country-3.0.2