hwclock.sh should be called before/after hibernate

Bug #36815 reported by Nikolaus Rath
50
Affects Status Importance Assigned to Milestone
acpi-support (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

/etc/init.d/hwclock.sh should be called before hibernation and when the computer wakes up again, otherwise changes to the system clock are lost.

The patch for this is attached to bug 193842.

Revision history for this message
Simon Law (sfllaw) wrote :

It's already called after hibernate, but not before.

Changed in util-linux:
status: Unconfirmed → Confirmed
Revision history for this message
Rodrigo Novo (rodarvus) wrote : Load/Save HWClock State on acpi-support

(patch for acpi-support, not util-linux)

The attached patch modifies /etc/acpi/resume.d/50-time.sh to use the correct initscript to load hwclock state, instead of calling hwclock manually. Also, /etc//acpi/resume.d/88-time.sh was added, to save hwclock state before hibernation.

I chosed "88" for suspend to make sure the clock is the last step done before video is turned off.

This patch was successfully tested on a locally compiled acpi-support package, in two different computers - but it would be great if someone else could review/test it on different hardware.

Revision history for this message
Mary Gardiner (puzzlement) wrote :

Use case: clock set to local time (dual boot with Windows). A daylight savings transition happens, but the clock is not written out to hardware. Computer is suspended, and when resumed the timezone is correct, but the time has reverted to the time before the transition.

There are some relevant comments in bug 91418: the last comments by Andrew Bennetts in particular are actually related to this bug.

Revision history for this message
maris382 (maris382) wrote :

I was affected by this bug when daylight saving transition happened last week. Although I tried to update the clock it manually over and over again, it was reset everytime I suspended the computer (I usually never shut it off completely).

Stopping and starting hwclock.sh did the trick so I'm pretty sure the patch will solve the problem (although I didn't try it)

Daniel Hahler (blueyed)
Changed in acpi-support:
assignee: nobody → blueyed
status: Confirmed → In Progress
Nikolaus Rath (nikratio)
description: updated
Revision history for this message
Jakob Unterwurzacher (jakobunt) wrote :

Use case (happened here right now):
Clock is off by X minutes for some reason. The running ntpd will reset it to the correct time after several minutes.
Then you suspend your laptop, resume it, clock is off by X minutes again.

Revision history for this message
Daniel Hahler (blueyed) wrote :

The patch for this is attached to bug 193842.
You can get a test package for acpi-support from my PPA at
https://launchpad.net/~blueyed/+archive?field.name_filter=acpi-support (0.106blueyedppa5 or later)

Revision history for this message
Jakob Unterwurzacher (jakobunt) wrote :

@Daniel:
I couldn't test the whole package because i'm on Gutsy and Gutsy misses the dependecy package x11-xserver-utils.

But i tested the /etc/acpi/suspend.d/88-time.sh extracted from your package.
Works as expected!

root@laj:/etc/acpi/resume.d# date; hwclock --show
Don Mär 6 11:14:57 CET 2008
Don 06 Mär 2008 12:14:55 CET -0.122513 seconds
###SUSPEND-RESUME###
root@laj:/etc/acpi/resume.d# date; hwclock --show
Don Mär 6 11:15:29 CET 2008
Don 06 Mär 2008 11:15:30 CET -0.089833 seconds

Daniel Hahler (blueyed)
Changed in acpi-support:
assignee: blueyed → nobody
status: In Progress → Triaged
description: updated
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package acpi-support - 0.106

---------------
acpi-support (0.106) hardy; urgency=low

  * Cherrypicked bugfix patches from Launchpad (LP: #193842)
  * lib/state-funcs: make wireless led work with asus-laptop (the new module);
    patch from Nicolò Chieffo (LP: #189889)
  * Add events/asus-video to support asus switch video hotkey; patch from
    Nicolò Chieffo (LP: #138228)
  * events/asus-wireless-2, asus-wireless-2.sh:
    Support Fn+F2 on Asus A8Js; patch from Matteo Collina (LP: #105929)
  * Fix the value range in sonybright.sh (0-7 instead of 1-8); patch from unggnu
    (LP: #136380)
  * "lib/FUJITSU SIEMENS.config":
    - Enable suspend for Fujitsu-Siemens C1110 (LP: #52970)
    - Enable STR for Fujitsu-Siemens Lifebook S7020, S7110
  * resume.d/50-time.sh, suspend.d/88-time.sh:
    Fix handling of hardware clock before/after suspend; patch from Rodrigo
    Novo (LP: #36815)
  * events/asus-*: Fix event key names for ASUS (HOTK); patch from
    Jeroen van der Vegt (LP: #25784)
  * Fix names in comments for events/panasonic-{mute,volume-down,volume-up}
  * debian/rules, README.toshiba: Drop toshiba_acpi.modprobe, which only
    contained an invalid/obsolete option "hotkeys_over_acpi" (LP: #180678)
  * debian/control: Standards-Version 3.7.3
  * Drop thinkpad_acpi.modprobe: the workarounds therein are not needed for
    thinkpad_acpi in Hardy anymore; investigations by Jerone Young (LP: #194679)
  * Add events/lenovo-eject to handle the Thinkpad eject button (Fn+F9); patch
    from Jerone Young (LP: #194609)

 -- Daniel Hahler <email address hidden> Thu, 06 Mar 2008 02:15:54 +0100

Changed in acpi-support:
status: Triaged → 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.