2.6 on_ac_power anacron APM fix

2004-03-10 Thread JoSH Lehan
Hello!

I am running the current stable distribution of Debian (3.0) on a 
generic i386 box (with 3 ethercards installed, it makes a fine firewall).

After successfully upgrading to the 2.6 kernel, I noticed that my 
daily/weekly/etc. cron jobs were no longer running!  It took a while to 
diagnose the problem, but I found it.  Doing a quick Web search, others 
have been reporting the problem, so I will post my solution here in the 
hopes that it will help others.

The problem lies in the /usr/bin/on_ac_power script, which is called 
from the /etc/init.d/anacron startup script.  The on_ac_power script is 
unable to determine the power status, so anacron assumes the worst and 
assumes that the computer is on batteries, so does not start anacron!

I use APM, not ACPI, since my machine's BIOS is from 2000 and too old.

The on_ac_power script attempts to parse /proc/apm, and fails, because 
the format of the first field has changed.

/proc/apm from Linux 2.4.9-31 (an older machine that hasn't been 
upgraded in some time):
1.14 1.2 0x07 0x01 0xff 0x80 -1% -1 ?

/proc/apm from Linux 2.6.3:
1.16ac 1.2 0x07 0x01 0xff 0x80 -1% -1 ?
The fix is obvious and easy: extend the regex in on_ac_power to 
understand the fact that there are now *letters* in the first field, in 
addition to numbers and dots.

26c26
   /^[0-9.]* [0-9.]* 0x.. 0x../ {
---
   /^[0-9a-z.]* [0-9.]* 0x.. 0x../ {
I did this, and the /etc/init.d/anacron script now properly starts 
anacron without error!  My cron jobs now run fine.

Since anacron is necessary to run the scripts in the daily/weekly/etc. 
cron directories, this would explain why my jobs weren't being ran even 
though the base cron program was working just fine (cron does not 
parse those directories).

I attempted to search the Debian bugs database for this, and maybe enter 
this as a bug (with fix), but couldn't get it to recognize the package 
name.  I tried powermgmt-base as reported by dpkg --search, 
powermgmt, and so on.  What package name is this under, in the bugs 
database?

Josh

--
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: 2.6 on_ac_power anacron APM fix

2004-03-10 Thread Thomas Hood
 I attempted to search the Debian bugs database for this,
 and maybe enter this as a bug (with fix), but couldn't get
 it to recognize the package name.

The on_ac_power script is in the powermgmt-base package.
The bug you found has already been fixed in the latest version
(1.17) of powermgmt-base in testing and unstable.

-- 
Thomas Hood [EMAIL PROTECTED]


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]