hibernate included in shutdown menu, even if it can't work.

Bug #223770 reported by Alex Mauer on 2008-04-28
16
This bug affects 1 person
Affects Status Importance Assigned to Milestone
devicekit-power (Ubuntu)
Wishlist
Unassigned

Bug Description

I have a machine on which I've recently upgraded the memory. Now the swap space is too small to allow hibernate to occur. But the GNOME logout menu still includes the "Hibernate" option.

If the machine cannot hibernate, the logout menu shouldn't include the option.

Pedro Villavicencio (pedro) wrote :

thanks for your report, i don't know if that's possible to do, same with suspend or shutdown, however feel free to submit this upstream at bugzilla.gnome.org to see what the developers think about it, for forwarding instructions please have a look to https://wiki.ubuntu.com/Bugs/Upstream/GNOME ; leaving this as incomplete until that, thanks.

Changed in gnome-power-manager:
importance: Undecided → Wishlist
status: New → Incomplete
Pedro Villavicencio (pedro) wrote :

Closing this bug report as no further information has been provided. Please feel free to reopen this bug if you can provide the information asked for. Thanks!.

Changed in gnome-power-manager:
status: Incomplete → Invalid
Alex Mauer (hawke) wrote :

No further information was requested, so I could not have provided any.

Changed in gnome-power-manager:
status: Invalid → New
Chris Coulson (chrisccoulson) wrote :

Thank you for your bug report. However, this is outside of the scope for gnome-power-manager. Currently, pm-utils is responsible for determining whether the machine supports suspend or hibernate, so any additional checks like this should go there. I am re-assigning this bug report to pm-utils for this reason.

Thanks

Changed in gnome-power-manager:
status: New → Triaged
Chow Loong Jin (hyperair) wrote :

Well, this is interesting. We should forward this upstream. I'd come up with a patch, but I don't know how to test whether there's enough space in the swap. If someone can come up with a snippet of code in Bash that can do just that, then I'll come up with a patch for it.

Something worth noting is that depending on capacity of the swap and the
current memory usage, whether or not there is enough free space on the
swap to fit the total memory used can be transient. However,
gnome-power-manager only checks (with pm-is-supported --hibernate) for
the status of hibernate support only once, if I'm not mistaken. If it
fails once, it does not try again.

Another thing worth noting is that, supposing the user is using uswsusp,
compression is generally used on the swap image, so it would be pretty
hard to figure out whether it can actually the used memory can actually
fit into the swap or not, under certain circumstances, because the
compression ratio is unpredictable.

As for the case of tuxonice, I have absolutely no idea about how that
works, having never used it before.

Perhaps it might be a good idea to file this bug upstream.
--
Chow Loong Jin

Chris Coulson (chrisccoulson) wrote :

hyperair - gnome-power-manager doesn't invoke pm-is-supported. g-p-m gets the power capabilities over HAL, which gets them from pm-utils. HAL only checks the capabilities when it starts I think.

