power button to shutdown for openrc?

classic Classic list List threaded Threaded
35 messages Options
12
Reply | Threaded
Open this post in threaded view
|

power button to shutdown for openrc?

n952162

I've reinstalled gentoo from the gentoo repository and now my power button doesn't do a shutdown anymore.  What do I have to do to have it issue a shutdown?  This is an openrc system.

I have this, but it doesn't work:

$ cat  /etc/acpi/events/powerbtn
event=button[ /]power.*
action=/sbin/poweroff

On a different gentoo system I have, I have just the one line, the action line, in that file and the power-button works fine (whether there's causation there or not, I have no idea :-) )

I generally do not press the power button while in my window manager, but first when I've logged off.  Since that wasn't working, I tried inside my window manager ... I got a just a couple of lines that looked like they came from shutdown(), but too few (couldn't read them). 

Then, on startup, the filesystems needed fscking!!!

Reply | Threaded
Open this post in threaded view
|

Re: power button to shutdown for openrc?

Mick-10
On Wednesday, 13 November 2019 06:48:11 GMT n952162 wrote:
> I've reinstalled gentoo from the gentoo repository and now my power
> button doesn't do a shutdown anymore.  What do I have to do to have it
> issue a shutdown?  This is an openrc system.
>
> I have this, but it doesn't work:
>
> $ cat  /etc/acpi/events/powerbtn
> event=button[ /]power.*
> action=/sbin/poweroff

I don't have the above file, only /etc/acpi/events/default, which invokes '/
etc/acpi/default.sh' and that's all my systems need to shutdown gracefully
when I press the power button.

NOTE:  I only press the power button momentarily.  If I press and keep pressed
the power button for a few seconds, then the system powers off instantly
without a graceful shutdown (a.k.a. I then will get a hard shutdown with no
disk syncing or flushing of caches).


> On a different gentoo system I have, I have just the one line, the
> action line, in that file and the power-button works fine (whether
> there's causation there or not, I have no idea :-) )

Judging from my systems I don't think the file you are using is necessary,
unless this is supposed to be a fix for some MoBos which do not work as
expected.


> I generally do /not/ press the power button while in my window manager,
> but first when I've logged off.  Since that wasn't working, I tried
> inside my window manager ... I got a just a couple of lines that looked
> like they came from shutdown(), but too few (couldn't read them).
>
> Then, on startup, the filesystems needed fscking!!!

Does the same thing happen if you run '/sbin/shutdown -h now' ?

--
Regards,

Mick

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: power button to shutdown for openrc?

William Kenworthy

On 13/11/19 4:55 pm, Mick wrote:

> On Wednesday, 13 November 2019 06:48:11 GMT n952162 wrote:
>> I've reinstalled gentoo from the gentoo repository and now my power
>> button doesn't do a shutdown anymore.  What do I have to do to have it
>> issue a shutdown?  This is an openrc system.
>>
>> I have this, but it doesn't work:
>>
>> $ cat  /etc/acpi/events/powerbtn
>> event=button[ /]power.*
>> action=/sbin/poweroff
> I don't have the above file, only /etc/acpi/events/default, which invokes '/
> etc/acpi/default.sh' and that's all my systems need to shutdown gracefully
> when I press the power button.
>
> NOTE:  I only press the power button momentarily.  If I press and keep pressed
> the power button for a few seconds, then the system powers off instantly
> without a graceful shutdown (a.k.a. I then will get a hard shutdown with no
> disk syncing or flushing of caches).
>
>
>> On a different gentoo system I have, I have just the one line, the
>> action line, in that file and the power-button works fine (whether
>> there's causation there or not, I have no idea :-) )
> Judging from my systems I don't think the file you are using is necessary,
> unless this is supposed to be a fix for some MoBos which do not work as
> expected.
>
>
>> I generally do /not/ press the power button while in my window manager,
>> but first when I've logged off.  Since that wasn't working, I tried
>> inside my window manager ... I got a just a couple of lines that looked
>> like they came from shutdown(), but too few (couldn't read them).
>>
>> Then, on startup, the filesystems needed fscking!!!
> Does the same thing happen if you run '/sbin/shutdown -h now' ?
>

Hi,
     have you installed elogind? - for me it took over and replaced the
acpi functions by intercepting the call beforehand.  It also hijacks
suspend hibernate.

A couple of weks back it "broke" and is is recording the power button is
pressed but doesnt take the actions required by its config file. 
"loginctl suspend" works ... sort of ...

BillK


Hi,
     have you installed elogind? - for me it took over and replaced the
acpi functions by intercepting the call beforehand.  It also hijacks
suspend hibernate.

A couple of weks back it "broke" and is is recording the power button is
pressed but doesnt take the actions required by its config file. 
"loginctl suspend" works ... sort of ...

BillK



Reply | Threaded
Open this post in threaded view
|

Re: power button to shutdown for openrc?

Philip Webb-2
In reply to this post by n952162
191113 n952162 wrote:
> I've reinstalled Gentoo from the gentoo repository
> and now my power button doesn't do a shutdown anymore.
> What do I have to do to have it issue a shutdown ?
> This is an openrc system.

1st, exit your window manager & return to a raw console ;
or you can do 'Control-Alt-F2' to get a raw console.

2nd, from the raw prompt login as root
& do 'shutdown -h now' to power down or 'shutdown -r now' to reboot.

You might have to enable something in a config file somewhere
to allow 'shutdown' to access your mobo off-switch.

It's never sensible to simply press the power button
or your filesystems will need to check themselves on next boot.

--
========================,,============================================
SUPPORT     ___________//___,   Philip Webb
ELECTRIC   /] [] [] [] [] []|   Cities Centre, University of Toronto
TRANSIT    `-O----------O---'   purslowatchassdotutorontodotca


Reply | Threaded
Open this post in threaded view
|

Re: power button to shutdown for openrc?

Mick-10
On Wednesday, 13 November 2019 09:58:31 GMT Philip Webb wrote:

> It's never sensible to simply press the power button
> or your filesystems will need to check themselves on next boot.

This very much depends on what pressing the power button does.  If acpi takes
over it will flush any write caches, drop to the appropriate run level,
remount the fs ro and shutdown the PC.  No fsck will then be required.  On the
other hand, if the power button shuts down the OS cold, all sort of ill side
effects like lost data can ensue and a fsck will be required.
--
Regards,

Mick

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: power button to shutdown for openrc?

antlists
In reply to this post by Mick-10
On 13/11/19 08:55, Mick wrote:
> NOTE:  I only press the power button momentarily.  If I press and keep pressed
> the power button for a few seconds, then the system powers off instantly
> without a graceful shutdown (a.k.a. I then will get a hard shutdown with no
> disk syncing or flushing of caches).

This is a hardware feature. Now that so much stuff has been moved into
software, including control of the power switch!! (hence pressing it
triggers acpi and all that sort of stuff, and how you have wake-on-lan,
blah blah blah), you need some form of Big Red Switch, and that's it. No
matter how borked your system, holding the power button down is supposed
to be caught by firmware and kill the power after about five seconds.

Cheers,
Wol

Reply | Threaded
Open this post in threaded view
|

Re: power button to shutdown for openrc?

n952162
In reply to this post by Mick-10

On 11/13/19 09:55, Mick wrote:
On Wednesday, 13 November 2019 06:48:11 GMT n952162 wrote:
I've reinstalled gentoo from the gentoo repository and now my power
button doesn't do a shutdown anymore.  What do I have to do to have it
issue a shutdown?  This is an openrc system.

I have this, but it doesn't work:

$ cat  /etc/acpi/events/powerbtn
event=button[ /]power.*
action=/sbin/poweroff

Okay, I'm a bit further.

I have that file as well, but it doesn't do anything because another script in that same directory, "default", has this:

event=.*
action=/etc/acpi/default.sh %e

/etc/acpi/default.sh invokes actions/powerbtn.sh which checks if the init program (process 1) is running with the name "openrc-init".  Otherwise, it's not interested.

Unfortunately, I have:

$ ps -p 1 -o comm=
init

Question: when does the init program run under the name openrc-init?
Reply | Threaded
Open this post in threaded view
|

Re: power button to shutdown for openrc?

Mick-10
On Saturday, 16 November 2019 09:34:02 GMT n952162 wrote:

> On 11/13/19 09:55, Mick wrote:
> > On Wednesday, 13 November 2019 06:48:11 GMT n952162 wrote:
> >> I've reinstalled gentoo from the gentoo repository and now my power
> >> button doesn't do a shutdown anymore.  What do I have to do to have it
> >> issue a shutdown?  This is an openrc system.
> >>
> >> I have this, but it doesn't work:
> >>
> >> $ cat  /etc/acpi/events/powerbtn
> >> event=button[ /]power.*
> >> action=/sbin/poweroff
>
> Okay, I'm a bit further.
>
> I have that file as well, but it doesn't do anything because another
> script in that same directory, "default", has this:
>
> event=.*
> action=/etc/acpi/default.sh %e
>
> //etc/acpi/default.sh /invokes /actions/powerbtn.sh/ which checks if the
> init program (process 1) is running with the name "openrc-init".
> Otherwise, it's not interested.
>
> Unfortunately, I have:
>
> $ ps -p 1 -o comm=
> init
>
> Question: when does the init program run under the name openrc-init?
It is not simply a matter of different names, but of different binaries.  As
far as I understand it, the /sbin/init of sys-apps/sysvinit is used by openrc
unless you have modified your system to use openrc-init (a different binary to
/sbin/init) as explained here:

https://wiki.gentoo.org/wiki/OpenRC/openrc-init

I may have this wrong of course, but hopefully a more learned participant will
chime in soon to explain it better to us.  :-)

--
Regards,

Mick

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: power button to shutdown for openrc?

n952162
In reply to this post by n952162

And, incidentally, I don't know if anybody's interested, but on my system, I changed this:

if pidof x $PMS > /dev/null ||
        ( test "$XUSER" != "" && pidof dcopserver > /dev/null && test -x /usr/bin/dcop && /usr/bin/dcop --user $XUSER kded kded loadedModules | grep -q klaptopdaemon) ||
        ( test "$XUSER" != "" && test -x /usr/bin/qdbus && test -r /proc/$(pgrep -n kded4)/environ && su - $XUSER -c "eval $(echo -n 'export '; cat /proc/$(pgrep -n kded4)/environ |tr '\0' '\n'|grep DBUS_SESSION_BUS_ADDRESS); qdbus org.kde.kded" | grep -q powerdevil) ; then
        # Get out as the power manager that is running will take care of things.
    exit
fi

to this:

if
    pidof x $PMS > /dev/null ||
    (
        test "$XUSER" != "" &&
        pidof dcopserver > /dev/null &&
        test -x /usr/bin/dcop &&
        /usr/bin/dcop --user $XUSER kded kded loadedModules | grep -q klaptopdaemon
    ) || (
        test "$XUSER" != "" &&
        test -x /usr/bin/qdbus &&
        test -r /proc/$(pgrep -n kded4)/environ &&
        su - $XUSER -c "eval $(
            echo -n 'export ';
            cat /proc/$(pgrep -n kded4)/environ | tr '\0' '\n' | grep DBUS_SESSION_BUS_ADDRESS
        ); qdbus org.kde.kded" | grep -q powerdevil
    ); then
        # Get out as the power manager that is running will take care of things.
        exit
fi
whereupon I was finally able to understand it.


On 11/16/19 10:34, n952162 wrote:

On 11/13/19 09:55, Mick wrote:
On Wednesday, 13 November 2019 06:48:11 GMT n952162 wrote:
I've reinstalled gentoo from the gentoo repository and now my power
button doesn't do a shutdown anymore.  What do I have to do to have it
issue a shutdown?  This is an openrc system.

I have this, but it doesn't work:

$ cat  /etc/acpi/events/powerbtn
event=button[ /]power.*
action=/sbin/poweroff

Okay, I'm a bit further.

I have that file as well, but it doesn't do anything because another script in that same directory, "default", has this:

event=.*
action=/etc/acpi/default.sh %e

/etc/acpi/default.sh invokes actions/powerbtn.sh which checks if the init program (process 1) is running with the name "openrc-init".  Otherwise, it's not interested.

Unfortunately, I have:

$ ps -p 1 -o comm=
init

Question: when does the init program run under the name openrc-init?

Reply | Threaded
Open this post in threaded view
|

Re: power button to shutdown for openrc?

n952162
In reply to this post by Mick-10
On 11/16/19 13:50, Mick wrote:

> It is not simply a matter of different names, but of different binaries.  As
> far as I understand it, the /sbin/init of sys-apps/sysvinit is used by openrc
> unless you have modified your system to use openrc-init (a different binary to
> /sbin/init) as explained here:
>
> https://wiki.gentoo.org/wiki/OpenRC/openrc-init
>
> I may have this wrong of course, but hopefully a more learned participant will
> chime in soon to explain it better to us.  :-)
>
oh, no, I read it wrong.  In the case of openrc-init it invokes
openrc-shutdown,
otherwise it invokes the normal init.  So, I'm back to square 1

Reply | Threaded
Open this post in threaded view
|

Re: power button to shutdown for openrc?

Ian Zimmerman-3
In reply to this post by Mick-10
On 2019-11-16 12:50, Mick wrote:

> > Question: when does the init program run under the name openrc-init?
>
> It is not simply a matter of different names, but of different
> binaries.  As far as I understand it, the /sbin/init of
> sys-apps/sysvinit is used by openrc unless you have modified your
> system to use openrc-init (a different binary to /sbin/init) as
> explained here:
>
> https://wiki.gentoo.org/wiki/OpenRC/openrc-init
>
> I may have this wrong of course, but hopefully a more learned
> participant will chime in soon to explain it better to us.  :-)
>

Interesting - I had no idea that openrc-init existed.  When I read this
I was tempted to switch, however:

  Openrc-init does not use /etc/inittab

which means in particular that my own favorite way of shutting down
wouldn't work:

  kb:12345:kbrequest:/sbin/shutdown -h now

Extra question to keep the thread alive for a bit: does openrc-init
support rebooting via Ctl-Alt-Del?  Is it configurable?  (It is with
sysvinit, in a similar way to the above kbrequest setting.)

--
Please don't Cc: me privately on mailing lists and Usenet,
if you also post the followup to the list or newsgroup.
To reply privately _only_ on Usenet and on broken lists
which rewrite From, fetch the TXT record for no-use.mooo.com.

Reply | Threaded
Open this post in threaded view
|

Re: power button to shutdown for openrc? [SOLVED]

n952162
In reply to this post by n952162

okay, I've got ...

acpid is, by default, not in the default openrc run list   [:blush:]

Solution:

    sudo rc-update add acpid


On 11/13/19 07:48, n952162 wrote:

I've reinstalled gentoo from the gentoo repository and now my power button doesn't do a shutdown anymore.  What do I have to do to have it issue a shutdown?  This is an openrc system.

I have this, but it doesn't work:

$ cat  /etc/acpi/events/powerbtn
event=button[ /]power.*
action=/sbin/poweroff

On a different gentoo system I have, I have just the one line, the action line, in that file and the power-button works fine (whether there's causation there or not, I have no idea :-) )

I generally do not press the power button while in my window manager, but first when I've logged off.  Since that wasn't working, I tried inside my window manager ... I got a just a couple of lines that looked like they came from shutdown(), but too few (couldn't read them). 

Then, on startup, the filesystems needed fscking!!!


Reply | Threaded
Open this post in threaded view
|

Re: power button to shutdown for openrc? [SOLVED]

Dale-46
n952162 wrote:

okay, I've got ...

acpid is, by default, not in the default openrc run list   [:blush:]

Solution:

    sudo rc-update add acpid


On 11/13/19 07:48, n952162 wrote:

I've reinstalled gentoo from the gentoo repository and now my power button doesn't do a shutdown anymore.  What do I have to do to have it issue a shutdown?  This is an openrc system.

I have this, but it doesn't work:

$ cat  /etc/acpi/events/powerbtn
event=button[ /]power.*
action=/sbin/poweroff

On a different gentoo system I have, I have just the one line, the action line, in that file and the power-button works fine (whether there's causation there or not, I have no idea :-) )

I generally do not press the power button while in my window manager, but first when I've logged off.  Since that wasn't working, I tried inside my window manager ... I got a just a couple of lines that looked like they came from shutdown(), but too few (couldn't read them). 

Then, on startup, the filesystems needed fscking!!!




I have a related question.  If for some reason my system is locked up, keyboard isn't working or something like that.  If I have acpi in working order, would hitting the power button be seen or would that be the same as the keyboard and not be recognized?  Anyone have experience on this or read about someone who has ran into this? 

Just curious but if the answer is yes, I may work on setting this up and working. 

Thanks.

Dale

:-)  :-) 
Reply | Threaded
Open this post in threaded view
|

Re: power button to shutdown for openrc? [SOLVED]

n952162

There's a million ways a system can hang.  Acpi is a mechanism for shipping kernel events to user space.  If user space isn't working, acpi won't work.   I think.


On 11/17/19 09:44, Dale wrote:
n952162 wrote:

okay, I've got ...

acpid is, by default, not in the default openrc run list   [:blush:]

Solution:

    sudo rc-update add acpid


On 11/13/19 07:48, n952162 wrote:

I've reinstalled gentoo from the gentoo repository and now my power button doesn't do a shutdown anymore.  What do I have to do to have it issue a shutdown?  This is an openrc system.

I have this, but it doesn't work:

$ cat  /etc/acpi/events/powerbtn
event=button[ /]power.*
action=/sbin/poweroff

On a different gentoo system I have, I have just the one line, the action line, in that file and the power-button works fine (whether there's causation there or not, I have no idea :-) )

I generally do not press the power button while in my window manager, but first when I've logged off.  Since that wasn't working, I tried inside my window manager ... I got a just a couple of lines that looked like they came from shutdown(), but too few (couldn't read them). 

Then, on startup, the filesystems needed fscking!!!




I have a related question.  If for some reason my system is locked up, keyboard isn't working or something like that.  If I have acpi in working order, would hitting the power button be seen or would that be the same as the keyboard and not be recognized?  Anyone have experience on this or read about someone who has ran into this? 

Just curious but if the answer is yes, I may work on setting this up and working. 

Thanks.

Dale

:-)  :-) 

Reply | Threaded
Open this post in threaded view
|

Re: power button to shutdown for openrc? [SOLVED]

n952162

And - although hitting the power button will clear up some situations, if your hard disk is having trouble closing, shutdown() probably won't be able to get around that and the shutdown will be like a power-loss shutdown.


On 11/17/19 10:27, n952162 wrote:

There's a million ways a system can hang.  Acpi is a mechanism for shipping kernel events to user space.  If user space isn't working, acpi won't work.   I think.


On 11/17/19 09:44, Dale wrote:
n952162 wrote:

okay, I've got ...

acpid is, by default, not in the default openrc run list   [:blush:]

Solution:

    sudo rc-update add acpid


On 11/13/19 07:48, n952162 wrote:

I've reinstalled gentoo from the gentoo repository and now my power button doesn't do a shutdown anymore.  What do I have to do to have it issue a shutdown?  This is an openrc system.

I have this, but it doesn't work:

$ cat  /etc/acpi/events/powerbtn
event=button[ /]power.*
action=/sbin/poweroff

On a different gentoo system I have, I have just the one line, the action line, in that file and the power-button works fine (whether there's causation there or not, I have no idea :-) )

I generally do not press the power button while in my window manager, but first when I've logged off.  Since that wasn't working, I tried inside my window manager ... I got a just a couple of lines that looked like they came from shutdown(), but too few (couldn't read them). 

Then, on startup, the filesystems needed fscking!!!




I have a related question.  If for some reason my system is locked up, keyboard isn't working or something like that.  If I have acpi in working order, would hitting the power button be seen or would that be the same as the keyboard and not be recognized?  Anyone have experience on this or read about someone who has ran into this? 

Just curious but if the answer is yes, I may work on setting this up and working. 

Thanks.

Dale

:-)  :-) 


Reply | Threaded
Open this post in threaded view
|

Re: power button to shutdown for openrc? [SOLVED]

Neil Bothwick
In reply to this post by n952162
On Sun, 17 Nov 2019 10:27:48 +0100, n952162 wrote:

> There's a million ways a system can hang.  Acpi is a mechanism for
> shipping kernel events to user space.  If user space isn't working, acpi
> won't work.   I think.

But if it's just X that is locked, then ACPI could be used to rescue the
system in a less aggressive way than Magic SysReq.

> On 11/17/19 09:44, Dale wrote:
> > n952162 wrote:  
> >>
> >> okay, I've got ...
> >>
> >> acpid is, by default, not in the default openrc run list [:blush:]
> >>
> >> Solution:
> >>
> >>     sudo rc-update add acpid
> >>
> >>
> >> On 11/13/19 07:48, n952162 wrote:  
> >>>
> >>> I've reinstalled gentoo from the gentoo repository and now my power
> >>> button doesn't do a shutdown anymore.  What do I have to do to have
> >>> it issue a shutdown?  This is an openrc system.
> >>>
> >>> I have this, but it doesn't work:
> >>>
> >>> $ cat  /etc/acpi/events/powerbtn
> >>> event=button[ /]power.*
> >>> action=/sbin/poweroff
> >>>
> >>> On a different gentoo system I have, I have just the one line, the
> >>> action line, in that file and the power-button works fine (whether
> >>> there's causation there or not, I have no idea :-) )
> >>>
> >>> I generally do /not/ press the power button while in my window
> >>> manager, but first when I've logged off.  Since that wasn't working,
> >>> I tried inside my window manager ... I got a just a couple of lines
> >>> that looked like they came from shutdown(), but too few (couldn't
> >>> read them).
> >>>
> >>> Then, on startup, the filesystems needed fscking!!!
> >>>  
> >>  
> >
> >
> > I have a related question.  If for some reason my system is locked up,
> > keyboard isn't working or something like that.  If I have acpi in
> > working order, would hitting the power button be seen or would that be
> > the same as the keyboard and not be recognized?  Anyone have
> > experience on this or read about someone who has ran into this?
> >
> > Just curious but if the answer is yes, I may work on setting this up
> > and working.
> >
> > Thanks.
> >
> > Dale
> >
> > :-)  :-)  
>



--
Neil Bothwick

Windows Error #56: Operator fell asleep while waiting.

attachment0 (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: power button to shutdown for openrc? [SOLVED]

n952162
In reply to this post by n952162

(in fact, that's exactly the situation that I've been confronted with and have turned to this mailing list to help me with: X locked up, my power-button was unresponsive so I had to force it down (holding the power key down for 30 seconds), and on reboot TWO filesystems had to be rebuilt by fsck, with substantial loss of organization and of data (despite both being ext3/4 journaling filesystems - I just don't understand that!) )


On 11/17/19 10:35, n952162 wrote:

And - although hitting the power button will clear up some situations, if your hard disk is having trouble closing, shutdown() probably won't be able to get around that and the shutdown will be like a power-loss shutdown.


On 11/17/19 10:27, n952162 wrote:

There's a million ways a system can hang.  Acpi is a mechanism for shipping kernel events to user space.  If user space isn't working, acpi won't work.   I think.


On 11/17/19 09:44, Dale wrote:
n952162 wrote:

okay, I've got ...

acpid is, by default, not in the default openrc run list   [:blush:]

Solution:

    sudo rc-update add acpid


On 11/13/19 07:48, n952162 wrote:

I've reinstalled gentoo from the gentoo repository and now my power button doesn't do a shutdown anymore.  What do I have to do to have it issue a shutdown?  This is an openrc system.

I have this, but it doesn't work:

$ cat  /etc/acpi/events/powerbtn
event=button[ /]power.*
action=/sbin/poweroff

On a different gentoo system I have, I have just the one line, the action line, in that file and the power-button works fine (whether there's causation there or not, I have no idea :-) )

I generally do not press the power button while in my window manager, but first when I've logged off.  Since that wasn't working, I tried inside my window manager ... I got a just a couple of lines that looked like they came from shutdown(), but too few (couldn't read them). 

Then, on startup, the filesystems needed fscking!!!




I have a related question.  If for some reason my system is locked up, keyboard isn't working or something like that.  If I have acpi in working order, would hitting the power button be seen or would that be the same as the keyboard and not be recognized?  Anyone have experience on this or read about someone who has ran into this? 

Just curious but if the answer is yes, I may work on setting this up and working. 

Thanks.

Dale

:-)  :-) 



Reply | Threaded
Open this post in threaded view
|

Re: power button to shutdown for openrc? [SOLVED]

Neil Bothwick
On Sun, 17 Nov 2019 11:21:18 +0100, n952162 wrote:

> (in fact, that's exactly the situation that I've been confronted with
> and have turned to this mailing list to help me with: X locked up, my
> power-button was unresponsive so I had to force it down (holding the
> power key down for 30 seconds), and on reboot TWO filesystems had to be
> rebuilt by fsck, with substantial loss of organization and of data
> (despite both being ext3/4 journaling filesystems - I just don't
> understand that!) )

Please don't top-post on this list.

Magic SysReq would probably have helped in those situations. ext3/4 only
journal metadata by default, you can specify a mount option to also
journal data but it impacts performance.


--
Neil Bothwick

Documentation: (n.) a novel sold with software, designed to entertain the
               operator during episodes of bugs or glitches.

attachment0 (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: power button to shutdown for openrc? [SOLVED]

Dale-46
In reply to this post by Neil Bothwick
Neil Bothwick wrote:
> On Sun, 17 Nov 2019 10:27:48 +0100, n952162 wrote:
>
>> There's a million ways a system can hang.  Acpi is a mechanism for
>> shipping kernel events to user space.  If user space isn't working, acpi
>> won't work.   I think.
> But if it's just X that is locked, then ACPI could be used to rescue the
> system in a less aggressive way than Magic SysReq.
>
>

That's why I was asking.  I've had to use Magic SysPeq a few times but
thought this would/might be a better option in most cases but maybe not
all.  I will say this, the magic works in every case I can recall so
far.  On occasion when I reboot, it does the fsck and all but nothing
appears to be lost.  Most of the time, it shuts down pretty clean.  I've
got to where when I do the sync part, I give it a minute or so to
finish.  That seems to give it time to sync and unmount cleanly.

As is the usual tho, this depends on the type of lockup I guess. 

Dale

:-)  :-) 

Reply | Threaded
Open this post in threaded view
|

Re: power button to shutdown for openrc? [SOLVED]

Mick-10
In reply to this post by Neil Bothwick
On Sunday, 17 November 2019 10:30:49 GMT Neil Bothwick wrote:
> On Sun, 17 Nov 2019 11:21:18 +0100, n952162 wrote:
> > (in fact, that's exactly the situation that I've been confronted with
> > and have turned to this mailing list to help me with: X locked up, my
> > power-button was unresponsive so I had to force it down (holding the
> > power key down for 30 seconds), and on reboot TWO filesystems had to be
> > rebuilt by fsck, with substantial loss of organization and of data
> > (despite both being ext3/4 journaling filesystems - I just don't
> > understand that!) )

As has been mentioned before holding the power button down until the system
powers off is equal to a hard shutdown.  No write caches are flushed, no data
is synced to disk and any writes could be left in mid air resulting in a
messed up fs.  I always boot with a LiveUSB/CD and perform a fsck without
mounting any drives, before I will try to boot the system normally again.

If you lose power while the system is idle and no write operations are in
process/waiting, then you may well have no loss of data as a result.


> Please don't top-post on this list.
>
> Magic SysReq would probably have helped in those situations. ext3/4 only
> journal metadata by default, you can specify a mount option to also
> journal data but it impacts performance.

When X hangs and I lose the keyboard to the extent where neither Ctrl+Alt+F1,
or Ctrl+Alt+Del would work, I will use ssh to connect remotely and stop the
hanging process or restat the X server.  If ssh is also not working, I use the
magic SysReq sequence to stop processes, sync the disks and reboot, or
shutdown.  I don't recall losing data in such cases, although when I have time
I run fsck with Live media just in case.
--
Regards,

Mick

signature.asc (849 bytes) Download Attachment
12