FS#5529 - wrong time after install
Attached to Project:
Arch Linux
Opened by Roman Kyrylych (Romashka) - Thursday, 05 October 2006, 23:10 GMT
Opened by Roman Kyrylych (Romashka) - Thursday, 05 October 2006, 23:10 GMT
|
Details
Reproduction:
Let assume we have some system where hardware clock shows local time. You can create vmware machine for testing. Boot from Arch CD (I used latest from tpowa, but I don't think that matters) and install Arch. During install procedure ensure there is HARDWARECLOCK="localtime" in /etc/rc.conf. Reboot system. On reboot you can go to BIOS to ensure that the time is still correct. Now check the time. It will be incorrect. Why? Because in some way Arch thinks that hardware clock shows time in UTC, and so it adds required timeshift to produce localtime and saves it in BIOS. But it's wrong, because hardware clock already was in localtime! So, before install I had 14:xx, after install I have 17:xx. That's because my timezone is GMT+0200 and DST time adds 1 hour two - thus 3 hours total. I noticed this on dual-boot system when after installing Arch my Windoze showed me wrong time. The strange thing is that this happens only on first run. So I examined /etc/rc.sysinit: if [ "$HARDWARECLOCK" = "UTC" ]; then /sbin/hwclock --directisa --utc --hctosys else /sbin/hwclock --directisa --localtime --hctosys fi if [ ! -f /var/lib/hwclock/adjtime ]; then echo "0.0 0 0.0" > /var/lib/hwclock/adjtime fi and /etc/rc.shutdown: if [ "$HARDWARECLOCK" = "UTC" ]; then /sbin/hwclock --directisa --utc --systohc else /sbin/hwclock --directisa --localtime --systohc fi You can see why this time change happens only on first run. Because /var/lib/hwclock/adjtime does not exist at that time. It seems that "/sbin/hwclock --localtime --hctosys" behaves wrong without /var/lib/hwclock/adjtime. I think generating /var/lib/hwclock/adjtime during install will solve this problem. |
This task depends upon
Closed by Roman Kyrylych (Romashka)
Wednesday, 29 November 2006, 22:49 GMT
Reason for closing: Fixed
Wednesday, 29 November 2006, 22:49 GMT
Reason for closing: Fixed
# replace
if [ "$HARDWARECLOCK" = "UTC" ]; then
/sbin/hwclock --directisa --utc --hctosys
else
/sbin/hwclock --directisa --localtime --hctosys
fi
if [ ! -f /var/lib/hwclock/adjtime ]; then
echo "0.0 0 0.0" > /var/lib/hwclock/adjtime
fi
# with
if [ "$HARDWARECLOCK" = "UTC" ]; then
/sbin/hwclock --directisa --utc --hctosys
else
/sbin/hwclock --directisa --localtime --hctosys
fi
if [ ! -f /var/lib/hwclock/adjtime ]; then
if [ "$HARDWARECLOCK" = "UTC" ]; then
/sbin/hwclock --directisa --utc --systohc
else
/sbin/hwclock --directisa --localtime --systohc
fi
The real fix is to move
if [ "$TIMEZONE" != "" ]; then
/bin/ln -sf /usr/share/zoneinfo/$TIMEZONE /etc/localtime
fi
before
if [ "$HARDWARECLOCK" = "UTC" ]; then
Please let me know if this resolves it.