Set Time & Date manually doesn't persist between reboots

Bug #1524674 reported by TarotChen
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Canonical System Image
Confirmed
Medium
Unassigned
ubuntu-system-settings (Ubuntu)
Invalid
Medium
Jonas G. Drange

Bug Description

krillin rc-proposed 201

TEST CASE
Setup:
Make sure that the hardware clock and the system clock are in sync:
$ timedatectl set-ntp 1
$ sudo hwclock -w --noadjfile -u
Verify the time is correct on both clocks
$ timedatectl

Test Steps:
1. Disable ntp, check that clocks are in sync
$ timedatectl set-ntp 0

2. Set system clock to another date or time and verify that the clocks are set correctly to the new time
$ timedatectl set-time '03:00:00'

3. Note the real time on a watch or another system's clock and reboot
4. Upon reboot, check the time

Actual Result
- hardware clock is correct (manually set time plus the time elapsed since it has been set)
- system clock is wrong and set to the time it has been manually updated (with a difference of several minutes from real time)
- sudo dmesg | grep "system clock" shows that the kernel set the system clock correctly

Expected Results
- hardware and system clocks are in sync and both set to the time set manually.

= Original Description =

TEST ENV:
$ system-image-cli -i
current build number: 38
device name: krillin
channel: ubuntu-touch/rc/bq-aquaris.en
last update: 2015-12-08 02:29:10
version version: 38
version ubuntu: 20151207.1
version device: 20150821-736d127
version custom: 20151111--36-46-viv

STEPS:
1.Go to system-settings / Date & time
2.Set "Set date and time" to "Manual"
3.Change current date & time (Dec 10, 9:30 AM) to new date & time (Dec 9, 13:30 PM)
4.Ensure that indicator updates to the new date/time
5.Reboot the phone
6.Go back to Date & time settings page and check

Actual result:
After rebooting, the setting is "Manual", but the date/time is the current date/time, not the one I set before

Expected result:
Should display the date/time set in Step 3.

Revision history for this message
Pat McGowan (pat-mcgowan) wrote :

Tried to reproduce on krillin with r38, and an arale with rc-proposed, bot worked as expected. The manually set time was retained after reboot.

Changed in ubuntu-system-settings (Ubuntu):
status: New → Incomplete
Revision history for this message
Evan Wang (wsy324) wrote :

I can reproduce this issue only if manually set to a different date/day on both rc r38 and rc-proposed r200,
it works if only just set to a different time of the same date/day.

Revision history for this message
Dave Morley (davmor2) wrote :

I can reproduce this reliably.

Timeone set to London Europe utc+0
Set to automatic to ensure you have the correct time
Put it into manual
Set the day back one day.
Check the indicator has updated (note the time is correct as set by the automatic time sync)
Reboot
Now the day remains correct as yesterday but the time is now completely off.

This was tested in ota8 and is reproducible there so is not a regression in ota8.5

Changed in ubuntu-system-settings (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Pat McGowan (pat-mcgowan) wrote :

I still cannot reproduce with local timezone or utc-0 so unclear whats going on

Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

I can reproduce it too on latest rc-proposed (201) krillin. You have to change the day, if you change the time only it doesn't trigger the bug.

Changed in canonical-devices-system-image:
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → Bill Filler (bfiller)
milestone: none → ww02-2016
Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

If you set the time manually, after a reboot the hardclock and the system time are out of sync

Original time
root@ubuntu-phablet:~# date && hwclock
Fri Dec 11 21:42:53 UTC 2015
Fri 11 Dec 2015 09:42:54 PM UTC -0.887206 seconds

Set a random time
root@ubuntu-phablet:~# date && hwclock
Sat Jan 3 13:54:16 UTC 2015
Sat 03 Jan 2015 01:54:17 PM UTC -0.083749 seconds

Reboot
root@ubuntu-phablet:~# date && hwclock
Fri Dec 11 21:39:59 UTC 2015
Sat 03 Jan 2015 01:56:41 PM UTC -0.018649 seconds

Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

Restoring the system clock from the hardware clock doesn't work with the following command (same command used in the upstart job)

Before update
root@ubuntu-phablet:/etc/init# date
Fri Dec 11 22:49:50 CET 2015
root@ubuntu-phablet:/etc/init# hwclock
Thu 26 Nov 2015 11:58:53 AM CET -0.130806 seconds

Setting system clock from hw clock:
root@ubuntu-phablet:/etc/init# hwclock --systz --utc --noadjfile
root@ubuntu-phablet:/etc/init# date
Fri Dec 11 22:55:12 CET 2015

Expected: system time and hw clock are in sync.

Bill Filler (bfiller)
Changed in ubuntu-system-settings (Ubuntu):
assignee: nobody → Jonas G. Drange (jonas-drange)
importance: Undecided → Medium
Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

ignore my previous comment (#7) I mis-read the man page.

description: updated
Changed in canonical-devices-system-image:
importance: Medium → High
description: updated
description: updated
Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

I added some debug output to /etc/init/hwclock.conf
While, according to dmesg, the kernel sets the system clock from the hardware clock:

$ sudo dmesg|grep "system clock"
[ 2.257135] mt-rtc mt-rtc: setting system clock to 2015-12-14 02:00:36 UTC (1450058436)

the system clock is already incorrect when hwclock.conf runs:

+ . /etc/default/rcS
+ UTC=yes
+ [ yes = yes ]
+ tz=--utc
+ [ = yes ]
+ echo XXXXXXXXXX Before
XXXXXXXXXX Before
+ date
Mon Dec 14 09:43:14 UTC 2015
+ hwclock
Mon Dec 14 02:00:41 2015 -0.881525 seconds
+ exec hwclock --systz --utc --noadjfile

Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

note that in previous comment, the real time is 11:06 not 09:43.

Changed in canonical-devices-system-image:
assignee: Bill Filler (bfiller) → John McAleely (john.mcaleely)
Changed in ubuntu-system-settings (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Julia Palandri (julia-palandri) wrote :

@Jonas what kind of information do we need to complete this bug report?

Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

I set the u-s-s task to invalid. It's a bug in the kernel or somewhere in the boot stack not system-settings.

Changed in ubuntu-system-settings (Ubuntu):
status: Incomplete → Invalid
Changed in canonical-devices-system-image:
milestone: ww02-2016 → ww08-2016
Revision history for this message
Victor gonzalez (victor-gonzalez-0) wrote :

I tried to reproduce it with the steps in #3 and #5 but every time I reboot, date&time is set right automatically even when I put it in manual before rebooting... :S

Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

@Victor, on which device/channel/build? I tried on krillin / rc / OTA9 and it works fine.
If you're seeing this on latest rc or rc-proposed could you please file a new bug please? The bug here is about the hw clock and system clock being out of sync.

Changed in canonical-devices-system-image:
importance: High → Medium
Revision history for this message
Victor gonzalez (victor-gonzalez-0) wrote :

Sorry @jibel, my mistake it works fine in OTA-9

Changed in canonical-devices-system-image:
milestone: ww08-2016 → 11
Changed in canonical-devices-system-image:
milestone: 11 → backlog
Changed in canonical-devices-system-image:
assignee: John McAleely (john.mcaleely) → nobody
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.