Re: En/disabling power button shutdown

2011-06-16 Thread Andrew Fresh
On Sat, Jun 11, 2011 at 10:58:17AM +0200, Mark Kettenis wrote:
 Like I asked on icb, why do we need a knob for this at all?

I don't need one yet, but someday when hybernate works I would like to
sysctl hw.powerbuttonaction=hybernate

In preparation for that, I don't see a reason not to support a disabled
setting.

l8rZ,
-- 
andrew - http://afresh1.com

Hey! It compiles! Ship it!



Re: En/disabling power button shutdown

2011-06-14 Thread Christian Weisgerber
Christian Weisgerber na...@mips.inka.de wrote:

 The diff below
-snip-
 I have only tested this on amd64 and sparc64.

Has anybody compiled this on landisk, sgi, zaurus?

-- 
Christian naddy Weisgerber  na...@mips.inka.de



Re: En/disabling power button shutdown

2011-06-12 Thread Stuart Henderson
On 2011/06/11 21:06, gilbert.fernan...@orange.fr wrote:
We have to add one, so move the others
 on one side, and by moving one we accidentally pressed a
 power button and the machine did shut down... Without
 almost a hundred machines depending on it and people working
 on those hundred machines that really did not like what
 happened.

whether or not the power button is disabled, there are plenty of things
which can go wrong with such a move. do it the right way, especially for
a server relied on by 100+ users...



Re: En/disabling power button shutdown

2011-06-12 Thread gilbert . fernandes
On Sun, Jun 12, 2011 at 10:38:33AM +0100, Stuart Henderson wrote:

 whether or not the power button is disabled, there are plenty of things
 which can go wrong with such a move. do it the right way, especially for
 a server relied on by 100+ users...

True :-)

Well I guess that's a mistake I won't ever do again.

-- 
Ripley



Re: En/disabling power button shutdown

2011-06-12 Thread Kevin Chadwick
On Sat, 11 Jun 2011 21:14:02 +0200
gilbert.fernan...@orange.fr wrote:

 They had to put pieces of paper in front of the power buttons
 because when you move a machine sometimes your finger presses
 the power button.

A matchbox with a hole in it acts like a reset button protection.



Re: En/disabling power button shutdown

2011-06-11 Thread Mark Kettenis
Like I asked on icb, why do we need a knob for this at all?



Re: En/disabling power button shutdown

2011-06-11 Thread Christian Weisgerber
Mark Kettenis mark.kette...@xs4all.nl wrote:

 Like I asked on icb, why do we need a knob for this at all?

I don't need one.  I'd be just as happy to simply rip out
machdep.kbdreset where it's currently abused for that purpose.

* If you press one of these soft power buttons a little bit longer,
  they typically shut off the power in hardware anyway.
* Mischievous people can simply pull the cord.
* If you run a kiosk application built into a wall, you don't expose a
  power button.

That leaves avoid shutdown by accidentally brushing against the
button, but that isn't an issue in practice.  Looking at pictures
of the Ultra 5, I don't see how Miod could press that by accident.
I once accidentally powered off my Blade 100 while leaning over it
but I think that was with the power button shutdown disabled, so
there.

For the Zaurus, a knob may make sense, I don't know.

-- 
Christian naddy Weisgerber  na...@mips.inka.de



Re: En/disabling power button shutdown

2011-06-11 Thread Peter Hessler
On 2011 Jun 11 (Sat) at 15:00:10 + (+), Christian Weisgerber wrote:
:Mark Kettenis mark.kette...@xs4all.nl wrote:
:
: Like I asked on icb, why do we need a knob for this at all?
:
:I don't need one.  I'd be just as happy to simply rip out
:machdep.kbdreset where it's currently abused for that purpose.
:
:* If you press one of these soft power buttons a little bit longer,
:  they typically shut off the power in hardware anyway.
:* Mischievous people can simply pull the cord.
:* If you run a kiosk application built into a wall, you don't expose a
:  power button.
:
:That leaves avoid shutdown by accidentally brushing against the
:button, but that isn't an issue in practice.  Looking at pictures
:of the Ultra 5, I don't see how Miod could press that by accident.
:I once accidentally powered off my Blade 100 while leaning over it
:but I think that was with the power button shutdown disabled, so
:there.
:
:For the Zaurus, a knob may make sense, I don't know.
:

