Bug 538357 - After first reboot after complete installation the clock is 2 hours ahead.
Summary: After first reboot after complete installation the clock is 2 hours ahead.
Status: RESOLVED FIXED
: 544436 545990 (view as bug list)
Alias: None
Product: openSUSE 11.2
Classification: openSUSE
Component: YaST2 (show other bugs)
Version: Milestone 8
Hardware: PC SUSE Other
: P2 - High : Critical (vote)
Target Milestone: ---
Assignee: Jiří Suchomel
QA Contact: Jiri Srain
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-11 10:44 UTC by Forgotten User vs5edErKRK
Modified: 2021-03-09 12:06 UTC (History)
9 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---
coolo: SHIP_STOPPER+


Attachments
my boot.msg (52.96 KB, application/octet-stream)
2009-10-05 19:16 UTC, Pierre Kretschmer
Details
The clock file. (1023 bytes, application/octet-stream)
2009-10-05 19:21 UTC, Pierre Kretschmer
Details
patch for /usr/share/YaST2/clients/save_config_finish.ycp (468 bytes, patch)
2009-10-07 12:56 UTC, Jiří Suchomel
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Forgotten User vs5edErKRK 2009-09-11 10:44:59 UTC
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; sv-SE; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)

I left "hardware clock set to UTC" unticked at installation. My time zone was set to Europe/Sweden. The time showed the right time in the installation setting screen. The time was also right at first login which I came to from the installation program. After first reboot two clock was 2 hours ahead. 

Reproducible: Always

Steps to Reproduce:
1.install
2.untick "Hardware clock set to UTC"
3.Log in after installation
4.Reboot
Actual Results:  
The clock  shows 2 hours ahead of actual time.

Expected Results:  
The clock should have shows a time 2 hours earlier then it actually does.
Comment 1 Stephan Binner 2009-09-11 10:50:42 UTC
Still unsolved bug 534816?
Comment 2 Forgotten User xs3PtXj4XH 2009-10-03 03:50:57 UTC
There's an old bug from 10.3 here that might be related:

https://bugzilla.novell.com/show_bug.cgi?id=327537

Perhaps their cause is the same?  Also Inge, could you test this with Milestone 8?
Comment 3 Refilwe Seete 2009-10-04 18:22:59 UTC
I can confirm this bug on Milestone 8 x86_64.  After each reboot the clock is off-set by my differential relative to UTC.  The effect is cumulative with each reboot.

On the openSUSE forums they are reporting that running mkinitrd will solve the problem.  I can confirm this as working on my install of Milestone 8.


http://forums.opensuse.org/pre-release-beta/422857-ping-akoellh-time-bug-m8.html
Comment 4 Forgotten User xs3PtXj4XH 2009-10-04 23:25:59 UTC
Changed bug to Milestone 8 (thanks for the confirmation Refilwe) and architecture to "PC" since it appears to be present in the x86_64 build.
Comment 5 Forgotten User xs3PtXj4XH 2009-10-04 23:27:47 UTC
Anyone with this bug, please attach:

/etc/sysconfig/clock

/etc/adjtime

/var/log/boot.msg
Comment 6 Forgotten User vs5edErKRK 2009-10-05 18:53:50 UTC
My clock was set two hours ahead in Milestone 8.
Comment 7 Pierre Kretschmer 2009-10-05 19:16:50 UTC
Created attachment 321113 [details]
my boot.msg

boot.msg
Comment 8 Pierre Kretschmer 2009-10-05 19:18:21 UTC
Comment on attachment 321113 [details]
my boot.msg

This is my boot.msg, I don't know how to add a seccond attachment.
Comment 9 Pierre Kretschmer 2009-10-05 19:21:01 UTC
Created attachment 321114 [details]
The clock file. 

