There is hibernate option even without an active swap partition

Bug #1313522 reported by Yu Ning
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OEM Priority Project
Fix Released
Critical
Unassigned
systemd (Ubuntu)
Fix Released
Medium
Martin Pitt
Trusty
Fix Released
High
Yu Ning
Utopic
Fix Released
Medium
Martin Pitt

Bug Description

In Ubuntu 13.10 and 14.04 the "hibernate" option will always be displayed in the system dropdown menu, even if there is no active swap partition. Click the hibernate option will perform the hibernate operation but will fail during the process.

As a contrast, in Ubuntu 13.04 and earlier releases the "hibernate" option is visible only if there is active swap partition.

FIX: http://anonscm.debian.org/gitweb/?p=pkg-systemd/systemd.git;a=commitdiff;h=2ecac75111a (backported from upstream)

[Impact]

With the backported patch when there is no active swap partition "hibernate" will not be displayed in the system dropdown menu.

[Test Case]

1. Install Ubuntu 14.04 image, do not create swap partition during installation
2. Login to desktop
3. Click the system icon on the top right of the screen
4. Check if there is "hibernate" option in the dropdown menu

Expected result:
The "hibernate" option should not be visible

Actual result:
There is the "hibernate" option, click on it will perform the hibernation operation, but will fail during the procedure.

[Regression Potential]
N/A

Related branches

Revision history for this message
Yu Ning (yuningdodo) wrote :

I'm not sure if systemd is the right project to report this bug against, please let me know if I made any mistakes.

Ara Pulido (ara)
Changed in oem-priority:
importance: Undecided → Critical
Revision history for this message
Ara Pulido (ara) wrote :

We are basically reusing the hibernate option (after getting it back in) remapped to hybrid sleep. But the idea is the same, as hybrid sleep also saves the state to disk, we will need this to not show when swap is not present.

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

Can you please give me the output of

  $ for op in suspend hibernate suspend-hybrid; do sudo pm-is-supported --$op && echo $op; done

to confirm that it shows hibernate? That would be pm-utils not seeing the lack of a swap partition then.

affects: systemd (Ubuntu) → pm-utils (Ubuntu)
Changed in pm-utils (Ubuntu):
status: New → Incomplete
Revision history for this message
Martin Pitt (pitti) wrote :

Nevermind, pm-utils isn't checking available swap at all. In the past, upower did that, but now systemd and systemd-shim would need to pick that up.

affects: pm-utils (Ubuntu) → systemd-shim (Ubuntu)
Changed in systemd-shim (Ubuntu):
status: Incomplete → Triaged
Revision history for this message
Martin Pitt (pitti) wrote :

Checked deeper, src/login/logind-action.c() calls can_sleep(), which in version 204 does not yet check for swap. So we need to backport the checks in src/shared/sleep-config.c from later versions.

affects: systemd-shim (Ubuntu) → systemd (Ubuntu)
Changed in systemd (Ubuntu):
importance: Undecided → Medium
status: Triaged → In Progress
Martin Pitt (pitti)
Changed in systemd (Ubuntu):
assignee: nobody → Martin Pitt (pitti)
Revision history for this message
Martin Pitt (pitti) wrote :

Patches backported from newer systemd, committed: http://anonscm.debian.org/gitweb/?p=pkg-systemd/systemd.git;a=commitdiff;h=2ecac75111a5b

I tested this on a system without swap and with a swap partition. It also supports swap files, but I haven't explicitly tested that.

Changed in systemd (Ubuntu):
assignee: Martin Pitt (pitti) → nobody
status: In Progress → Fix Committed
description: updated
Changed in systemd (Ubuntu):
assignee: nobody → Martin Pitt (pitti)
Changed in systemd (Ubuntu Trusty):
assignee: nobody → Martin Pitt (pitti)
status: New → Triaged
importance: Undecided → High
Yu Ning (yuningdodo)
description: updated
Yu Ning (yuningdodo)
description: updated
Revision history for this message
Martin Pitt (pitti) wrote :

Uploaded the trusty SRU, thanks Yu Ning!

Changed in systemd (Ubuntu Trusty):
status: Triaged → In Progress
assignee: Martin Pitt (pitti) → Yu Ning (yuningdodo)
Revision history for this message
Adam Conrad (adconrad) wrote : Please test proposed package

Hello Yu, or anyone else affected,

Accepted systemd into trusty-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/systemd/204-5ubuntu20.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in systemd (Ubuntu Trusty):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
Yu Ning (yuningdodo) wrote :

Thank you Martin for your patch.

I verified it as comment #8 suggested, after upgrading systemd to 204-5ubuntu20.1 on trusty:
a) with swap partition enabled, there is the "hibernate" option in the menu, click it can enter S4 successfully.
b) with swap partition disabled, there is no "hibernate" option in the menu.
c) with swap file enabled, there is the "hibernate" option in the menu, click it can enter S4 successfully.

So, everything just works as expect, I'll change the tag from verification-needed to verification-done.

tags: added: verification-done
removed: verification-needed
Revision history for this message
Martin Pitt (pitti) wrote :

This has been in trusty-updates for a while already, the bug was just forgotten to get closed.

Changed in systemd (Ubuntu Trusty):
status: Fix Committed → Fix Released
Revision history for this message
Ara Pulido (ara) wrote :

This has been fixed already in trusty-updates

Changed in oem-priority:
status: New → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package systemd - 204-10ubuntu4

---------------
systemd (204-10ubuntu4) utopic; urgency=medium

  * Drop Fix-a-race-condition-at-boot-with-serio-devices.patch, superseded by
    cherry-picked more generic upstream fix.
  * logind.conf: Enable net_cls and netprio too, for compatibility with future
    kernels. (LP: #1317179)
  * Pull latest keymaps from upstream.

systemd (204-11) UNRELEASED; urgency=medium

  [ Martin Pitt ]
  * Explain patch management in debian/README.source. (Closes: #739113)
  * Replace "Always probe cpu support drivers" patch with cherry-picked
    upstream fix which is more general.
  * Advertise hibernation only if there's enough free swap. Patches backported
    from current upstream. (LP: #1313522)
  * Fix typo in sg loading rule to make it actually work.

  [ Michael Biebl ]
  * Make no-patch-numbers the default for gbp-pq.

  [ Michael Stapelberg ]
  * Clarify that “systemd” does not influence init whereas “systemd-sysv” does
    (Closes: #747741)
 -- Martin Pitt <email address hidden> Sun, 25 May 2014 12:24:21 +0200

Changed in systemd (Ubuntu Utopic):
status: Fix Committed → Fix Released
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.