Re: Power Off on Halt - solution

Tsurng-Chen Chern (maxchern@kazakhstan.it.earthlink.net)
Wed, 18 Mar 1998 13:43:52 -0800 (PST)


I'm sure there must be hundred ways to make it work,
however, if you want a simple fix without changing
/etc/inittab, or rc scripts, or even replacing the c library,
here is the answer.

Two functions in the kernel source, machine_halt(), and
machine_poweroff() (not sure about the name thought).
And if you ever look at the source, you'll see that
machine_halt() has no code in its body. So if you
just kindly cut and paste the body of machine_poweroff()
to machine_halt(), which basically instruct it to do
the poweroff stuff, and recompile your kernel, I'm
sure you'll be happy with it.

On Wed, 18 Mar 1998, [ISO-8859-1] Johan Myréen wrote:

> On 18 Mar 1998, Robert Bihlmeyer wrote:
>
> > >> This started happening when I compiled a new init (2.72) with
> > >> glibc (2.0.6), so the cause could be either init or glibc. (I
> > >> suspect glibc.)
> >
> > Bernhard> Can't be glibc... I'm having the same problem on a ATX K6
> > Bernhard> running sysvinit 2.73 and glibc
> > Bernhard> 2.0.7 as well as a Medion Notebook running sysvinit 2.73
> > Bernhard> and libc 5.4.44.
> >
> > You're all sure, that you use UP kernels?
>
> Yes. I have now found out what was wrong. Just a normal case
> of not Reading the Friendly Manual...
>
> I tried to invoke /sbin/halt -p or /sbin/poweroff directly
> from /etc/inittab:
>
> kb::kbrequest:/sbin/halt -p -i
>
> Silly me. When halt is called when the system is not in
> runlevel 0 or 6, shutdown will be called instead, with the
> flag -h. The -p flag is ignored. The runlevel 0 script is then
> called, and that script ended in a /sbin/halt (without the -p)
> on my machine. Adding the -p switch fixed the problem.
>
> Contrary to what some people suggested, no patches to any
> program, library or kernel are needed. (This is true at least
> for kernel 2.1.x, libc 2.0.x and a relatively recent sysvinit
> ( >= 2.7.2?))
>
> Hope this helps someone.
>
> Johan Myreen
> jem@iki.fi
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.rutgers.edu
>

Max Chern, Senior Software Engineer/DBA | Voice: 626-296-5014
EarthLink Network, Inc. | Fax: 626-296-5113
maxchern@earthlink.net | 3100 New York Drive, Ste. 201
http://www.earthlink.net/ | Pasadena, CA 91107

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu