Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Aug 2012 06:23:15 +0200
From:      Polytropon <freebsd@edvax.de>
To:        freebsd@dreamchaser.org
Cc:        FreeBSD Mailing List <freebsd-questions@freebsd.org>
Subject:   Re: fsck recoveries, configuration
Message-ID:  <20120818062315.eccc7d1d.freebsd@edvax.de>
In-Reply-To: <502F16B7.8050902@dreamchaser.org>
References:  <502EA73B.6000008@dreamchaser.org> <20120818030537.4d5bf55b.freebsd@edvax.de> <502F017A.7030001@dreamchaser.org> <20120818051716.40ccf88c.freebsd@edvax.de> <502F16B7.8050902@dreamchaser.org>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On Fri, 17 Aug 2012 22:14:47 -0600, Gary Aitken wrote:
> On 08/17/12 21:17, Polytropon wrote:
> > On Fri, 17 Aug 2012 20:44:10 -0600, Gary Aitken wrote:
> >> On 08/17/12 19:05, Polytropon wrote:
> >>>> 2.  When my machine hung (could not rlogin or ping), I powered
> >>>> off and rebooted.
> >>>
> >>> Does the machine have a "soft power button" and it is configured
> >>> to issue a "shutdown -p now" (which is quite common)? When you
> >>> have access to the machine, try that. Even if the machine does
> >>> not accept network logins, this mechanism might still work.
> >>
> >> Hmmm.  It has a "soft" power button; have to hold it down 5 sec
> >> or so to power off.
> > 
> > That's the "override time" for a "hard power off". If you only
> > press it once, it should issue "shutdown -p now", but of course
> > this only works if the system is still responding. Even if the
> > keyboard input and screen output, as well as networking services
> > stopped to work, this _might_ still be effective.
> 
> >> Those things can be configured to issue a command that will actually
> >> get executed without a login?
> > 
> > Sure, it has been working for many years. Check the BIOS setup,
> > some machines can be configured to what the button does. The
> > default setup of FreeBSD should perform the correct action via
> > ACPI.
> > 
> > In the past, it also worked with APM. In that case, /etc/apmd.conf
> > would contain the command executed when the button was pressed.
> > On APM-capable machines, the PSU would be switched off, just like
> > today's ACPI-based systems. Of course that only works with ATX
> > power supplies, the AT ones usually had a mechanical switch.
> 
> Ah, I see.  The driver raises a signal the system can respond to.

Yes, it's typically done in the kernel (or by a kernel module).



> >> I assume you're talking about a bios option?  How does that work?
> > 
> > I've seen BIOS setups allowing different actions for the button,
> > from "go to sleep" to "soft power off" or "hard power off". That
> > action (hard power off) is taken when pressing the button for
> > about 5 seconds. The OS can NOT deal with that case.
> > 
> >> sounds like magic of some sort...  Or is this a whole login
> >> sequence with the shutdown at the end?
> > 
> > No, it's a system action using ACPI. No magic involved. :-)
> 
> I'll look at it next time I reboot.  Reading the bios manual, it
> looks like acpi 2.0 support is disabled by default, which may be
> where it is; otherwise I don't see anything obvious.  Thanks.

Also check the BIOS setup. In most cases, the default configuration
will assign the button press to a "soft power down", raising the
proper signal via ACPI. You can also check dmesg's output:

	acpi_button0: <Power Button> on acpi0
	acpi_button1: <Sleep Button> on acpi1

I don't know where this 2nd button is on my system, it only has
one which - when being pressed - lets the system shut down and
then power off properly.

You can find even more elaborate data in sysctl's output:

	hw.acpi.power_button_state: S5
	hw.acpi.sleep_button_state: S3
	dev.acpi_button.0.%desc: Power Button
	dev.acpi_button.0.%driver: acpi_button
	dev.acpi_button.0.%location: handle=\_SB_.PWRB
	dev.acpi_button.0.%pnpinfo: _HID=PNP0C0C _UID=0
	dev.acpi_button.0.%parent: acpi0
	dev.acpi_button.1.%desc: Sleep Button
	dev.acpi_button.1.%driver: acpi_button
	dev.acpi_button.1.%location: handle=\_SB_.SLPB
	dev.acpi_button.1.%pnpinfo: _HID=PNP0C0E _UID=0
	dev.acpi_button.1.%parent: acpi0
	dev.acpi_button.1.wake: 1

As I said, my system doesn't have that 2nd "sleep" button anywhere,
but addressing the power button is correct, the S3 state explained
as "Commonly referred to as Standby, Sleep, or Suspend to RAM. RAM
remains powered" is then used as a signal to perform the system
shutdown as intended.


-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?20120818062315.eccc7d1d.freebsd>