Thinking about it, I'm not sure this is such a good idea. The used RAM is compressed before being written to swap when you hibernate, so I think it is difficult to predict exactly how much disk space is required for hibernation. I wouldn't want my machine to suddenly decide to disable hibernate on the off-chance that the image might not fit on disk. I would rather it tried to hibernate, and then failed gracefully if there was not enough disk space to hibernate. In this situation, the user should then be presented with a message telling them why hibernate failed (which doesn't happen currently, and there is already a bug report for that somewhere).

And I think that it would be even more confusing to users if they find that hibernate keeps disappearing and reappearing in their session dialog or fast user switch applet of whatever they use, for seemingly no apparent reason.

Chow Loong Jin (hyperair) wrote :

On Tue, 2008-10-14 at 20:27 +0000, Chris Coulson wrote:
> hyperair - gnome-power-manager doesn't invoke pm-is-supported. g-p-m
> gets the power capabilities over HAL, which gets them from pm-utils. HAL
> only checks the capabilities when it starts I think.
>
Whoops. Forgot about HAL.
> Thinking about it, I'm not sure this is such a good idea. The used RAM
> is compressed before being written to swap when you hibernate, so I
> think it is difficult to predict exactly how much disk space is required
> for hibernation. I wouldn't want my machine to suddenly decide to
> disable hibernate on the off-chance that the image might not fit on
> disk. I would rather it tried to hibernate, and then failed gracefully
> if there was not enough disk space to hibernate. In this situation, the
> user should then be presented with a message telling them why hibernate
> failed (which doesn't happen currently, and there is already a bug
> report for that somewhere).
I'm not sure if pm-utils' kernel method does compression, but I'm very
sure that uswsusp's s2disk does it. Either way, you're right. In that
case, could you locate the bug and mark this bug as a duplicate of the
said bug?
>
> And I think that it would be even more confusing to users if they find
> that hibernate keeps disappearing and reappearing in their session
> dialog or fast user switch applet of whatever they use, for seemingly no
> apparent reason.
Yeah, putting it that way certainly brings things into perspective.

--
Chow Loong Jin

On Tue, 2008-10-14 at 17:47 +0000, Launchpad Bug Tracker wrote:
> You have been subscribed to a public bug:
>
> I have a machine on which I've recently upgraded the memory. Now the
> swap space is too small to allow hibernate to occur. But the GNOME
> logout menu still includes the "Hibernate" option.

Unfortuantly, there is no way for pm-utils to know that is the case
without actually trying it. Just because you have less swap space than
system memory does not mean hibernate will fail no matte the method you
use, the system will throw away memory it can load from the hard disk
elsewhere (filesystem cache and the like) if the memory will not fit in
hte amout of swap space available. Uswsusp and the in-kernel hibernate
have to do this anyways, because the way they take a snapshot is by
freeing up half the memory and then copying the non-freed half over the
pits that got freed before writing the snapshot to swap space.

> If the machine cannot hibernate, the logout menu shouldn't include the
> option.

There is no way for pm-utils to know this in advance. Sorry. Might I
suggest making your swap space bigger?

> ** Affects: pm-utils (Ubuntu)
> Importance: Wishlist
> Status: Triaged
>
--
Victor Lowther
Ubuntu Certified Professional

On Tue, 2008-10-14 at 17:44 +0000, hyperair wrote:
> Something worth noting is that depending on capacity of the swap and the
> current memory usage, whether or not there is enough free space on the
> swap to fit the total memory used can be transient. However,
> gnome-power-manager only checks (with pm-is-supported --hibernate) for
> the status of hibernate support only once, if I'm not mistaken. If it
> fails once, it does not try again.

pm-is-supported just check to see of the kernel/uswsusp/tuxonice
supports hibernation. We don't check anything else.

> Another thing worth noting is that, supposing the user is using uswsusp,
> compression is generally used on the swap image, so it would be pretty
> hard to figure out whether it can actually the used memory can actually
> fit into the swap or not, under certain circumstances, because the
> compression ratio is unpredictable.

It is undecidable no matter what method you use because all of them will
try at hibernate time to free up enough memory to make a memory snapshot
fit in the available swap space. On most systems, the majority of
memory is used for caching purposes and can either be flushed or thrown
away.

> As for the case of tuxonice, I have absolutely no idea about how that
> works, having never used it before.
>
> Perhaps it might be a good idea to file this bug upstream.

It is not a bug we can fix. The general case is undecidable.

> --
> Chow Loong Jin
>
--
Victor Lowther
Ubuntu Certified Professional

Mario Limonciello (superm1) wrote :

So with the move to devicekit-power, I believe this is actually fixed.
It checks whether there is enough swap space before offering hibernate:

/**
 * dkp_daemon_init:
 **/
static void
dkp_daemon_init (DkpDaemon *daemon)
{
        gfloat waterline;

        daemon->priv = DKP_DAEMON_GET_PRIVATE (daemon);
        daemon->priv->polkit = dkp_polkit_new ();
        daemon->priv->lid_is_present = FALSE;
        daemon->priv->lid_is_closed = FALSE;
        daemon->priv->can_suspend = FALSE;
        daemon->priv->can_hibernate = FALSE;

        /* check if we have support */
        dkp_daemon_check_state (daemon);

        /* do we have enough swap? */
        if (daemon->priv->can_hibernate) {
                waterline = dkp_daemon_check_swap (daemon);
                if (waterline > DKP_DAEMON_SWAP_WATERLINE) {
                        egg_debug ("not enough swap to enable hibernate");
                        daemon->priv->can_hibernate = FALSE;
                }
        }
}

affects: pm-utils (Ubuntu) → devicekit-power (Ubuntu)
Changed in devicekit-power (Ubuntu):
status: Triaged → Fix Released
El Toozero (eltoozero) wrote :

When/where does this happen?

After a fresh install of Karmic Alpha 5 I disabled the swap file by #'ing it's entry in /etc/fstab, upon rebooting I still had a hibernate option when hitting the power button.

Changed in devicekit-power (Ubuntu):
status: Fix Released → Confirmed
AmenophisIII (amenophisiii) wrote :

karmic final still does not have this fix included.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers