intro, where complaints are made excessively
Note: this short article in no way criticises
systemd. It’s not
systemd's fault, that – while it provides a nice framework for managing various power states – it does not come with any built-in functionality besides bare kernel interface. If that works for you and you don’t need to handle any quirks of your hardware, you don’t need this article.
But I digress. Until
systemd's suspend and hibernate will provide the same functionality as pm-utils, one might just want to tell systemd to use
pm-utils. It’s easy enough to do.
the actual part where things are described
Disclaimer: I take no responsibility for any damage this might do to any system. I’m assuming that the reader knows what they’re doing and are reasonably familiar with command line interface and systemd.
First, let’s install
pm-utils. On Debian-based systems
apt-get install pm-utils will do nicely.
Second, let’s locate the relevant service files. On Debian-based systems one or more of the following files should do:
/lib/systemd/system/systemd-hibernate.service /lib/systemd/system/systemd-hybrid-sleep.service /lib/systemd/system/systemd-suspend.service
As I’m not using hibernation or hybrid sleep, I’ve decided to override only the suspend service so I’ve put the following into /etc/systemd/system/systemd-suspend.service:
# Use pm-utils instead of systemd-sleep [Unit] Description=Suspend Documentation=man:pm-suspend(8) DefaultDependencies=no Requires=sleep.target After=sleep.target [Service] Type=oneshot ExecStart=/usr/sbin/pm-suspend
The only relevant change here is to replace the systemd-sleep binary in the
ExecStart= stanza with
Reloading the systemd configuration (
systemd daemon-reload) or restarting it (
systemd daemon-reexec) should do the trick. (One could probably also use
systemctl edit systemd-suspend.service, but I’m new to this whole systemd thingy.)
(Note: this is a shortcut. It’s absolutely possible to port all functionality of
pm-utils to use the framework provided by systemd – I just haven’t had enough time to do that. See
systemd-sleep.conf(5) manpages for more information.)