Otherwise in such case a first `systemctl hibernate` would fail but would still
initialize /sys/power/resume fooling a second `systemctl hibernate` into
believing that 'resume=' is correctly set and can be used by the resume process
to find the swap device to resume from.
Follow-up for #27330.
return log_error_errno(r, "Failed to find location to hibernate to: %m");
resume_set = r > 0;
+ r = write_efi_hibernate_location(hibernate_location, !resume_set);
if (!resume_set) {
+ if (r == -EOPNOTSUPP)
+ return log_error_errno(r, "No valid 'resume=' option found, refusing to hibernate.");
+ if (r < 0)
+ return r;
+
r = write_kernel_hibernate_location(hibernate_location);
if (r < 0)
return log_error_errno(r, "Failed to prepare for hibernation: %m");
}
- r = write_efi_hibernate_location(hibernate_location, !resume_set);
- if (r < 0 && !resume_set)
- return r;
-
r = write_mode(modes);
if (r < 0)
return log_error_errno(r, "Failed to write mode to /sys/power/disk: %m");