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

2019-11-18 Thread Mick
On Sunday, 17 November 2019 20:35:33 GMT n952162 wrote:
> On 11/17/19 16:06, Mick wrote:
> > You keep top-posting and inverting the logical Q/A flow of this thread ...
> > 
> > On Sunday, 17 November 2019 12:53:51 GMT n952162 wrote:
> >> Ah, now I see.  Yes, in that respect, that is, if you don't have a
> >> chance to get /forcefsck written.
> > 
> > Running fsck manually with various options and then trying to recover
> > various superblock locations could get you farther than simply running
> > fsck in an accepting fashion.
> 
> Have you had any experience with this?  I spent days search for that
> superblock once, even writing a pgm to search for the magic number,
> after working with dump2fs, and never got anywhere.  I'd sure like to
> hear that somebody had success with it.

Yes, I vaguely remember using it in the past.  Some heavy handed user pressed 
the power button, leaving the fs dangling.  Through trial & error I found a 
backup superblock listed by dumpe2fs, which worked and allowed the fs to be 
accessed with minimal loss of data.  I don't know if this would be the case 
under all eventualities.

-- 
Regards,

Mick

signature.asc
Description: This is a digitally signed message part.


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

2019-11-18 Thread Wols Lists
On 17/11/19 20:35, n952162 wrote:
>>
>> Needless to say, you would not try this on the original partition, but a
>> backup image you can create with ddrescue and friends. In any case,
>> running
>> fsck.ext4 -n (or -E nodiscard) should not cause any fs losses, unless the
>> disk/hardware is faulty.  Hence working on a backup image is the safest
>> option.
>>
> 
> Thanks for the tip about ddrescue.

I'll throw in another tip, about dm-verity. If you haven't met it, it's
part of the block-management layer. It's new so I don't know much about
it but I'm personally excited about its capabilities for raid recovery
and stuff like that.

Basically, on top of your block device you would create a dm-verity
device. I don't know whether you can, but if you can't it needs adding -
you want to create a device in corrupted mode where any read access will
trigger a read error.

As ddrescue copies your old device across it will reset the integrity
layer. So when you go to read your device image, any attempt to read a
successfully recovered block will be fine, any attempt to read a block
that couldn't be recovered will trigger a read error.

Cheers,
Wol



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

2019-11-17 Thread Dale
Håkon Alstadheim wrote:
>
> Den 17.11.2019 12:22, skrev Dale:
>> Neil Bothwick wrote:
>>> On Sun, 17 Nov 2019 10:50:08 +, Mick wrote:
>>>
> 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.
>>> I do the same, but configuring the power button to do a clean shutdown
>>> may like life simpler.
>>>
>>>
>>
>> I don't have a second system to ssh in with but if I did, that's what
>> I'd do as well, or try at least.
>
> You can get ssh clients for Android or Apple iOS. Just remember to set
> up with public keys before you need them, and also give them a static
> address if the box in question is router/dhcp-server.
>
>
>
>


I guess I could do that from my cell phone then.  It's a Samsung android
thingy.  Hey, I can talk with it and text.  Everything else is gravy. 
Good but not really necessary.  lol  Thing is, if it is slow, it will
likely be slow when I ssh in as well.  Most of the time, it will move,
just very, very slowly. 

Dale

:-)  :-) 



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

2019-11-17 Thread n952162

On 11/17/19 16:06, Mick wrote:

You keep top-posting and inverting the logical Q/A flow of this thread ...

On Sunday, 17 November 2019 12:53:51 GMT n952162 wrote:

Ah, now I see.  Yes, in that respect, that is, if you don't have a
chance to get /forcefsck written.

Running fsck manually with various options and then trying to recover various
superblock locations could get you farther than simply running fsck in an
accepting fashion.


Have you had any experience with this?  I spent days search for that
superblock once, even writing a pgm to search for the magic number,
after working with dump2fs, and never got anywhere.  I'd sure like to
hear that somebody had success with it.



Needless to say, you would not try this on the original partition, but a
backup image you can create with ddrescue and friends. In any case, running
fsck.ext4 -n (or -E nodiscard) should not cause any fs losses, unless the
disk/hardware is faulty.  Hence working on a backup image is the safest
option.



Thanks for the tip about ddrescue.




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

2019-11-17 Thread Håkon Alstadheim



Den 17.11.2019 12:22, skrev Dale:

Neil Bothwick wrote:

