Hibernate missing from shutdown menu after 30/08/07 updates

Bug #136433 reported by Tom Vetterlein
18
Affects Status Importance Assigned to Milestone
powermanagement-interface (Ubuntu)
Fix Released
Undecided
Colin Watson

Bug Description

It's pretty much all in the title.

I'm not too sure how to go about debugging this.

I'm running a Thinkpad R61.

Revision history for this message
madscience (madscience) wrote :

Since running the same updates, suspend also fails to resume (goes to a blank screen). I'm also missing the hibernate option in the shutdown menu.

I'm running a Toshiba Satellite M30-001

Revision history for this message
slazZ (slazz) wrote :

They are different, because the disapper of those buttons was after upgrading the package "powermanagement-interface" from 0.3.15ubuntu1 to 0.3.16
The button in the shutdown-menu, and the menu-item in the powermanagement systray-icon, are gone.

I could not downgrade the version, because there is only this new version left in the repository.
But after removing this package (powermanagement-interface), the button reappears (after reboot).

Revision history for this message
TJ (tj) wrote :
Download full text (3.7 KiB)

According to the package's debian/changelog:

powermanagement-interface (0.3.16) gutsy; urgency=low

  * pmi.acpi: Disable suspend and hibernate if /host is mounted via fuse;
    disable hibernate if a swap file is active.

 -- Colin Watson <email address hidden> Wed, 29 Aug 2007 18:40:49 +0100

A diff shows:

diff -ru powermanagement-interface-0.3.15/debian/changelog powermanagement-interface-0.3.16/debian/changelog
--- powermanagement-interface-0.3.15/debian/changelog 2007-04-10 23:09:35.000000000 +0100
+++ powermanagement-interface-0.3.16/debian/changelog 2007-08-29 18:40:52.000000000 +0100
@@ -1,3 +1,17 @@
+powermanagement-interface (0.3.16) gutsy; urgency=low
+
+ * pmi.acpi: Disable suspend and hibernate if /host is mounted via fuse;
+ disable hibernate if a swap file is active.
+
+ -- Colin Watson <email address hidden> Wed, 29 Aug 2007 18:40:49 +0100
+
+powermanagement-interface (0.3.15ubuntu1) gutsy; urgency=low
+
+ * Build for lpia.
+ * Set Ubuntu maintainer address.
+
+ -- Matthias Klose <email address hidden> Fri, 24 Aug 2007 01:39:22 +0000
+
 powermanagement-interface (0.3.15) feisty; urgency=low

   * gdm-signal/gdm-logout-action.c:
diff -ru powermanagement-interface-0.3.15/debian/control powermanagement-interface-0.3.16/debian/control
--- powermanagement-interface-0.3.15/debian/control 2005-03-22 22:45:54.000000000 +0000
+++ powermanagement-interface-0.3.16/debian/control 2007-08-24 02:39:22.000000000 +0100
@@ -1,7 +1,8 @@
 Source: powermanagement-interface
 Section: admin
 Priority: optional
-Maintainer: Thom May <email address hidden>
+Maintainer: Ubuntu Core developers <email address hidden>
+XSBC-Original-Maintainer: Thom May <email address hidden>
 Build-Depends: debhelper (>=4.1.16), libglib2.0-dev, libgtk2.0-dev, libxau-dev
 Standards-Version: 3.6.1.0

diff -ru powermanagement-interface-0.3.15/debian/rules powermanagement-interface-0.3.16/debian/rules
--- powermanagement-interface-0.3.15/debian/rules 2006-03-20 06:34:39.000000000 +0000
+++ powermanagement-interface-0.3.16/debian/rules 2007-08-24 02:38:30.000000000 +0100
@@ -3,7 +3,7 @@
 DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)

 # good known arches go up here
-ifeq ($(DEB_HOST_ARCH),$(findstring $(DEB_HOST_ARCH), "i386 amd64 ia64"))
+ifeq ($(DEB_HOST_ARCH),$(findstring $(DEB_HOST_ARCH), "i386 amd64 ia64 lpia"))
  TYPE := acpi
  pmtool-depends := -V'pmtool:Depends=acpi-support (>= 0.17)'
 endif
diff -ru powermanagement-interface-0.3.15/pmi.acpi powermanagement-interface-0.3.16/pmi.acpi
--- powermanagement-interface-0.3.15/pmi.acpi 2007-03-06 15:23:19.000000000 +0000
+++ powermanagement-interface-0.3.16/pmi.acpi 2007-08-29 18:40:44.000000000 +0100
@@ -22,14 +22,19 @@
         [ ! -z "$1" ] && event="$1"
         case "$event" in
                 suspend|sleep)
- if [ "$ACPI_SLEEP" = true ]; then
+ if grep -q ' /host fuse' /proc/mounts; then
+ result=1
+ elif [ "$ACPI_SLEEP" = true ]; then
                                 result=0
                         else
                                 result=1
                         fi
                ...

Read more...

Revision history for this message
Tom Vetterlein (smbm) wrote :

Hmmm, I'm not entirely sure what most of that means.

