Bug 1027059 - laptop hibernates after resuming from suspend
Summary: laptop hibernates after resuming from suspend
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: upower
Version: 19
Hardware: Unspecified
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: systemd-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-11-06 03:08 UTC by Samuel Sieb
Modified: 2015-02-17 19:05 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-02-17 19:05:09 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
FreeDesktop.org 71400 0 None None None Never

Description Samuel Sieb 2013-11-06 03:08:56 UTC
Sometimes when my laptop resumes from suspend, about 30 seconds later it hibernates.  It seems to only happen when I suspend while on battery and resume still on battery.  It doesn't happen every time, but it has happened several times so far.

systemd-204-17.fc19.x86_64
upower-0.9.20-1.fc19.x86_64

Relevant information from the log:
Nov  5 09:31:41 worklap systemd[1]: Starting Sleep.
Nov  5 09:31:41 worklap systemd[1]: Reached target Sleep.
Nov  5 09:31:41 worklap systemd[1]: Starting Suspend...
Nov  5 09:31:41 worklap systemd-sleep[16052]: Suspending system...

A few minutes later I resume.

Nov  5 09:35:12 worklap systemd[1]: Time has been changed
Nov  5 09:35:12 worklap systemd-sleep[16052]: System resumed.
Nov  5 09:35:12 worklap upowerd[1131]: (upowerd:1131): GLib-CRITICAL **: g_ascii_strcasecmp: assertion `s1 != NULL' failed
Nov  5 09:35:12 worklap upowerd[1131]: (upowerd:1131): UPower-Linux-WARNING **: unknown status string:
Nov  5 09:35:12 worklap upowerd[1131]: (upowerd:1131): GLib-CRITICAL **: g_ascii_strcasecmp: assertion `s1 != NULL' failed
Nov  5 09:35:12 worklap upowerd[1131]: (upowerd:1131): UPower-Linux-WARNING **: unknown status string:
Nov  5 09:35:12 worklap systemd[1]: Started Suspend.
Nov  5 09:35:12 worklap systemd[1]: Requested transaction contradicts existing jobs: File exists
Nov  5 09:35:12 worklap systemd[1]: Service sleep.target is not needed anymore. Stopping.
Nov  5 09:35:12 worklap systemd[1]: Stopping Sleep.
Nov  5 09:35:12 worklap systemd[1]: Stopped target Sleep.
Nov  5 09:35:12 worklap systemd[1]: Reached target Suspend.
Nov  5 09:35:12 worklap systemd-logind[393]: Operation finished.

Some strange things, but the systemd parts seem to happen always. But then:

Nov  5 09:35:34 worklap systemd[1]: Starting Sleep.
Nov  5 09:35:34 worklap systemd[1]: Reached target Sleep.
Nov  5 09:35:34 worklap systemd[1]: Starting Hibernate...
Nov  5 09:35:34 worklap systemd-sleep[16231]: Suspending system...

Then resume from hibernate:

Nov  5 09:37:13 worklap systemd-sleep[16231]: System resumed.
Nov  5 09:37:13 worklap systemd[1]: Time has been changed
Nov  5 09:37:13 worklap systemd[1]: Started Hibernate.
Nov  5 09:37:13 worklap systemd[1]: Requested transaction contradicts existing jobs: File exists
Nov  5 09:37:13 worklap systemd[1]: Service sleep.target is not needed anymore. Stopping.
Nov  5 09:37:13 worklap systemd[1]: Stopping Sleep.
Nov  5 09:37:13 worklap systemd[1]: Stopped target Sleep.
Nov  5 09:37:13 worklap systemd[1]: Reached target Hibernate.
Nov  5 09:37:13 worklap systemd-logind[393]: Operation finished.


I'm somewhat suspicious of the upower lines.

Comment 1 Samuel Sieb 2013-11-08 04:57:54 UTC
I can now verify that it happens every time I both suspend while on battery and then resume while still on battery.  If one of the suspend or resume is while plugged in, it doesn't happen.

Comment 2 Samuel Sieb 2013-11-08 20:13:08 UTC
What appears to be happening is that upower is trying to get the battery state too soon after resuming and the sys tree for the battery isn't there yet.  It doesn't recognize that, so as far as I can tell from the code it will be determining that the battery is empty.  This then triggers something (probably gnome) to go to hibernate.  The gnome control panel offers either hibernate or power off on low battery so I can't disable it!  Actually, I found it in dconf, so for now I have it disabled, which is not ideal either.

On the code side, this may be a little tricky to fix.  The code that gets values from sysfs doesn't check for errors, it just returns 0.  So there's no way to indicate that the file wasn't actually there to read from.  Maybe at the top of the function check that the directory exists before trying to do anything else?

Comment 3 Samuel Sieb 2013-11-08 20:29:51 UTC
I discovered the "upower -d" command.  Here's the output right after resuming:

Device: /org/freedesktop/UPower/devices/battery_BAT0
  native-path:          /sys/devices/LNXSYSTM:00/device:00/PNP0C0A:00/power_supply/BAT0
  power supply:         yes
  updated:              Fri Nov  8 12:25:09 2013 (0 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               empty
    energy:              0 Wh
    energy-empty:        0 Wh
    energy-full:         0 Wh
    energy-full-design:  0 Wh
    energy-rate:         0 W
    percentage:          0%
    capacity:            100%
  History (rate):
    1383942309  15.250  discharging
    1383942309  0.000   unknown
    1383942309  0.000   empty
    1383942220  15.962  discharging
    1383942198  17.302  discharging

My analysis was correct, I'll file a bug upstream.

Comment 4 Rex Dieter 2013-11-24 19:32:19 UTC
see also bug #1025980 where I see odd bahaviors due to upower reporting:

    state:               fully-charged
    percentage:          0%

at least upower is being consistent here. (reporting both empty/0%)

Comment 5 Fedora End Of Life 2015-01-09 20:29:05 UTC
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 19 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 6 Fedora End Of Life 2015-02-17 19:05:09 UTC
Fedora 19 changed to end-of-life (EOL) status on 2015-01-06. Fedora 19 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.