/etc/default/rcS: UTC=no: Utopic time is off by 4 hours after boot

Bug #1377258 reported by Cavsfan
This bug affects 3 people
Affects Status Importance Assigned to Milestone
systemd (Ubuntu)
Fix Released
Martin Pitt

Bug Description

Every day for the couple of several weeks when booting into Utopic the time is off usually by 4 hours.
I went to time and date settings and the ability to check get time Automatically from the internet is greyed out.
Even though it knows I am in US Eastern Standard time this does not fix it:
cavsfan@cavsfan-MS-7529:~$ sudo dpkg-reconfigure tzdata

Current default time zone: 'America/New_York'
Local time is now: Tue Sep 30 08:09:32 EDT 2014.
Universal Time is now: Tue Sep 30 12:09:32 UTC 2014.

The only thing that will fix it is sudo ntpdate ntp.ubuntu.com
This happens to me in Gnome Flashback (with Compiz) every single day but others report it happens in Unity too.

ProblemType: Bug
DistroRelease: Ubuntu 14.10
Package: tzdata 2014g-1
ProcVersionSignature: Ubuntu 3.16.0-20.27-generic 3.16.3
Uname: Linux 3.16.0-20-generic x86_64
NonfreeKernelModules: nvidia
ApportVersion: 2.14.7-0ubuntu2
Architecture: amd64
CurrentDesktop: Gnome Flashback (with Compiz)
Date: Fri Oct 3 13:45:36 2014
InstallationDate: Installed on 2014-03-10 (207 days ago)
InstallationMedia: Ubuntu 14.04 LTS "Trusty Tahr" - Alpha amd64 (20140310)
PackageArchitecture: all
SourcePackage: tzdata
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Cavsfan (cavsfan) wrote :
description: updated
Revision history for this message
Cavsfan (cavsfan) wrote :

As a temporary workaround:
    gksudo gedit /etc/cron.daily/ntpdate
Add this and save it:

ntpdate ntp.ubuntu.com

Then sudo chmod 755 /etc/cron.daily/ntpdate to make it executable.

I found that on this page:

When it boots up the time is four hours behind but after a few minutes it corrects itself.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in tzdata (Ubuntu):
status: New → Confirmed
Revision history for this message
sgage@tds.net (sgage) wrote :

The bug appears simply this:

Even with UTC=no, Ubuntu stores the time as UTC at shutdown. But since UTC=no, it expects the time as local, thus applies no timezone correction, and the time is 4 hours fast for those in EDT country.

Took me the longest time to suss it out, since having automatic time synch enabled fixed the time before a clock was ever displayed - for me, the problem only showed up when I dual-booted over to Windows, or turned off the auto-sync.

Revision history for this message
Cavsfan (cavsfan) wrote :

This bug is not a duplicate of https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/1377698
That involved just upstart boot, this bug just involves systemd boot.
And it's still broken here as of today. Only sudo ntpdate ntp.ubuntu.com will fix the time.

Revision history for this message
Martin Pitt (pitti) wrote :

Are you sure that you boot with systemd? Please give me the output of "systemctl status hwclock". (It should be "masked (/dev/null)"). For upstart this was fixed in bug 1377698 recently.

affects: tzdata (Ubuntu) → util-linux (Ubuntu)
Changed in util-linux (Ubuntu):
status: Confirmed → Incomplete
Martin Pitt (pitti)
summary: - Utopic time is off by 4 hours after boot
+ /etc/default/rcS: UTC=no: Utopic time is off by 4 hours after boot
Revision history for this message
Cavsfan (cavsfan) wrote : Re: [Bug 1377258] Re: Utopic time is off by 4 hours after boot

Sorry for the delay. I don't check my email like I should.
Yes this does involve systemd. The time was off by 4 hours everyday for
a while. I thought it was fixed in bug 1377698 too but I noticed that is
was good booting with upstart but only booting systemd it was 4 hours
I just booted Utopic with systemd and got the attached message. The time
was right but has gotten that same message at boot and the time was
still off before too. The time has been correct for the past few days.

"cavsfan@cavsfan-MS-7529:~$ systemctl status hwclock
    Loaded: masked (/dev/null)
    Active: inactive (dead)

Warning: Unit file changed on disk, 'systemctl daemon-reload' recommended."

bug 1377698

On 11/06/2014 03:42 AM, Martin Pitt wrote:
> Are you sure that you boot with systemd? Please give me the output of
> "systemctl status hwclock". (It should be "masked (/dev/null)"). For
> upstart this was fixed in bug 1377698 recently.
> ** Package changed: tzdata (Ubuntu) => util-linux (Ubuntu)
> ** Changed in: util-linux (Ubuntu)
> Status: Confirmed => Incomplete

Revision history for this message
Martin Pitt (pitti) wrote :

Ah thanks. I think I understand this now, so setting to Triaged. Debian's systemd is using /etc/adjtime to indicate whether the hw clock is UTC or LOCAL, and masks /etc/init.d/hwclock.sh. But right now in Ubuntu we still use /etc/default/rcS's UTC= setting.

Option 1: Keep rcS UTC setting: Un-mask hwclock.sh in util-linux so that it runs under systemd, or write a specific unit for it. This will keep our delta for that in sysvinit, util-linux, and systemd forever.

Option 2: Drop rcS UTC setting, drop our deltas in sysvinit, util-linux, and systemd, and migrate that setting to /etc/adjtime like in Debian. Our only delta would then be to bump the version comparison in systemd.postinst to do the migration, which we could drop after 16.04 LTS.

