[systemd-devel] systemd hibernator generator does not function on default Fedora install

Lennart Poettering lennart at poettering.net
Fri Apr 22 13:32:24 UTC 2016


On Thu, 21.04.16 12:00, Chris Murphy (lists at colorremedies.com) wrote:

> On Wed, Apr 20, 2016 at 3:14 AM, Lennart Poettering
> <lennart at poettering.net> wrote:
> > On Tue, 19.04.16 22:47, Chris Murphy (lists at colorremedies.com) wrote:
> >
> >> In some ancient bug or lkml I'd read a kernel maintainer say that the
> >> hibernation image size isn't fixed, and might be less than RAM size
> >> but could be a little more than RAM size, especially if some swap is
> >> being used. So what should swap partition size be to support
> >> hibernation? 1x RAM? 1.5x? 2x? Other?
> >
> > Here's the heuristics code logind uses to check whether hibernation
> > shall be considered available or not:
> >
> > https://github.com/systemd/systemd/blob/master/src/shared/sleep-config.c#L229
> >
> > i.e. it checks that the RAM size is smaller than 0.98 times the
> > currently unused swap space.
> 
> Default Fedora 24 installation, 'free' shows
> 
> Mem:  2048524
> Swap: 2098172
> 
> Mem is 0.976 times unused swap, on a clean boot where no swap at all
> is being used. If as little as 8MiB swap were used, sounds like
> hibernation would fail? How does it fail if mem > 0.98 * swap? I think
> this swap is too small to rely upon, but my main concern is how the
> hibernation fails, if it's fail safe, and if there's some way for user
> space to predict it will fail so it doesn't even attempt it?

The Hibernate() bus call will immediately return an error indicating that
hibernation is not possible if the check fails. It's up to the client
code to then retry Suspend() or so, depending on what policy it tries
to follow there.

Also note that there's a CanHibernate() bus call that just executes
the check, and returns the result. The idea is that DEs use that to
gray out/make unavailable any hibernation UI if the system isn't set
up for that.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list