Power on button from remote issue

Rpi2 osmc 18.8 2020-10-1 fresh installation
i have an issue when hit power button with remote control the power menu is opened after 2 sec it go automatically to shuts down.
No problem with UI Power menu
my rf remote c120 Air mouse

I don’t have a solution for you but seems you are not alone.

As a starting point I would suggest to upload logs so that at least it is clear what action the keypress calls.

Well this looks right for the first 3 lines, but not sure why it is shutting down afterwards.

2020-10-24 16:09:43.210 T:1916547696   DEBUG: HandleKey: power (0xf0de) pressed, action is ActivateWindow(ShutdownMenu)
2020-10-24 16:09:43.210 T:1916547696   DEBUG: Activating window ID: 10111
2020-10-24 16:09:43.210 T:1916547696   DEBUG: ------ Window Init (DialogButtonMenu.xml) ------
2020-10-24 16:09:43.210 T:1916547696    INFO: Loading skin file: DialogButtonMenu.xml, load type: KEEP_IN_MEMORY
2020-10-24 16:09:43.362 T:1881895136    INFO: CZeroconfBrowserAvahi::clientCallback: client failure. avahi-daemon stopped? Recreating client...
2020-10-24 16:09:43.369 T:1509347552    INFO: CZeroconfAvahi::clientCallback: client failure. avahi-daemon stopped? Recreating client...
2020-10-24 16:09:43.381 T:1560228064   DEBUG: Thread Timer 1560228064 terminating
2020-10-24 16:09:43.394 T:1916547696   DEBUG: Keyboard: scancode: 0x74, sym: 0x0140, unicode: 0x0000, modifier: 0x0
2020-10-24 16:09:43.511 T:1916547696  NOTICE: Quitting due to POSIX signal

Could you login via ssh and run kodi-send --action="ActivateWindow(ShutdownMenu)" and see if it just opens the power menu or shutsdown.

I run via ssh and run kodi-send --action="ActivateWindow(ShutdownMenu)"
and it opens the power menu.

Ok, so that seems the right behavior.
Not sure why it happens different from the remote.

Are there no solutions? or we have to remap the remote

I have an idea. Will test in a bit.

To bring this back to the behavior your looking for please SSH into your RPi and

sudo nano /etc/systemd/logind.conf

and change the line

#HandlePowerKey=poweroff

to instead read (make sure to remove the hash)

HandlePowerKey=ignore

and then ctrl-x, y, and then enter to save and exit. Now reload that with

sudo systemctl restart systemd-logind

Your power button should now only trigger the kodi menu.

@sam_nazarko should this be a change on our end? I can’t think of why we would ever want the OS grabbing the power button outside of Kodi like this.

nice find @darwindesign it works fine now.
I can confirm the power button trigger the kodi power menu.

1 Like

@darwindesign Thanks for bringing this to my attention.

Fortunately we should be able to resolve this without having to replace the entire configuration file.
I’ve made a change here:

It would be good if it could get some testing. @Majed - can you try changing it back to ‘poweroff’ for that file, and then update to the test build as follows:

  1. Login via the command line
  2. Edit the file /etc/apt/sources.list
  3. Add the following line: deb http://apt.osmc.tv buster-devel main
  4. Run the following commands to update: sudo apt-get update && sudo apt-get dist-upgrade && reboot
  5. Your system should have have received the update.

Please see if the issue is resolved.

I also recommend you edit /etc/apt/sources.list again and remove the line that you added after updating. This will return you to the normal update channel.

Sam

1 Like

no the problem is unsolved.

Can you please post some logs so we can see if you have updated?
Do you have this file on your system: /etc/systemd/logind.conf.d/000-osmc-ignore-power-key.conf. If not, then I don’t think you have updated

i dont have /etc/systemd/logind.conf.d/000-osmc-ignore-power-key.conf. on my sysytem


this is my log https://paste.osmc.tv/eqolonihib

Apologies – please change stretch-devel to buster-devel.
I’ve updated the instructions now.

now i have this file on my system: /etc/systemd/logind.conf.d/000-osmc-ignore-power-key.conf.
but the issue still unsolved
this is new log https://paste.osmc.tv/oqaqedetoc

Hello. A bit of an old thread but I just ran into this same issue after upgrading my old installation. At least for me this could be fixed by editing /etc/systemd/logind.conf.d/000-osmc-ignore-power-key.conf and adding a line with “[Login]” at the top of the configuration file:

[Login]
HandlePowerKey=ignore

This file should already be present on recent versions of OSMC. What version are you on?

Never mind - I see you had to change the file. I will update this shortly.

This is fixed in:

Thanks for the report

Sam

Thanks, I’ll try to remember to check this change when the new version of package is released.

I recently discovered that my system showed this unwanted power button behaviour. I have just tried a manual update, which reported that no updates were available. So presumably the fix implemented by @sam_nazarko above will not appear until the next full OSMC update. If so, I am not sure whether to edit logind.conf, as suggested by @darwindesign, or 000-osmc-ignore-power-key.conf, as suggested by @kk1234, or possibly both. Any advice very much appreciated.