I have used this feature on a regular basis.  Very useful when you want
to politely power off a system, but you don't have/don't want a login.


-- 
You can measure a programmer's perspective by noting his attitude on
the continuing viability of FORTRAN.
-- Alan Perlis



Re: En/disabling power button shutdown

2011-06-11 Thread Christian Weisgerber
Peter Hessler phess...@theapt.org wrote:

 : Like I asked on icb, why do we need a knob for this at all?
 
 I have used this feature on a regular basis.  Very useful when you want
 to politely power off a system, but you don't have/don't want a login.

You misunderstand.  The question is, why do we need a knob to
*disable* a power button shutdown?

-- 
Christian naddy Weisgerber  na...@mips.inka.de



Re: En/disabling power button shutdown

2011-06-11 Thread gilbert . fernandes
On Sat, Jun 11, 2011 at 03:00:10PM +, Christian Weisgerber wrote:

 That leaves avoid shutdown by accidentally brushing against the
 button, but that isn't an issue in practice.

A lot of people are using PCs as servers instead of real servers
(with two power supplies and all the bell and whistles).
I have seen several server room rooms were servers were 5 to
10 PCs installed on a desk, with a screen, a keyboard and a mouse
connected to all those machines with a KVM.

They had to put pieces of paper in front of the power buttons
because when you move a machine sometimes your finger presses
the power button. Or you are trying to reach the back of the
machine while hovering over it and something touches that
button. And when it turns off and all your users are connected
to the machine using NFS where their files are and you have
close to 100 people currently working, you are in trouble.

The knob is useful. It should be there, and allow machines
to be turned off if the button is pressed. And let people
turn that function of when they're using a laptop or PC as
server (temporarily or not..) so they avoid accidents and
mistakes that end up in a undesidered poweroff.

It happened to me. In the middle of the day. With a LOT of
people connected. It was not fun. We have such a room with
PCs side by side acting as servers for various services,
and by moving them closer to I could install another PC,
I did press a power button on a machine. Spent the rest
of the day going to person to person to tell them to
reboot their boxes to get access to their files back.

Later added thick pieces of paper in front of every
power button with messages like DO NOT TOUCH to each
one of those PCs acting as a server.

In a lot of universites and places without a lot of cash
to have nice rackable servers, a lot of PCs are just
standing close to another and acting as servers. You do
want a knob to turn off the poweroff if pressed to be
present.

-- 
Emacs suck my *vi*



Re: En/disabling power button shutdown

2011-06-11 Thread Marc Espie
On Sat, Jun 11, 2011 at 09:06:05PM +0200, gilbert.fernan...@orange.fr wrote:
 One knob to be able to turn it on so when you're working
 on a machine, and console dies, to be able to shutdown
 properly and avoid a fsck.

One knob for the dwarfen guys that work in the IT mines, to bind the machines
and rule them all.



En/disabling power button shutdown

2011-06-10 Thread Christian Weisgerber
The machdep.kbdreset sysctl currently serves two functions: On amd64
and i386 it enables a shutdown by Ctrl-Alt-Del.  On various other
archs, it enables a shutdown by pressing the soft power button.
There is currently no way to disable a shutdown by ACPI power button
on amd64 and i386.

The diff below
* adds a MI sysctl hw.allowpowerdown; if set to 1 (the default) it
  allows a power button shutdown;
* makes acpi(4)/acpibtn(4) honor hw.allowpowerdown;
* switches the various power button intercepts on landisk, sgi, sparc64
  and zaurus over to hw.allowpowerdown;
* garbage collects the machdep.kbdreset sysctl on all archs other than
  amd64 and i386;
* includes all the corresponding man page and /etc bits.

I have only tested this on amd64 and sparc64.

Note: You also need to make includes and rebuild /sbin/sysctl to
access hw.allowpowerdown.


Index: etc/etc.landisk/sysctl.conf
===
RCS file: /cvs/src/etc/etc.landisk/sysctl.conf,v
retrieving revision 1.3
diff -u -p -r1.3 sysctl.conf
--- etc/etc.landisk/sysctl.conf 29 Apr 2007 17:53:34 -  1.3
+++ etc/etc.landisk/sysctl.conf 10 Jun 2011 21:47:18 -
@@ -1,2 +1 @@
-#machdep.kbdreset=1# permit console to do a nice halt
 #machdep.led_blink=1   # blink the power led
