[systemd-devel] enable/disable swap before/after hibernation
Lukas Pirl
systemd at lukas-pirl.de
Thu Jul 28 17:25:31 UTC 2016
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
More information about the systemd-devel
mailing list