On Mi, 16.02.22 14:09, Ulrich Windl (ulrich.wi...@rz.uni-regensburg.de) wrote:

> Hi!
>
> I wonder: Is it possible with systemd to detect multiple reboots
> within a specific time interval, and react, like executing some
> systemctl command (that is expected to "improve" things)?  With
> "reboots" I'm mainly thinking of unexpected boots, not so much the
> "shutdown -r" commands, but things like external resets, kernel
> panics, watchdog timeouts, etc.

The information why a system was reset is hard to get. Some watchdog
hw will tell you if it was recently triggered, and some expensive hw
might log serious errors to the acpi pstore stuff, but it's all icky
and lacks integration.

A safe approach would probably to instead track boots where the root
fs or so is in dirty state. Pretty much all of today's file systems
track that.

It sounds like an OK feature to add to the systemd root fs mount logic
to check for the dirty flag before doing that and then using that is
hint to boot into a target other than default.target that could then
apply further policy (and maybe then go on to enter default.target).

TLDR: nope, this does not exist yet, but parts of it sound like
worthwile feature additions to systemd.

Lennart

--
Lennart Poettering, Berlin

Reply via email to