Bug#814758: Case power button is ignored unless dbus is installed.

2016-02-15 Thread Ansgar Burchardt
Josh Triplett  writes:
> If systemd-logind just needs dbus to check for possible inhibitors,
> could systemd-logind simply ignore inhibitors without dbus?

systemd-logind failed to start if dbus isn't available (#772700). That's
why ConditionPathExists=/lib/systemd/system/dbus.service was added in
Debian's systemd-logind.service.

Ansgar



Bug#814758: Case power button is ignored unless dbus is installed.

2016-02-15 Thread Josh Triplett
On Mon, 15 Feb 2016 14:45:18 +0100 Michael Biebl  wrote:
> Am 15.02.2016 um 08:27 schrieb Trent W. Buck:
> > It's failing because dbus isn't installed.
> > Installing dbus fixes the problem.
> > 
> > systemd Recommends: dbus.
> > 
> > dbus is Priority: standard.
> > 
> > If a system is created with debootstrap,
> > this means dbus is never installed,
> > and the power button doesn't work:
> 
> This is correct. We discussed this issue a while ago and considered
> making dbus either a hard dependency or bumping its priority to
> important. We decided against it, as we want a minimal debootstrapped
> system to not have dbus installed.

If systemd-logind just needs dbus to check for possible inhibitors,
could systemd-logind simply ignore inhibitors without dbus?
Environments that make use of the inhibitor interface should necessarily
have dbus installed, so without dbus installed, systemd-logind could
still respond to the power button by doing an orderly shutdown.

That seems like useful default behavior in a server environment.

- Josh Triplett



Bug#814758: Case power button is ignored unless dbus is installed.

2016-02-14 Thread Trent W. Buck
Package: systemd
Version: 215-17+deb8u3
Severity: normal

My computers have physical power buttons on their cases.
When the button is pressed, I want it to initiate a clean shutdown.

On a desktop install, this happens because systemd-logind handles it:

root@het:~# journalctl -fu systemd-logind
-- Logs begin at Mon 2016-02-15 15:42:58 AEDT. --
Feb 15 15:43:08 het systemd-logind[470]: New seat seat0.
Feb 15 15:43:08 het systemd-logind[470]: Watching system buttons on 
/dev/input/event1 (Power Button)
Feb 15 15:43:08 het systemd-logind[470]: Watching system buttons on 
/dev/input/event5 (Video Bus)
Feb 15 15:43:08 het systemd-logind[470]: Watching system buttons on 
/dev/input/event0 (Power Button)
[...]
Feb 15 17:50:47 het systemd-logind[470]: Power key pressed.
Feb 15 17:50:47 het systemd-logind[470]: Powering Off...
Feb 15 17:50:47 het systemd-logind[470]: System is powering down.

On a server install, this does not happen,
The logs indicate systemd-logind started without issue, then nothing:

root@alpha-understudy:~# journalctl -u systemd-logind
-- Logs begin at Mon 2015-11-23 15:29:23 AEDT, end at Mon 2016-02-15 
17:45:16 AEDT. --
Nov 23 15:29:29 alpha-understudy.cyber.com.au systemd[1]: Started Login 
Service.

However, on closer inspection it has actually failed:

root@alpha-understudy:~# systemctl status systemd-logind
● systemd-logind.service - Login Service
   Loaded: loaded (/lib/systemd/system/systemd-logind.service; static)
   Active: inactive (dead)
   start condition failed at Mon 2015-11-23 15:29:29 AEDT; 2 months 
23 days ago
   ConditionPathExists=/lib/systemd/system/dbus.service was not met
 Docs: man:systemd-logind.service(8)
   man:logind.conf(5)
   http://www.freedesktop.org/wiki/Software/systemd/logind
   http://www.freedesktop.org/wiki/Software/systemd/multiseat

Nov 23 15:29:29 alpha-understudy.cyber.com.au systemd[1]: Started Login 
Service.

root@alpha-understudy:~# pgrep logind
root@alpha-understudy:~# pgrep dbus
root@alpha-understudy:~# dpkg-query -W '*dbus*'
dbus
libdbus-1-3:amd64   1.8.20-0+deb8u1

It's failing because dbus isn't installed.
Installing dbus fixes the problem.

systemd Recommends: dbus.

dbus is Priority: standard.

If a system is created with debootstrap,
this means dbus is never installed,
and the power button doesn't work:

# script -c 'sh -xc "debootstrap jessie /tmp/bootstrap/delete-me 
http://apt.cyber.com.au/debian;' typescript
# grep dbus typescript
[no hits]

I believe debian-install users get Priority: standard packages via tasksel 
defaults,
though they can opt-out of this.

systemd-logind wants dbus so that shutdown "inhibitors" can be used.


AFAICT these are the available options:

  * change systemd Recommends: dbus to systemd Depends: dbus.

I strongly dislike this option,
because it will force dbus & expat on minbase installs.

(Also, even upstream doesn't say dbus is mandatory.)

  * change systemd so the power button works without dbus.

I like this best, but I expect upstream to hate it.

  * change systemd so when systemd-logind fails to start (as above),
it actually SAYS THERE'S A PROBLEM in the journal/syslog.

I expect upstream to hate this, too.

  * change systemd's Description, and/or the Debian release notes,
to warn users about this.

  * do nothing.



PS: I used to install acpid & acpi-support-base to work around this issue,
until I discovered that on my faster production hosts,
acpid doesn't start reliably under systemd.
About 48% of the time, acpid starts before /dev/input/ is made, giving:

acpid: inotify_add_watch() failed: No such file or directory (DIGITS)

Sigh.