Re: [systemd-devel] enable/disable swap before/after hibernation

2016-07-29 Thread Lukas Pirl
> If clients ask logind whether hibernation is available or try to 
> initiate hibernation we check whether swap is available and refuse
> if it isn't. This means if you add the swap only after the
> hibernation was already initiated then this will not be able to
> affect the check anymore.

I expected something like that – thanks for the explanation.

> You can bypass this check by setting the 
> SYSTEMD_BYPASS_HIBERNATION_MEMORY_CHECK env var for the logind
> service (add a drop-in using Environment= for it).
> 
> See https://github.com/systemd/systemd/pull/3064 and related.

Excellent pointer! Thanks Lennart!

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] enable/disable swap before/after hibernation

2016-07-28 Thread Lukas Pirl
Dear list,

I want to enable/disable the swap partition before/after hibernation.

However, it seems I cannot get the service to run early enough to avoid
the error:

  Failed to hibernate system via logind: Sleep verb not supported

The .service file looks as follows:

  [Unit]
  Description=…
  StopWhenUnneeded=true
  Before=hibernate.target

  [Service]
  Type=oneshot
  RemainAfterExit=yes
  ExecStart=/sbin/swapon /my/device
  ExecStop=/sbin/swapoff /my/device

  [Install]
  RequiredBy=hibernate.target

The service file itself works (with StopWhenUnneeded=true removed and
upon manual start/stop and verification).
It was installed by running `systemctl enable /path/to/file.service`

As another variation, I tried to hook against sleep.target and
hibernate.service with no luck.

Any help very much appreciated (this of course includes completely
different approaches).

Best,

Lukas
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel