#971644 elogind: accidentally hitting Fn-F12 crashes the system (dirty filesystem)

Package:
elogind
Source:
elogind
Description:
user, seat and session management daemon
Submitter:
Thorsten Glaser
Date:
2020-11-30 17:21:16 UTC
Severity:
important
Tags:
#971644#5
Date:
2020-10-03 23:30:53 UTC
From:
To:
Yay, I found another behavioural difference between just running Debian
(classic, that is, sysvinit withOUT elogind) and Debian with elogind (to
satisfy certain packages’ dependencies, I certainly do not need any of
its functionality!).

This is in the same manner as #919694 (*why* is that still unfixed‽)
and #949698 (now fixed).

I’m working on an IBM Thinkpad X61, which has a “suspend to disc”
symbol printed in blue on the F12 key, which means Fn-F12 would, if
the operating system handles it, suspend to hard disc.

This key never did anything without elogind installed.

I just hit it by accident. The system immediately(!) became fully
unresponsible (could not even move the mouse pointer), but my xterm
with tail -F /var/log/syslog captured a number of lines. The first
three of it were:

Oct  4 01:09:22 tglase-nb vmunix: [1043273.743227] elogind-daemon[1640]: Hibernate key pressed.
Oct  4 01:09:22 tglase-nb vmunix: [1043273.747348] elogind-daemon[1640]: Hibernating...
Oct  4 01:09:22 tglase-nb vmunix: [1043273.749104] PM: Image not found (code -22)

This is clear evidence that elogind *actively* captured that keypress
and did something not normal (i.e. not present on a standard pre-systemd
system without elogind). Whatever it did apparently failed, but it STILL
proceeded to crash the whole system (with the screen flickering a number
of times and then the system suddenly powering off).

Upon starting it again (losing all my state, unsaved files I was writing,
and all that), I’ve seen the usual messages about problems with a dirty
filesystem, so it’s evident that elogind positively, actively crashed the
system instead of shutting it down cleanly, or, (which would have been the
correct thing to do) just returning and not doing *anything* after that
whatever it tried to do failed.

The other log messages I saw flickering by in xterm are, of course, not
preserved (ext4 “helpfully” inserted a whole block of NUL characters into
my /var/log/syslog file, though).

Now, from evidence to guesswork: from reading the log, I’m guessing it
actually *did* try to suspend to disc, failing to do so (naturally, as
this system is not set up for it, namely, the RAM is much larger than
the swap space, and no equivalent to Windows® 2000’s HIBERFIL.SYS was
set up either, mostly because I do not even *use* hibernation, nor do
I *want* it). But, like I said, that failure was mishandled.

Considering I actually lost (a small amount of) user data, I feel the
severity justified.

I’ve also just looked at the elogind.conf file I was told to change in
one of the two other bugreports I mentioned above. There is some config
regarding hibernation, so I guess, now that I know about the problem,
I could just turn off as a WORKAROUND *ONLY* (I *assume* changing
	#HandleHibernateKey=hibernate
to	HandleHibernateKey=ignore
might do the trick) but then I wonder why this is not ignored by default,
and the failure to handle suspend-to-disc failure is still present (and
someone should probably check if systemd similarily suffers).

Anyway, this bugreport should point out something more: People *need*
to install libpam-elogind to satisfy package dependencies, which forces
elogind installation alongside; elogind now runs a dæmon which changes
system behaviour (compared to regular pre-systemd Debian) in unpredictable
ways, much to users’ detriment.

I believe there exist users who would wish for all these features, but
to me, who doesn’t even need them in the first place, a way of satisfying
packages without piling new bugs onto the system is direly needed.

Sorry for any grumpiness here, I’ve just lost some work and quite an
amount of session state and it’s half past one in the bloody night and
I visited the manuls (pallas cats) in the zoo earlier which provide for
appropriate grumpiness; I don’t intend any insult or something towards
any living being (just towards software).

#971644#8
Date:
2020-10-04 09:26:31 UTC
From:
To:
Thorsten,

Many thanks for this.

[..]

I fully agree that this should be handled better.

Forwarded upstream.

[...]

Yes, I would expect that to be a good workaround in your case.

If there is a consensus that the default should be different, then I am happy to
change it.

Best wishes

Mark

#971644#15
Date:
2020-10-04 17:07:09 UTC
From:
To:
Mark Hindley dixit:

Thanks.

OK, I’ve changed that settng now, also for suspend, just to be safe.

That’s fair. I don’t know all the implicatons of this.

(And sorry again for being annoyed last night. I’ve had a feeling
that elogind, being forked from systemd, has become what it was
meant to avoid. But, yes, we share a common goal; if those tools
we have are lacking they can be improved.)

bye,
//mirabilos

#971644#24
Date:
2020-11-06 12:29:38 UTC
From:
To:
Thorsten,

Can you provide the content of /proc/swaps please.

Thanks

Mark

#971644#27
Date:
2020-11-06 12:29:38 UTC
From:
To:
Thorsten,

Can you provide the content of /proc/swaps please.

Thanks

Mark

#971644#32
Date:
2020-11-06 14:52:38 UTC
From:
To:
Sure:

tglase@tglase-nb:~ $ cat /proc/swaps
Filename                                Type            Size            Used            Priority
/dev/sda2                               partition       3206140         0               -2

bye,
//mirabilos

#971644#37
Date:
2020-11-07 17:05:18 UTC
From:
To:
searching for info, I found this assertion, that made me think the
issue could be outside of elogind:

  This appears to be that Debian in user space tries to trigger the
  resume when the system is falling to hibernation.
https://bugzilla.kernel.org/show_bug.cgi?id=201855#c10


I really don't know how the power-management stuff works, but if you
have pm-utils installed you could try to run pm-hibernate to see if the
issue is the same

ciao!

#971644#40
Date:
2020-11-07 17:16:19 UTC
From:
To:
Yes, elogind upstream has suggested the same possibility.[1]

Mark

[1]  https://github.com/elogind/elogind/issues/177#issuecomment-723446462

#971644#45
Date:
2020-11-07 17:34:11 UTC
From:
To:
Again, I don’t have hibernation set up at all.
This must not be triggered and if auto-triggered must not do anything.

The issue reads as if nobody understood what I wrote in the
initial bugreport — namely that this system could not even
hibernate if one wanted it, as its RAM is much larger than
the swap space.

bye,
//mirabilos