[systemd-devel] On(Resume|suspend|hibernate) in unit files?

Frederic Crozat fcrozat at suse.com
Thu Feb 28 09:07:23 PST 2013


Le jeudi 28 février 2013 à 17:58 +0100, Tom Gundersen a écrit :
> On Thu, Feb 28, 2013 at 5:51 PM, Frederic Crozat <fcrozat at suse.com> wrote:
> > Le jeudi 28 février 2013 à 15:55 +0000, Colin Guthrie a écrit :
> >> 'Twas brillig, and Lennart Poettering at 28/02/13 12:37 did gyre and gimble:
> >> > On Wed, 27.02.13 22:22, Cristian Rodríguez (crrodriguez at opensuse.org) wrote:
> >> >
> >> >> Hi:
> >> >>
> >> >> There is buggy, legacy software around which simply does not behave
> >> >> properly when faced with resume/suspend/hibernate which is not
> >> >> always practical to modify or fix.
> >> >>
> >> >> Is there any way to have something like
> >> >>
> >> >> ReloadOnResume=[true|false]
> >> >> StopOnSuspend=[true|false]
> >> >>
> >> >> Or some other mechanism provided by systemd/logind that does not
> >> >> require to use the ugly /usr/lib/systemd/system-sleep/ hooks ?
> >> >
> >> > My recommendation would be to fix the software in question. I mean, we
> >> > will provide compatibility with older software, but we are very
> >> > conservative on adding hacky work-arounds for broken software,
> >> > especially if no such hack existed in the solutions that were used
> >> > before systemd.
> >>
> >> FWIW, while I'm in total agreement with what you say and the resolution,
> >> the pm-utils hooks are what was used before systemd so there technical
> >> was such a hack that existed in the solutions that were used before systemd.
> >>
> >> I remember seeing various hooks here to e.g. shut down mysql and restart
> >> it again and such like things. That particular example hasn't been
> >> needed for me for ages, but I'm sure there are other examples that might
> >> be more legitimate.
> 
> If they are needed, couldn't equivalent /usr/lib/systemd/system-sleep
> hooks be created in their place?

For most of them, I guess, yes. But there is no ordering guaranty in
systemd-sleep directory, unlike pm-utils (were you can order modules by
their name).

> >> That said, I think Fred had patches that are applied in Suse to read
> >> these pm-utils hooks anyway, so that might be what Cristian needs?
> >
> > Well, the patch in question is even more ugly than that, since it defers
> > to pm-utils (when available) suspend / hibernate ;(
> 
> At some point we had a 'legacy' hook for Arch, but eventually decided
> against shipping it. It was a script
> /usr/lib/systemd/system-sleep/pm-utils which would simply convert the
> systemd arguments to pm-utils ones and call all the scripts in
> /usr/lib/pm-utils/sleep.d with this argument. Is that what you had as
> well?

Something like that (I wasn't aware of it, otherwise I would probably
have stolen it :) but since it had to be done very late in 12.3 release
cycle, I modified systemd-sleep to call pm-utils (if available), after
running systemd hooks, instead of doing the write to /sys/power/disk. 

-- 
Frederic Crozat <fcrozat at suse.com>
SUSE



More information about the systemd-devel mailing list