diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index ef8cad0a31..53e966562e 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -2160,6 +2160,10 @@ static int method_do_shutdown_or_sleep( return sd_bus_error_set(error, BUS_ERROR_SLEEP_VERB_NOT_SUPPORTED, "Specified resume device is missing or is not an active swap device"); + case SLEEP_RESUME_MISCONFIGURED: + return sd_bus_error_set(error, BUS_ERROR_SLEEP_VERB_NOT_SUPPORTED, + "Invalid resume config: resume= is not populated yet resume_offset= is"); + case SLEEP_NOT_ENOUGH_SWAP_SPACE: return sd_bus_error_set(error, BUS_ERROR_SLEEP_VERB_NOT_SUPPORTED, "Not enough suitable swap space for hibernation available on compatible block devices and file systems"); diff --git a/src/shared/hibernate-util.c b/src/shared/hibernate-util.c index ce49344deb..7c21157580 100644 --- a/src/shared/hibernate-util.c +++ b/src/shared/hibernate-util.c @@ -159,7 +159,7 @@ static int read_resume_config(dev_t *ret_devno, uint64_t *ret_offset) { } if (devno == 0 && offset > 0 && offset != UINT64_MAX) - return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), + return log_debug_errno(SYNTHETIC_ERRNO(ENOMEDIUM), "Found populated /sys/power/resume_offset (%" PRIu64 ") but /sys/power/resume is not set, refusing.", offset); diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c index 0a4303f3eb..3d4d331710 100644 --- a/src/shared/sleep-config.c +++ b/src/shared/sleep-config.c @@ -378,6 +378,10 @@ static int sleep_supported_internal( *ret_support = SLEEP_RESUME_DEVICE_MISSING; return false; + case -ENOMEDIUM: + *ret_support = SLEEP_RESUME_MISCONFIGURED; + return false; + case -ENOSPC: *ret_support = SLEEP_NOT_ENOUGH_SWAP_SPACE; return false; diff --git a/src/shared/sleep-config.h b/src/shared/sleep-config.h index be0287e2e4..b59bce8fc4 100644 --- a/src/shared/sleep-config.h +++ b/src/shared/sleep-config.h @@ -60,6 +60,7 @@ typedef enum SleepSupport { SLEEP_STATE_OR_MODE_NOT_SUPPORTED, /* SleepConfig.states/modes are not supported by kernel */ SLEEP_RESUME_NOT_SUPPORTED, SLEEP_RESUME_DEVICE_MISSING, /* resume= is specified, but the device cannot be found in /proc/swaps */ + SLEEP_RESUME_MISCONFIGURED, /* resume= is not set yet resume_offset= is configured */ SLEEP_NOT_ENOUGH_SWAP_SPACE, SLEEP_ALARM_NOT_SUPPORTED, /* CLOCK_BOOTTIME_ALARM is unsupported by kernel (only used by s2h) */ } SleepSupport;