This is my clock file. Sorry for the seccond posting, but bugzilla is not very easy to handle. On my system there is no /etc/adjtime
Comment 10 Pierre Kretschmer 2009-10-05 19:23:37 UTC
*** Bug 544436 has been marked as a duplicate of this bug. ***
Comment 11 Rastislav Krupansky 2009-10-06 07:59:46 UTC
This is really annoying and it should be fixed as soon as is possible. And i´m just reading forum and people really complain, that time makes problems with BIOS also.
Comment 12 Stephan Kulow 2009-10-06 08:40:45 UTC
Werner worked on this
Comment 13 Dr. Werner Fink 2009-10-06 10:07:18 UTC
The initial description is missing a point:

> 1.install
> 2.untick "Hardware clock set to UTC"

  2a. run mkinitrd to inform the initrd system
      that now the CMOS time is in local time

> 3.Log in after installation
> 4.Reboot

... maybe this should be done the YaST mask used for
unsticking the UTC time.
Comment 14 Dr. Werner Fink 2009-10-06 13:53:59 UTC
OK, I've submitted an aaa_base which includes now two scripts
.. first of all a `refresh_initrd' which currently checks only
if /etc/sysconfig/clock is newer than /boot/initrd and run
mkinitrd in this case (there can be added more conditions).

As the YaST timezone module currently igniores the tags within
/etc/sysconfig/clock (like the added Command tag) I've added
a /sbin/conf.d/SuSEconfig.clock to run refresh_initrd in any
case.
Comment 15 Stephan Kulow 2009-10-06 14:00:45 UTC
Thorsten is not really a fan of this solution and prefers a command comment in the sysconfig (this could be restart_initrd) - this would leave the installation. But I have no idea what's the order of writing out sysconfig/clock and installing kernel.
Comment 16 Dr. Werner Fink 2009-10-06 14:08:12 UTC
I've added also the Command tag to /etc/sysconfig/clock found in
aaa_base (which only works on a fresh install) ... you may remove
the SuSEconfig.clock including the empty conf.d/ in the tar
ball of aaa_base if the YaST timezone module does it correct.

(IMHO all YaST modules should honour the tags within sysconfig files
 as done by the YaST sysconfig editor module)
Comment 17 Stephan Kulow 2009-10-06 15:09:11 UTC
I'm afraid the installation needs to call mkinitrd before reboot as it saves the HWCLOCK value after all packages are installed, so mkinitrd called during package installation will see the defaull (UTC) -> bang
Comment 18 Jiří Suchomel 2009-10-07 07:45:13 UTC
(In reply to comment #15)

> But I have no idea what's the order of writing out
> sysconfig/clock and installing kernel.


sysconfig/clock is written by Timezone::Save, which is invoked in save_config_finish.ycp.

(In reply to comment #17)
> I'm afraid the installation needs to call mkinitrd before reboot as it saves
> the HWCLOCK value after all packages are installed, so mkinitrd called during
> package installation will see the defaull (UTC) -> bang

So is this an action that is required from YaST? Than it should be done by installation at the end of first stage...
Comment 19 Dr. Werner Fink 2009-10-07 07:52:54 UTC
The order is:

      * write out /etc/sysconfig/clock
      * set the CMOS time to local time
      * run mkinitrd to get /etc/sysconfig/clock into initrd
      * reboot into new kernel with its new initrd

then the new initrd runs warpclock to inform the new kernel
that CMOS is running in local time. Beside this initrd touch
a lock file to skip /etc/init.d/boot.clock to touch the
CMOS clock again.
Comment 20 Jiří Suchomel 2009-10-07 08:19:37 UTC
Well, I admit I do not understand it at all.

1. What should YaST do differently from previous distributions where it worked and why?

2. What are those Command tags you are writing about and how (if) they should be used?

3. Why should YaST explicitely "set the CMOS time to local time"? When user unchecks that "UTC checkbox", it is expected that his CMOS time is already local, there's nothing to set...
Comment 21 Dr. Werner Fink 2009-10-07 08:32:41 UTC
If CMOS clock is running in localtime than you're right. In this case
the CMOS clock should be not touched.  Beside this normally the Linux
kernel assumes that CMOS is running in UTC.  That is that during boot
the kernel set to the system time to UTC (and the glibc is using
/etc/localtime to caluate the correct offset for displaying the system
time in the local time frame).  Now with the help of the binary warpclock
in the initrd the kernel will be informed that the CMOS is *not* running
in UTC but in local time together with the offset to UTC.  Then the
kernel its self correct the system time to the UTC time.  This is done
*before* the root file system is mounted (to avoid a root file system
mounted in the future for systems right of the meridian of the
international dateline).
Comment 22 Jiří Suchomel 2009-10-07 09:05:05 UTC
So this is the same case as we previously called 

"user selected local time, even if he uses UTC" -> user error & invalid bug

If user leaves UTC checkbox in the correct state (saying UTC if he has UTC in CMOS, unchecking UTC only when CMOS time is already local), that everything works fine, right?

I am sorry but I still don't see where and when should YaST do some new action - before reboot? But after first reboot, it works correctly, only after next reboots time goes wrong.

What about that Command tag? What is there and how should it be used?
Comment 23 Dr. Werner Fink 2009-10-07 09:19:02 UTC
The initrd should be created *after* /etc/sysconfig/clock has been changed
otherwise initrd does not know that the CMOS is in local time and can not
inform the kernel on next (re)boot. Therefore this should to be done *before*
the installed kernel is booted form the root partition.  And this is *not* an
users error, this has to be done by YaST at installation before the installed
system is booted.

The Command tag in sysconfig files is currently ignored by the YaST timezone
module. AFAIK only the YaST sysconfig editor uses them.
Comment 24 Dr. Werner Fink 2009-10-07 09:21:04 UTC
Here we've the tags of sysconfig files:

 http://en.opensuse.org/SUSE_Package_Conventions/Sysconfig#5.3._Metadata_Tags
Comment 25 Jiří Suchomel 2009-10-07 09:46:12 UTC
(In reply to comment #23)

> The Command tag in sysconfig files is currently ignored by the YaST timezone
> module. AFAIK only the YaST sysconfig editor uses them.

Yes, but I'm the maintainer of YaST timezone module. So I'm asking for this, to see if using this tag wouldn't be easier solution than calling mkinitrd at some time during installation.

How does your new /etc/sysconfig/clock look like?
Comment 26 Dr. Werner Fink 2009-10-07 10:33:40 UTC
The part for HWCLOCK looks like this

 ## Path:                System/Environment/Clock
 ## Description:         Information about your timezone and time
 ## Type:                string(-u,--utc,--localtime)
 ## ServiceRestart:      boot.clock
 ## Command:             test -x /sbin/refresh_initrd || /sbin/refresh_initrd
 #
 # Set to "-u" if your system clock is set to UTC, and to "--localtime"
 # if your clock runs that way.
 #
 HWCLOCK=""

and the script /sbin/refresh_initrd is

 #!/bin/bash
 #
 # Refresh initrd depending on conditions.
 # Currently only the change of /etc/sysconfig/clock is
 # honoured but we may add more of conditions.
 #
 # Author: Werner Fink <werner@suse.de>
 #
 refresh=no
 test $ROOT/etc/sysconfig/clock -nt $ROOT/boot/initrd && refresh=yes
 test "$refresh" = yes || exit 0

 line=off
 test -e /proc/splash && read line < /proc/splash
 test -r $ROOT/etc/sysconfig/bootsplash && . $ROOT/etc/sysconfig/bootsplash
 test "$SPLASH" = no && line=off
 if test "${line##*: }" = off ; then
     exec $ROOT/sbin/mkinitrd $ROOT
 fi
 size=${line##*, }
 size=${size%)*}
 exec $ROOT/sbin/mkinitrd -s $size $ROOT

or we use the same Command tag as in /etc/sysconfig/kernel which whould be
simply /sbin/mkinitrd.
Comment 27 Jiří Suchomel 2009-10-07 10:44:43 UTC
So, am I on the safe side if I call this Command script ("test -x /sbin/refresh_initrd || /sbin/refresh_initrd") every time I write  /etc/sysconfig/clock? Regardless it is installation or not?
Comment 28 Dr. Werner Fink 2009-10-07 10:51:49 UTC
As long as the command is done in the chroot of the final root partition
and therein /proc and /sys is mounted (to be able to access /proc/splash
and to make mkinitrd work as it alos remains on /proc and /sys) ... yes.
Comment 29 Jiří Suchomel 2009-10-07 11:42:43 UTC
Well, if I'd put it to the same place Timezone saves the sysconfig file (Timezone::Save) that timezone module would not know anything about current root.

Lukas, when Timezone::Save is executed from save_config_finish.ycp, is it already in new chroot?
Comment 30 Lukas Ocilka 2009-10-07 11:45:41 UTC
According to inst_finish.ycp, "save_config" is called after "switch_scr" so -> yes, it is already in the new chroot.
Comment 31 Dr. Werner Fink 2009-10-07 11:47:45 UTC
OK ... then one question more: is this chroot with /proc and /sys mounted?
That is that mkinitrd can do its job.
Comment 32 Lukas Ocilka 2009-10-07 11:52:34 UTC
mkinitrd does its job when bootloader calls it later in the same script /proc and /sys should `mounted` already when installing packages (before installing packages).
Comment 33 Jiří Suchomel 2009-10-07 12:01:53 UTC
... so, why mkinitrd "does not do the job" when it is called anyway?
Comment 34 Dr. Werner Fink 2009-10-07 12:12:53 UTC
Hmmm ... if /etc/sysconfig/clock and /etc/localtime are changed before
mkinitrd will be executed then the initrd should be uptodate.
/lib/mkinitrd/bin/warpclock depends on /etc/sysconfig/clock and
/etc/localtime which are copied by /lib/mkinitrd/scripts/setup-clock.sh
into the initrd.

Hopefully the mkinitrd_setup is executed by the rpm spec before mkinitrd
is called by any other ... otherwise the setup und boot links in
/lib/mkinitrd/setup/ and /lib/mkinitrd/boot/ are missed.
Comment 35 Jiří Suchomel 2009-10-07 12:30:13 UTC
Timezone::Save does only save  /etc/sysconfig/clock

/etc/localtime of the target system is not modified, this is done by Timezone::Set, which is called during the timezone setup. Timezone::Set does:

/usr/sbin/zic -l <timezone>
/sbin/hwclock --hctosys <hwclock> (where hwclock is the HWCLOCK value from sysconfig)


So... should we call Timezone::Set also after the chroot? Just before Timezone::Save?
Comment 36 Dr. Werner Fink 2009-10-07 12:43:09 UTC
Yes please otherwise warpclock nor hwclock now about the offset to UTC.
That is that warpclock nor hwclock can use the hack

   zone.tz_minuteswest = -(typeof(zone.tz_minuteswest))(gmtoff/60L);
   settimeofday((struct timeval *)0, &zone);

as descibed in the manual page settimeofday(2) and in linux/kernel/time.c.
Comment 37 Jiří Suchomel 2009-10-07 12:56:47 UTC
Created attachment 321459 [details]
patch for /usr/share/YaST2/clients/save_config_finish.ycp

So... this would be proposed patch.
Comment 38 Dr. Werner Fink 2009-10-07 13:15:03 UTC
Cool ... it would be perfect if this works ... if this happens before
the mkinitrd will run then all should be done, the information about
the CMOS clock as well as the information about the offset to UTC.
Comment 39 Jiří Suchomel 2009-10-07 13:39:10 UTC
OK, I will include the patch above in yast2-installation-2.18.31.

Let's see if it works in next snapshot.
Comment 40 Dominique Leuenberger 2009-10-10 15:46:00 UTC
*** Bug 545990 has been marked as a duplicate of this bug. ***
Comment 41 Stephan Kulow 2009-10-12 10:38:05 UTC
let's mark it as fixed - for now
Comment 42 Jiří Suchomel 2009-10-15 10:03:20 UTC
Reporters: please make sure it works with RC1.
Comment 43 Forgotten User vs5edErKRK 2009-10-15 13:26:33 UTC
Works with RC1 here. Thank you!
Comment 44 Forgotten User tfBQIqYkT6 2009-10-15 22:28:53 UTC
It's fixed with RC1.Thanks!