Could anyone translate into laymans terms?

Revision history for this message
TJ (tj) wrote :

The excerpt from the changelog quoted above explains it:

powermanagement-interface (0.3.16) gutsy; urgency=low

  * pmi.acpi: Disable suspend and hibernate if /host is mounted via fuse;
    disable hibernate if a swap file is active.

 -- Colin Watson <email address hidden> Wed, 29 Aug 2007 18:40:49 +0100

Try

$ grep ' /host fuse' /proc/mounts

If there is an entry matching that, the changes shown above will cause suspend and hibernate to be disabled.

Changed in powermanagement-interface:
assignee: nobody → intuitive-nipple
Revision history for this message
Tom Vetterlein (smbm) wrote :

Thanks for your reply.

I tried:

$ grep ' /host fuse' /proc/mounts

I didn't get a result.

Any more ideas?

Revision history for this message
TJ (tj) wrote :

Ben - I've added you to this bug so you can comment on the interpretation of the changelog entry here.

The 2nd line of the changelog entry says "disable hibernate if a swap file is active." I'm not sure precisely what is meant by 'active' though.

It could mean 'if a swap file rather than a swap partition is being used', or it might mean 'if part of the swap space is in-use' (hibernate saves it's memory image to the swap space, so if there's some in use the possibility of hibernate writing over it needs to be prevented).

If Ben can tell us that we can test if that is the reason for the issue.

Revision history for this message
TJ (tj) wrote :

Ooops!! I can't read - sorry Ben, I somehow got you confused with Colin Watson whilst juggling one too many bugs at once!

I'll pass this onto Colin, and see if I can unsubscribe Ben, otherwise he'll have to do it himself :)

Revision history for this message
Tom Vetterlein (smbm) wrote :

Hmm, I think I'm using a swap partition as opposed to a file.

I specifically made it twice my system memory for hibernation purposes too.

I don't know if that info is of use to you.

Would it be worth trying a separate partition specifically to hibernate to?

Revision history for this message
Sitsofe Wheeler (sitsofe) wrote :

I spent a good long time tracking this down last night (gnome-power-manager uses hal to check. lshal says that hibernate is disabled. lshal was getting its information from /usr/bin/pmi which is part of the powermanagement-interface package).

I have a single swap partition and the problem appears to be this line within pmi:
                hibernate)
                        if grep -q ' /host fuse' /proc/mounts || \
                           swapon -s | tail -n +2 | awk '$2 == "file" { exit 1 }'; then
                                result=1

Alas the file is not commented so it's not clear exactly what the intent of those lines is. But I'm assuming that it is trying to disable hibernate if you are using fuse or (that's the ||) if you are using swap to a file. The problem is that I think the logic is inverted.

The
swapon -s | tail -n +2 | awk '$2 == "file" { exit 1 }'
is the key to the issue. I think this takes the output of swapon -s, skips the first line and then searches the rest for the parameter "file" in field 2 (the type) and returns 1 if it found and 0 otherwise. By contrast, if the grep command finds what you are looking for then it returns 0, if it cannot find what you are looking for then it returns 1.

Shells generally interpret truth as 0 and anything but 0 as false. The above swapon snippet returns false if it thinks you have a swap file causing it to take the first branch on systems that DON'T have swap files. Thus I think it will return that hibernate is not possible on systems without swap files.

(So a quick fix is to remove the swapon check. Alternatively you can fix up the logic using variables to store intermediary values to make things more obvious)

Revision history for this message
TJ (tj) wrote :

Sitsofe, I tend to agree with your analysis. You can see above I have suspicions about that change, but as you say, without comments it is hard to discern the intent.

I emailed Colin Watson earlier since he appears to have committed the change to get his input.

I suspect this is a 'simple' logic error in the script, or unexpected results, and can be easily corrected.

Revision history for this message
TDB (michael-baranov) wrote :

I'm her to report +1:
Toshiba satellite p205, using swap partition (2xRAM). Hibernate button missing, suspend broken. Resuming from suspend restarts X (forces login screen).
Before the update both the hibernate and resume used to work pretty much OK.

Revision history for this message
slazZ (slazz) wrote :

@TDB
Your last problem is another bug, which is already fixed: https://bugs.launchpad.net/ubuntu/+source/acpi-support/+bug/136453

Revision history for this message
Colin Watson (cjwatson) wrote :

Sitsofe Wheeler's analysis in https://bugs.launchpad.net/ubuntu/+source/powermanagement-interface/+bug/136433/comments/10 is spot-on. I'll fix this straight away.

Changed in powermanagement-interface:
assignee: intuitive-nipple → kamion
status: New → Confirmed
Revision history for this message
Colin Watson (cjwatson) wrote :

powermanagement-interface (0.3.17) gutsy; urgency=low

  * pmi.acpi: Fix inverted swap file logic (thanks, Sitsofe Wheeler;
    LP: #136433). Add some comments for good measure.

 -- Colin Watson <email address hidden> Sat, 01 Sep 2007 16:18:16 +0100

Changed in powermanagement-interface:
status: Confirmed → 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.