[systemd-devel] [PATCH] units: add ConditionKernelCommandLine=resume

Lennart Poettering lennart at poettering.net
Thu Apr 23 08:10:16 PDT 2015


On Tue, 17.02.15 01:33, Cristian Rodríguez (crrodriguez at opensuse.org) wrote:

> If there is no resume= ..it is not possible to
> hubrid-sleep or hibernate

To my knowledge the resume device can be discovered in different ways
than just the kernel cmdline. On my machine here there is no resume=
on the kernel cmdline, and hibernation works anyway. 

Also, even if: simply not running the sleep service, and skipping over
it sounds like the wrong approach. It would just turn hibernation into
a NOP, but it should properly fail.

If this was really an issue, then the right fix would be to change
can_sleep() in src/shared/sleep-config.c, to detect this properly.

> ---
>  units/systemd-hibernate.service.in    | 1 +
>  units/systemd-hybrid-sleep.service.in | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/units/systemd-hibernate.service.in b/units/systemd-hibernate.service.in
> index 29d9b69..2a21cfc 100644
> --- a/units/systemd-hibernate.service.in
> +++ b/units/systemd-hibernate.service.in
> @@ -11,6 +11,7 @@ Documentation=man:systemd-suspend.service(8)
>  DefaultDependencies=no
>  Requires=sleep.target
>  After=sleep.target
> +ConditionKernelCommandLine=resume
>  
>  [Service]
>  Type=oneshot
> diff --git a/units/systemd-hybrid-sleep.service.in b/units/systemd-hybrid-sleep.service.in
> index 914b686..b3039a0 100644
> --- a/units/systemd-hybrid-sleep.service.in
> +++ b/units/systemd-hybrid-sleep.service.in
> @@ -11,6 +11,7 @@ Documentation=man:systemd-suspend.service(8)
>  DefaultDependencies=no
>  Requires=sleep.target
>  After=sleep.target
> +ConditionKernelCommandLine=resume
>  
>  [Service]
>  Type=oneshot
> -- 
> 2.2.2
> 
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list