[Ubuntu 18.04] [Feature] Inconsistent report of pm CanSuspend state by systemd and pm-utils

Bug #1706948 reported by bugproxy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
The Ubuntu-power-systems project
Invalid
High
rahmadani
pm-utils (Ubuntu)
Invalid
High
rahmadani

Bug Description

== Comment: #0 - Balamuruhan S <> - 2017-06-28 03:39:15 ==
systemd and pm-utils interprets CanSuspend states differently and reports it as supported or not in a conflicting way.

# gdbus call --system --dest org.freedesktop.login1 --object-path /org/freedesktop/login1 --method org.freedesktop.login1.Manager.CanSuspend
('yes',)

# pm-is-supported --suspend
# echo $?
1

Both systemd and pm-is-supported looks into /sys/power/state file to check if suspend is supported.

pm-is-supported --suspend returns true if either "standby" or "mem" is present in the file.
( /usr/lib/pm-utils/pm-functions )

systemd(Manager.CanSuspend) returns true if "standby", "freeze" or "mem" is present in the file.
( https://github.com/systemd/systemd/blob/dd8352659c9428b196706d04399eec106a8917ed/src/shared/sleep-config.c )

# cat /sys/power/state
freeze

So here, pm-is-supported --suspend returns false and gdbus returns true.

Both these utilities interpret /sys/power/state differently.

Secondly, systemd should split CanSuspend to Cansuspend+CanFreeze Or don't report freeze as CanSuspend.

Impact of this inconsistency can be felt from Libvirt supported pm states:

To reduce ABI dependency, libvirt queries the available states via dbus, if not falls to pm-utils. Libvirt won't check for strings in sys/power/state and interpret directly.

so due to this, libvirt will list that suspend_to_mem is supported from virsh capabilities but ideally it might not.

bugproxy (bugproxy)
tags: added: architecture-ppc64le bugnameltc-156093 severity-high targetmilestone-inin1710
Changed in ubuntu:
assignee: nobody → Ubuntu on IBM Power Systems Bug Triage (ubuntu-power-triage)
affects: ubuntu → pm-utils (Ubuntu)
tags: added: artful
Frank Heimes (fheimes)
Changed in ubuntu-power-systems:
importance: Undecided → High
Manoj Iyer (manjo)
Changed in pm-utils (Ubuntu):
milestone: none → ubuntu-17.10
importance: Undecided → High
Revision history for this message
Frank Heimes (fheimes) wrote :

This package / The package is part of the universe section of the Ubuntu archive. Universe packages are maintained by the community, and the maintainers do not necessarily work for Canonical, therefore these packages are not always supported directly by Canonical.
The existing process to update packages in the Universe archive with patches, is as follows:
1. Upstream: Upstream your fix to the appropriate upstream project.
2. Debian: once your patch is ack’ed and accepted upstream, you need to request a merge of this patch to the package in Debian stable. https://www.debian.org/Bugs/Reporting use this link to report your issue and submit a fix.
3. Ubuntu: Once it is merged into Debian stable, request a merge of this package with Ubuntu. https://wiki.ubuntu.com/Debian/Bugs will provide you an overview on how to handle bugs that are reported to Debian and subsequently to Ubuntu.
- The merge request lands by default in Ubuntu's current development release (today ‘Artful’).
- If required an SRU may follow to get the changes into already released Ubuntu versions (like ‘Xenial’ or ‘Zesty’).
Work with the respective upstream maintainers (Debian and Ubuntu) is required during this process. For critical issues we can advise you as you go through this process and help push the patches through by chasing the appropriate project contributors.
[To find out if a package is a universe package use: apt policy <package-name>.]

Manoj Iyer (manjo)
tags: added: triage-g
Changed in ubuntu-power-systems:
status: New → Incomplete
Changed in pm-utils (Ubuntu):
status: New → Incomplete
Revision history for this message
bugproxy (bugproxy) wrote : Comment bridged from LTC Bugzilla

------- Comment From <email address hidden> 2017-10-19 09:20 EDT-------
*** Bug 150856 has been marked as a duplicate of this bug. ***

Manoj Iyer (manjo)
Changed in pm-utils (Ubuntu):
milestone: ubuntu-17.10 → ubuntu-18.04
Revision history for this message
Manoj Iyer (manjo) wrote : Re: [Ubuntu 1710] [Feature] Inconsistent report of pm CanSuspend state by systemd and pm-utils

Assigning to the foundations team to follow up on this feature when we update package in 18.04

Changed in pm-utils (Ubuntu):
assignee: Ubuntu on IBM Power Systems Bug Triage (ubuntu-power-triage) → Canonical Foundations Team (canonical-foundations)
summary: - [Ubuntu 1710] [Feature] Inconsistent report of pm CanSuspend state by
+ [Ubuntu 18.04] [Feature] Inconsistent report of pm CanSuspend state by
systemd and pm-utils
Revision history for this message
Steve Langasek (vorlon) wrote :

I'm not sure that Frank's follow-up comment and package assignment corresponds to the original bug report.

If I understand the original bug report correctly, the problem is that systemd reports 'yes' to CanSuspend on systems that only support 'freeze', and that this is seen as incorrect.

Therefore the problem is not inconsistency between systemd and pm-utils; the problem is inconsistency between systemd and the consumer of the CanSuspend API (in this case, libvirt).

This API is org.freedesktop.login1.Manager.CanSuspend, which is part of logind, which is defined by systemd. So unless this is a behavior change in systemd, it doesn't appear to be a bug that we can do anything about directly in Ubuntu; the semantics of this API are defined by upstream, and any changes to those semantics would need to be negotiated with upstream.

For my part, I am not clear why 'freeze' should not be considered a subcategory of suspend-to-mem, so perhaps this bug will be 'wontfix' by systemd upstream. At the very least, this bug report seems to be missing an explanation of why the current behavior of systemd is wrong.

In any case, it's clear to me that no change in pm-utils will address the root problem being reported, because a) libvirt prefers logind over pm-utils, we always have logind present in 18.04, and we do not install pm-utils by default, so changing pm-utils will not change the observed behavior; and b) AIUI the bug submitter is asserting that pm-utils' behavior is the correct behavior.

Changed in pm-utils (Ubuntu):
assignee: Canonical Foundations Team (canonical-foundations) → nobody
Revision history for this message
bugproxy (bugproxy) wrote : Comment bridged from LTC Bugzilla

------- Comment From <email address hidden> 2017-09-19 01:35 EDT-------
Tested this on latest libvirtd 3.6.0 and I am not seeing the issue.

# gdbus call --system --dest org.freedesktop.login1 --object-path /org/freedesktop/login1 --method org.freedesktop.login1.Manager.CanSuspend('yes',)

# pm-is-supported --suspend

# echo $?
0

# cat /sys/power/state
freeze mem

------- Comment From <email address hidden> 2017-09-19 01:42 EDT-------
pm-utils 1.4.1-17

Version of pm-utils

------- Comment From <email address hidden> 2017-09-19 05:27 EDT-------
(In reply to comment #7)
> Bala,
>
> Is this still an issue with the latest libvirt updates in Ubuntu 17.10?

Hi Leonardo,

This bug originated from https://bugzilla.linux.ibm.com/show_bug.cgi?id=150043 for the purpose of tracking in Ubuntu. The issue have been fixed in Kernel and can be closed.

Thank you Nageswara for validating it.

-- Bala

------- Comment From <email address hidden> 2017-10-09 08:16 EDT-------
Closing based on last comment.

Frank Heimes (fheimes)
Changed in pm-utils (Ubuntu):
status: Incomplete → Invalid
Changed in ubuntu-power-systems:
status: Incomplete → Invalid
rahmadani (rahmadani)
Changed in pm-utils (Ubuntu):
assignee: nobody → rahmadani (rahmadani)
Changed in ubuntu-power-systems:
assignee: nobody → rahmadani (rahmadani)
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.