Bug#837194: systemd --user: service action not triggered

Felipe Sateler fsateler at debian.org
Sat Sep 10 16:51:13 BST 2016

Control: tags -1 moreinfo

On 9 September 2016 at 20:00, Brainslug <brainslug at freakmail.de> wrote:
> Package: systemd
> Version: 231-4
> Severity: normal
> Dear Maintainer,
> I have a business laptop for which I do not have root access. The system is
> configured to suspend when I press the power key. Now I am trying to
> configure systemd on a user level to lock my screen before the system
> suspends.
> I have a working service file in ~/.config/systemd/user/i3lock.service, like
> so:
> [Unit]
> Description=i3lock
> Before=sleep.target
> [Service]
> Type=forking
> Environment=DISPLAY=:0
> ExecStart=/usr/bin/i3lock -c 000000
> [Install]
> WantedBy=sleep.target
> I can enable the service via the --user option:
> brainslug at flexo:~$ systemctl --user enable i3lock
> Created symlink
> /home/brainslug/.config/systemd/user/sleep.target.wants/i3lock.service →
> /home/brainslug/.config/systemd/user/i3lock.service.
> I can start the service via
> brainslug at flexo:~$ systemctl --user start i3lock
> which immediately locks my screen, so I would think the service file itself
> is correct and working.
> However, when suspending the laptop this does not seem to trigger my service
> file and my screen remains unlocked on resume.

sleep.target is a unit only on the system manager (ie, it does not
exist in the --user instance). So this is not expected to work.

If you think this should work, please report this upstream at
https://github.com/systemd/systemd/issues/new. (this is not the kind
of thing that should be implemented in a downstream patch). Otherwise
I would close this bug as it is expected that it doesn't work.


Felipe Sateler

More information about the Pkg-systemd-maintainers mailing list