Subject: Re: envsys framework won't let my system stay up!
To: Juan RP <>
From: Greg Troxel <>
List: current-users
Date: 07/17/2007 09:48:23

Juan RP <> writes:

> On Tue, 17 Jul 2007 06:42:02 -0400
> Greg Troxel <> wrote:
>> My system was unusable when there was no good reason, and I had to power
>> cycle and then boot single user.  People shouldn't have to put up with
>> that (even in current) - what I meant was the the shutdown triggered in
>> enough situations where it is harmful that it should be removed until
>> there's a clean fix.  I say this partly because I think the right fix
>> will be somewhat difficult.
> So this is what happens:
> - acpibat0 is at 99% charged.
> - acpibat1 is at 3% charged (or any capacity in critical state).
> The acpibat driver detects that acpibat1 is in critical state and sends a
> critical event, powerd runs sensor_battery and it shutdowns the system.
> You reboot the system and acpibat1 is still critical, it sends the event
> again because the battery is in critical capacity.

Yes, this is what happened, except I think in my case acpibat1 was
showing 0% charged and the bios was blinking the charge light.  But in
the morning it was charged.  And the AC adaptor was plugged in.

> If you want to avoid it, you have two options:
> - Wait until your battery is somewhat charged (not in critical state).

Sure, but that's not a reasonable thing to expect someone to do.  Plus,
I think that were I to run on battery I'd hit this problem when acpibat1
(which is smaller and used first) crossed critical.

> - Remove the shutdown call in /etc/powerd/scripts/sensor_battery.

I think this is the right fix for now.  I'd like to commit this now to
spare others the same trouble - when do you think you'll have a proper
fix?  A long-term fix seems hard because it requires integrating all
batteries and the ac adaptor, and those events are already separated.
So the logic to decide what to do needs to have state, or query the rest
of the system.

It would be cool to have this integrated with UPS status.

> Until these problems are fixed. Just curiosity, why did you need to go to
> single user? I don't understand that.

Every time I booted, the shutdown command would run before I could log

Content-Type: application/pgp-signature

Version: GnuPG v1.4.7 (NetBSD)