I'm favoring option 2, but I remember that Steve seemed to dislike /etc/adjtime quite much, so I'd like to ask him about his opinion first.

Changed in util-linux (Ubuntu):
assignee: nobody → Martin Pitt (pitti)
importance: Undecided → High
status: Incomplete → Triaged
Revision history for this message
Martin Pitt (pitti) wrote :

Actually, option 1 would be to keep util-linux as-is and instead patch systemd to read the "is hwclock local?" from /etc/default/rcS instead of /etc/adjtime.

slangasek | pitti: again, my concern is that reinstating /etc/adjtime is going to cause people to start misusing hwclock --adjust
slangasek | which per Scott's analysis during the upstart implementation, we should not be doing ever

I don't have much detail about why it's bad, but that seems to indicate that we should keep the UTC setting as it is for now, and keep the delta.

affects: util-linux (Ubuntu) → systemd (Ubuntu)
Revision history for this message
Martin Pitt (pitti) wrote :

Some note keeping for myself, please ignore.

Reproducer in VM:
sudo apt-get install -y systemd-sysv
sudo dpkg -P ntpdate
sudo sed -i '/^UTC/ s/yes/no/' /etc/default/rcS
sudo reboot

then after login again, timedatectl shows
      Local time: Fri 2014-11-07 17:37:15 CET
  Universal time: Fri 2014-11-07 16:37:15 UTC
        RTC time: Fri 2014-11-07 16:37:15
       Time zone: Europe/Berlin (CET, +0100)
    RTC in local TZ: no

which shows the bug. Last line should be "yes" and the local time an hour earlier.

Revision history for this message
Martin Pitt (pitti) wrote :
Changed in systemd (Ubuntu):
status: Triaged → Fix Committed
Revision history for this message
Cavsfan (cavsfan) wrote :

I booted into vivid with systemd and the time was 4 hours behind US EST.

I just thought I'd mention it. I see a fix is coming.

Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (5.1 KiB)

This bug was fixed in the package systemd - 215-6ubuntu1

systemd (215-6ubuntu1) vivid; urgency=medium

  * Merge with Debian unstable. Remaining Ubuntu changes:
    - Create disk/by-partlabel links for mmcblk partitions.
    - Hack to support system-image read-only /etc, and modify files in
      /etc/writable/ instead.
    - debian/rules: Drop doc dir symlinking. It creates havoc with dpkg
      upgrades, and we already have the automatic per-file symlinking.
    - debian/rules: Add an epoch to libgudev.
    - Don't install 80-networking.rules and the Debian *.agent scripts, we
      never supported them in Ubuntu. Instead, extend systemd's "net" device
      udev rule to trigger ifup@.service on network devices.
    - Keep our much simpler udev maintainer scripts (all platforms must
      support udev, no debconf).
    - Add udev Apport package hook.
    - debian/extra/initramfs.top: Drop $ROOTDELAY, we do that in a more
      sensible way with wait-for-root. Will get applicable to Debian once
      Debian gets wait-for-root in initramfs-tools.
    - debian/extra/initramfs.bottom: If LVM is installed, settle udev,
      otherwise we get missing LV symlinks. Workaround for LP #1185394.
    - Add 40-hyperv-hotadd.rules: Workaround for LP #1233466.
    - Mark graphics devices as PRIMARY_DEVICE_FOR_DISPLAY so that we can wait
      for those in plymouth.
    - Add debian/udev.lvm2.init: Dummy SysV init script to satisfy insserv
      dependencies to "lvm2" which is handled with udev rules in Ubuntu.
    - Add /run/shm -> /dev/shm symlink in debian/tmpfiles.d/debian.conf
      (LP: #1320534, Closes: #674755).
    - Lower Breaks: to lvm2 again. Our lvm2 package has always used udev for
      device setup, and thus is be compatible with systemd, too.
    - Lower Breaks: to plymouth version which has the udev inotify fix in
    - Add HP ProLiant Server Cartridge power control support.
    - Provide shutdown fallback for upstart. (LP: #1370329)
    - Add boot-and-services autopkgtest to check booting with systemd-sysv and
      that the most crucial services behave as expected.
    - debian/ifup@.service: Additionally run for "auto" class. We don't really
      support "allow-hotplug" in Ubuntu at the moment, so we need to deal with
      "auto" devices appearing after "/etc/init.d/networking start" already
      ran. (LP: #1374521)

    Upgrade fixes, keep until 16.04 LTS release:
    - systemd Conflicts/Replaces/Provides systemd-services.
    - Remove obsolete systemd-logind upstart job.

  * Clean up obsolete /etc/udev/rules.d/README on upgrades. (LP: #1381655)
  * Add Get-RTC-is-in-local-time-setting-from-etc-default-rc.patch: In Ubuntu
    we currently keep the setting whether the RTC is in local or UTC time
    in /etc/default/rcS "UTC=yes|no", instead of /etc/adjtime. (LP: #1377258)
  * Add systemd Apport hook for adding systemd-delta and information about
    failed units.

systemd (215-6) unstable; urgency=medium

  [ Martin Pitt ]
  * Cherry-pick upstream patch to fix udev crash in link_config_get().
  * Cherry-pick upstream patch to fix tests in limited schroot environments.
  * Add d/p/Add-env-variable-for...


Changed in systemd (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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