On Sun, 17 Nov 2019 10:50:08 +, Mick wrote:


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.

I do the same, but configuring the power button to do a clean shutdown
may like life simpler.




I don't have a second system to ssh in with but if I did, that's what
I'd do as well, or try at least.


You can get ssh clients for Android or Apple iOS. Just remember to set 
up with public keys before you need them, and also give them a static 
address if the box in question is router/dhcp-server.






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

2019-11-17 Thread Mick
You keep top-posting and inverting the logical Q/A flow of this thread ...

On Sunday, 17 November 2019 12:53:51 GMT n952162 wrote:
> Ah, now I see.  Yes, in that respect, that is, if you don't have a
> chance to get /forcefsck written.

Running fsck manually with various options and then trying to recover various 
superblock locations could get you farther than simply running fsck in an 
accepting fashion.

If fsck.ext4 shows up "bad magic number", you can run dumpe2fs on the 
partition and grep for "superblock" to find the location of both primary and 
backup superblocks of the corrupted fs.  Then you can 'e2fsck -b  /
dev/sdaX' for each '' superblock location and and try mount it 
thereafter to see if you can access your files.  With a bit of luck at least 
one of the supeblocks will work recovering most of the data previously saved 
on this fs.

Needless to say, you would not try this on the original partition, but a 
backup image you can create with ddrescue and friends. In any case, running 
fsck.ext4 -n (or -E nodiscard) should not cause any fs losses, unless the 
disk/hardware is faulty.  Hence working on a backup image is the safest 
option.

-- 
Regards,

Mick

signature.asc
Description: This is a digitally signed message part.


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

2019-11-17 Thread n952162

Ah, now I see.  Yes, in that respect, that is, if you don't have a
chance to get /forcefsck written.


On 11/17/19 13:23, Dale wrote:

n952162 wrote:

How do you fix a broken filesystem, other than letting fsck have its way
with it?

The point is, don't touch it until you do.  If you boot a system from
the hard drive, it has to be touched and you don't know what condition
it is in when your system has crashed in some way.  If you boot some
other way and run fsck on it, then it is just like it was when your
system went down.  It hasn't even been mounted read only at that point.
If you have data that can be replaced, it isn't a big deal.  You can
restore from backups, fetch data again that was lost or whatever.
However, if you want to minimize that risk, don't touch the drive(s)
until fsck has done its job.

Dale

:-)  :-)






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

2019-11-17 Thread Dale
n952162 wrote:
> How do you fix a broken filesystem, other than letting fsck have its way
> with it?

The point is, don't touch it until you do.  If you boot a system from
the hard drive, it has to be touched and you don't know what condition
it is in when your system has crashed in some way.  If you boot some
other way and run fsck on it, then it is just like it was when your
system went down.  It hasn't even been mounted read only at that point. 
If you have data that can be replaced, it isn't a big deal.  You can
restore from backups, fetch data again that was lost or whatever. 
However, if you want to minimize that risk, don't touch the drive(s)
until fsck has done its job. 

Dale

:-)  :-) 



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

2019-11-17 Thread n952162

How do you fix a broken filesystem, other than letting fsck have its way
with it?


On 11/17/19 12:39, Dale wrote:

n952162 wrote:

I'm not seeing how doing an fsck from a live cd helps.


Generally speaking, something ends up being mounted rw and if it isn't
clean, that can cause issues that may have been fixable before to become
issues that are no longer fixable.  This is why a lot of people put a
rescue system in /boot and add it to their boot loader menu.  Sadly, my
/boot partition isn't large enough or I'd do that as well.  If you have
data you don't want to lose and no backups or only older backups, you
don't want to do anything that involves risk.  Booting something else
and fixing file system errors is the safest way.








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

2019-11-17 Thread Dale
n952162 wrote:
> I'm not seeing how doing an fsck from a live cd helps.
>

Generally speaking, something ends up being mounted rw and if it isn't
clean, that can cause issues that may have been fixable before to become
issues that are no longer fixable.  This is why a lot of people put a
rescue system in /boot and add it to their boot loader menu.  Sadly, my
/boot partition isn't large enough or I'd do that as well.  If you have
data you don't want to lose and no backups or only older backups, you
don't want to do anything that involves risk.  Booting something else
and fixing file system errors is the safest way. 

