Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Situation:

1) I am using systemd to suspend to disk using: systemctl hibernate

2) I have mounted a filesystem on an encrypted block device, that I suspend using dmsetup suspend device in order to wipe the key before I go into hibernation.

The problem:

The hibernation hangs at

systemd-sleep[7366]: Suspending system...
kernel: PM: Hibernation mode set to 'platform'
kernel: PM: Syncing filesystems ...

If I resume (dmsetup resume device), then the syncing can be completed and hibernation will continue

Is there another way to either issue the suspend command AFTER the sync when entering hibernation? Or another way to wipe the encryption keys, that allows me to safely enter hibernation (besides encryption the swap partition)?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

one solution seems to be to use the following systemd unit:

[Unit]
Description=test
After=<target>

[Service]
Type=oneshot
ExecStart=/path/to/wipe

[Install]
WantedBy=<target>

<target> is the corresponding target of your desired mode. From the systemd-suspend.service Manpage: suspend.target, hibernate.target, or hybrid-sleep.target

And the wipe script:

dmsetup suspend "$name"
dmsetup message "$name" 0 key wipe
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.