Index: etc/etc.loongson/sysctl.conf
===
RCS file: /cvs/src/etc/etc.loongson/sysctl.conf,v
retrieving revision 1.1
diff -u -p -r1.1 sysctl.conf
--- etc/etc.loongson/sysctl.conf23 Jan 2010 19:26:45 -  1.1
+++ etc/etc.loongson/sysctl.conf10 Jun 2011 21:47:23 -
@@ -1 +0,0 @@
-#machdep.kbdreset=1# 1=Enable power button shutdown
Index: etc/etc.palm/sysctl.conf
===
RCS file: /cvs/src/etc/etc.palm/sysctl.conf,v
retrieving revision 1.1
diff -u -p -r1.1 sysctl.conf
--- etc/etc.palm/sysctl.conf5 Sep 2009 02:19:09 -   1.1
+++ etc/etc.palm/sysctl.conf10 Jun 2011 21:47:26 -
@@ -1,4 +1,3 @@
-#machdep.kbdreset=1# permit zkbd(4) power key to do a nice halt
 #machdep.maxspeed=520  # set change maximum processor speed
 #machdep.lidsuspend=1  # closing the lid will suspend machine
 #hw.setperf=0  # 0=slowest speed, 100=fastest speed
Index: etc/etc.sgi/sysctl.conf
===
RCS file: /cvs/src/etc/etc.sgi/sysctl.conf,v
retrieving revision 1.3
diff -u -p -r1.3 sysctl.conf
--- etc/etc.sgi/sysctl.conf 25 May 2008 16:25:22 -  1.3
+++ etc/etc.sgi/sysctl.conf 10 Jun 2011 21:47:31 -
@@ -1 +0,0 @@
-#machdep.kbdreset=1# 1=Enable power button shutdown
Index: etc/etc.sparc64/sysctl.conf
===
RCS file: /cvs/src/etc/etc.sparc64/sysctl.conf,v
retrieving revision 1.4
diff -u -p -r1.4 sysctl.conf
--- etc/etc.sparc64/sysctl.conf 21 Jun 2006 21:53:32 -  1.4
+++ etc/etc.sparc64/sysctl.conf 10 Jun 2011 21:47:34 -
@@ -1,3 +1,2 @@
 #machdep.led_blink=1   # 1=On sparc64, make led(s) blink
 #machdep.allowaperture=1   # See xf86(4)
-#machdep.kbdreset=1# permit console to do a nice halt
Index: etc/etc.zaurus/sysctl.conf
===
RCS file: /cvs/src/etc/etc.zaurus/sysctl.conf,v
retrieving revision 1.8
diff -u -p -r1.8 sysctl.conf
--- etc/etc.zaurus/sysctl.conf  4 Aug 2009 18:45:44 -   1.8
+++ etc/etc.zaurus/sysctl.conf  10 Jun 2011 21:47:37 -
@@ -1,4 +1,3 @@
-#machdep.kbdreset=1# permit zkbd(4) power key to do a nice halt
 #machdep.maxspeed=520  # set change maximum processor speed
 #machdep.lidsuspend=1  # closing the lid will suspend machine
 #hw.setperf=0  # 0=slowest speed, 100=fastest speed
Index: etc/sysctl.conf
===
RCS file: /cvs/src/etc/sysctl.conf,v
retrieving revision 1.51
diff -u -p -r1.51 sysctl.conf
--- etc/sysctl.conf 4 Apr 2011 11:14:33 -   1.51
+++ etc/sysctl.conf 10 Jun 2011 21:50:15 -
@@ -36,3 +36,4 @@
 #kern.watchdog.period=32   # 0=Enable hardware watchdog(4) timer if 
available
 #kern.watchdog.auto=0  # 0=Disable automatic watchdog(4) retriggering
 #kern.pool_debug=0 # 0=Disable pool corruption checks (faster)
+#hw.allowpowerdown=0   # 0=Disable power button shutdown
Index: sbin/sysctl/sysctl.8
===
RCS file: /cvs/src/sbin/sysctl/sysctl.8,v
retrieving revision 1.158
diff -u -p -r1.158 sysctl.8
--- sbin/sysctl/sysctl.823 May 2011 07:18:45 -  1.158
+++ sbin/sysctl/sysctl.810 Jun 2011 17:08:17 -
@@ -342,6 +342,7 @@ and a few require a kernel compiled with
 .It hw.serialnostring  no
 .It hw.uuidstring