Bug 85169 - Add Avoid field to handle sleep modi (hibernate, suspend, hybrid)
Summary: Add Avoid field to handle sleep modi (hibernate, suspend, hybrid)
Status: RESOLVED WONTFIX
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: All All
: high enhancement
Assignee: systemd-bugs
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-18 09:07 UTC by Eric L.
Modified: 2014-10-18 14:39 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Eric L. 2014-10-18 09:07:44 UTC
After managing to get my (Debian) system to properly go sleeping using systemd without the pm framework, I ended with a quite ugly solution where I have a service that depends on sleep and stops things at start time and (re-)start them at stop time, so that devices and services that don't like sleep modes are stopped before and restarted after.
If I didn't miss anything, there isn't such a feature yet, so I would suggest to add something like a new "Avoid=" field, which would mean for systemd:
- stop the unit before the avoided unit is started
- note down the stopped unit and all stopped dependencies
- once the avoided unit has been stopped, restart all the avoiding units and what depends on them that was stopped
In this way, a simple "Avoid=sleep.target" added to a service definition would allow for such units sensible to sleep modes to be stopped and re-started properly.
A "Avoid=shutdown.target" could similarly be used to have services not starting automatically to survive a reboot/shutdown cycle if they've been started manually before.
Comment 1 Eric L. 2014-10-18 09:14:45 UTC
I forgot that it would be important to have the same mechanism available for devices because it is often hardware drivers (or the hardware itself) that don't support well a sleep cycle (it is the case of my TV-card), so a SYSTEMD_AVOID property might required to unload/reload the corresponding kernel module.
Comment 2 Zbigniew Jedrzejewski-Szmek 2014-10-18 14:39:57 UTC
Hi,

this has been discussed many many times. The proper fix is to fix the kernel drivers and whatever daemons to support sleep properly, not to add workarounds in init. We don't want to add functionality for that purpose.

If you need help with implementing the workarounds that are temporarily needed, we'll be happy to help (systemd-devel@lists.freedesktop.org or #systemd on freenode.net are probably better places though than the bugtracker).


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.