The bad thing about this, you won't know how serious it is until you do
something the wrong way.  It's like me the other day.  I'm susceptible
to catching infections.  My neighbor has the sniffles and is prone to
sinus infections.  I went for a visit without realizing it could be
contagious.  He ended up going to the Doctor and finding out he has
strep.  Now I'm sitting here watching for symptoms and at the ready to
go to the Doctor at the first sign.  Looking back, I should have waited
until he was no longer sick.  The other thing is, I can't turn the clock
back.  I've been exposed to something I can catch now.  I need to
remember that when he has the sniffles, treat it as a worst case
scenario until I know it isn't.  If you do the wrong thing with a file
system, you will learn about it after it is irreparable if not careful. 
Treat it as bad and you are less likely to do damage.  Treat it as if it
isn't and you could lose data if it ends up having a problem that must
be fixed first.  It's about trying to limit the risk. 

Dale

:-)  :-) 



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

2019-11-17 Thread n952162

On 11/17/19 10:51, 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.




Right.  That's the point.  X runs in user-space.



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

2019-11-17 Thread n952162






On 11/17/19 11:30, Neil Bothwick wrote:

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.




I wonder how often NTFS loses data.



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

2019-11-17 Thread n952162

I'm not seeing how doing an fsck from a live cd helps.


On 11/17/19 11:50, Mick wrote:

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.





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

2019-11-17 Thread Dale
Neil Bothwick wrote:
> On Sun, 17 Nov 2019 10:50:08 +, Mick wrote:
>
>>> 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.
> I do the same, but configuring the power button to do a clean shutdown
> may like life simpler.
>
>


I don't have a second system to ssh in with but if I did, that's what
I'd do as well, or try at least.  Recently, I only run into trouble when
a tab on Firefox goes memory hungry.  Most of the time it grows slowly
and I'm able to catch it.  I just close Firefox or just kill that one
process, which kills Tree Style Tab add-on.  Once it consumes my memory
and most of my swap, it gets pretty unresponsive.  o_O  I think I did a
thread on this a while back.  I'm not sure which to blame, the add-on or
Firefox or even both. 

It's rare that I have a hard lock up that is the kernel itself.  Usually
I can get something to work given enough time.  Still, given the amount
of data I have stored here, some irreplaceable, options are nice.  Good
clean options are really nice. 

Dale

:-)  :-) 



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

2019-11-17 Thread Neil Bothwick
On Sun, 17 Nov 2019 10:50:08 +, Mick wrote:

> > 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.

I do the same, but configuring the power button to do a clean shutdown
may like life simpler.


-- 
Neil Bothwick

Top Oxymorons Number 21: "Now, then ..."


pgpdKYhFL0ZiW.pgp
Description: OpenPGP digital signature


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

2019-11-17 Thread Mick
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
Description: This is a digitally signed message part.


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

2019-11-17 Thread Dale
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

:-)  :-) 



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

2019-11-17 Thread 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.


pgp9kZqzpAHy_.pgp
Description: OpenPGP digital signature


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

2019-11-17 Thread 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

:-)  :-)








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

2019-11-17 Thread 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

:-)  :-)






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

2019-11-17 Thread Neil Bothwick
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.


pgpLktp0NrWy6.pgp
Description: OpenPGP digital signature


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

2019-11-17 Thread 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

:-)  :-)




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

2019-11-17 Thread Dale
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

:-)  :-) 


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

2019-11-16 Thread 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!!!





Re: [gentoo-user] power button to shutdown for openrc?

2019-11-16 Thread n952162

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



Re: [gentoo-user] power button to shutdown for openrc?

2019-11-16 Thread 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?




Re: [gentoo-user] power button to shutdown for openrc?

2019-11-16 Thread Mick
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
Description: This is a digitally signed message part.


Re: [gentoo-user] power button to shutdown for openrc?

2019-11-16 Thread n952162


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?


Re: [gentoo-user] power button to shutdown for openrc?

2019-11-15 Thread Wols Lists
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



Re: [gentoo-user] power button to shutdown for openrc?

2019-11-13 Thread Mick
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
Description: This is a digitally signed message part.


Re: [gentoo-user] power button to shutdown for openrc?

2019-11-13 Thread Philip Webb
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




Re: [gentoo-user] power button to shutdown for openrc?

2019-11-13 Thread Bill 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





Re: [gentoo-user] power button to shutdown for openrc?

2019-11-13 Thread Mick
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
Description: This is a digitally signed message part.


[gentoo-user] power button to shutdown for openrc?

2019-11-12 Thread 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!!!