Re: [PATCH v2] reboot: log the task that requested a reboot or shutdown

From: Andrew Morton

Date: Mon Jul 20 2026 - 02:16:03 EST


On Sun, 19 Jul 2026 16:09:38 +0000 Bradley Morgan <include@xxxxxxxxx> wrote:

> When a machine reboots or powers off, the kernel log records what
> happened but not who asked for it. The reboot syscall throws the
> caller identity away, and reconstructing it afterwards from userspace
> logs is unreliable and more likely than not impossible.
> "What made this reboot?" is a question every fleet operator has had to
> answer with guesswork.

There's a need for this? May I ask your source for this information?

> Log the comm and pid of the calling task in the reboot syscall, once
> the requested command is committed and can no longer fail, e.g:
>
> reboot: initiated by systemd-shutdow[1]
> reboot: Restarting system

I can see it might be useful.

> The existing "Restarting system", "System halted" and "Power down"
> lines are left untouched, so anything parsing dmesg today keeps
> working. The two ctrl alt del toggle commands are excluded so init
> setting the mode does not add a line to dmesg on every boot.

Perhaps kexec and swsusp would benefit from the same treatment.
Perhaps add the relevant maintainers to cc and seek their input?