NetBSD Problem Report #60451

From www@netbsd.org  Thu Jul 16 03:56:04 2026
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits)
	 client-signature RSA-PSS (2048 bits))
	(Client CN "mail.netbsd.org", Issuer "YR2" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 8D99D1A923B
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 16 Jul 2026 03:56:04 +0000 (UTC)
Message-Id: <20260716035603.93A1C1A923C@mollari.NetBSD.org>
Date: Thu, 16 Jul 2026 03:56:03 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: sysmon: warn of low battery before forcing reboot
X-Send-Pr-Version: www-1.0
X-From4GNATS: "campbell+netbsd@mumble.net via gnats" <gnats-admin@NetBSD.org>

>Number:         60451
>Category:       kern
>Synopsis:       sysmon: warn of low battery before forcing reboot
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 16 04:00:00 +0000 2026
>Originator:     Taylor R Campbell
>Release:        current, 11, 10, 9, ...
>Organization:
The WarningBatterieSD Foundation, Inc.
>Environment:
>Description:

	sysmon(4) will currently deliver a `low-power' event to
	powerd(8) if:

	- No AC adapters are plugged in.
	- All batteries are below the critical level.

	powerd(8) is mandated to commence an orderly shutdown -- the
	transition to sysmon_low_power state is irreversible:

	https://nxr.netbsd.org/xref/src/sys/dev/sysmon/sysmon_envsys_events.c?r=1.123#1017

	On past laptops, I would add a powerd(8) script for the
	warning-under event to suspend my laptop, to give me some time
	to plug in without losing my state.  But my current laptop has
	two batteries, and one might enter the warning state while the
	other has plenty of juice left.  Also, at boot, even if the
	laptop is plugged in, sysmon(4) may send warning-under events
	to powerd(8).

	It would be nice if sysmon(4) could deliver a `power-warning'
	event or something to powerd(8) if:

	- No AC adapters are plugged in.
	- All batteries are below the warning level.

>How-To-Repeat:

	1. find a bug that breaks xbattbar so you stop running it
	2. file a PR for that bug (TBD)
	3. run out of power working on something else

>Fix:

	Yes, please!

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.