[Solved] Unable to set hardware power button to 'shutdown' LM18.2

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Locked
Pastcal
Level 3
Level 3
Posts: 102
Joined: Tue May 07, 2013 12:06 pm

[Solved] Unable to set hardware power button to 'shutdown' LM18.2

Post by Pastcal » Tue Jul 18, 2017 8:28 am

The options for configuring the power button in 'Power Manager' in LM 17/Xfce* are: 'Ask', 'Do nothing', 'Suspend', 'Hibernate' and 'Shut down', but in LM 18.2/Xfce* 'Shut down' isn't present in the options. I've done my due diligence, but nothing is turning up. Ideas? Thanks in advance.

* The LM 17 installation is an old Toshiba laptop. The 18.2 installation is a much newer Acer E5-551.

Now marked [Solved] because this is a feature not a bug...
Last edited by Pastcal on Thu Jul 27, 2017 6:18 am, edited 2 times in total.

turtlebay
Level 5
Level 5
Posts: 601
Joined: Mon Apr 01, 2013 12:33 pm

Re: Unable to set power button to shutdown LM18.2

Post by turtlebay » Wed Jul 19, 2017 1:30 am

Right click the bottom tool bar and select the shutdown icon from the list.

Pastcal
Level 3
Level 3
Posts: 102
Joined: Tue May 07, 2013 12:06 pm

Re: Unable to set power button to shutdown LM18.2

Post by Pastcal » Wed Jul 19, 2017 4:45 am

turtlebay wrote:Right click the bottom tool bar and select the shutdown icon from the list.
Thanks for the advice, but what I'm trying to do, (which I could do on another system) is program the hardware power button to shut the system down, rather than having to use the on-screen button. It's a small issue, but I'm used to using the hardware button.

Pastcal
Level 3
Level 3
Posts: 102
Joined: Tue May 07, 2013 12:06 pm

Re: Unable to set hardware power button to 'shutdown' LM18.2

Post by Pastcal » Wed Jul 26, 2017 7:44 am

shameless bump

User avatar
pbear
Level 5
Level 5
Posts: 570
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Unable to set hardware power button to 'shutdown' LM18.2

Post by pbear » Wed Jul 26, 2017 12:26 pm

Interestingly, Xfce 18.1 still had the option, as does MATE 18.2. At a guess, the developers got bug reports and found it easiest to remove the option.
Maybe one of the whizzes knows a workaround, but probably you're just gonna have to use the software shutdown. Once you get used to it, no big deal.
Time flies like an arrow. Fruit flies like a banana.
Running Mate 18.3 64 bit (by upgrade from 18.1-2)

pepalogik
Level 1
Level 1
Posts: 20
Joined: Sat Aug 02, 2014 5:20 pm
Location: Czech Republic

Re: [Solved] Unable to set hardware power button to 'shutdown' LM18.2

Post by pepalogik » Mon Oct 09, 2017 10:01 am

For those who want the functionality (like me): Edit /etc/acpi/powerbtn.sh. Two simple commands inserted at the beginning will do the job:

Code: Select all

poweroff
exit
(tested in LM 18.2 XFCE)

jglen490
Level 3
Level 3
Posts: 192
Joined: Sat Jul 15, 2017 9:57 pm

Re: [Solved] Unable to set hardware power button to 'shutdown' LM18.2

Post by jglen490 » Mon Oct 09, 2017 10:28 am

If you actually have /etc/acpi/powerbtn.sh on your system, look at it closely. It's a script that checks for several conditions, and it checks for those conditions on purpose - to prevent errors and ensure that no other processes are running that could have bad results for your system.

Before simply inserting code, check what's there already.
I feel more like I do than I did when I got here.
Toshiba A135-S2386, Intel T2080, ATI Radeon® Xpress 200M Chipset, 2GB RAM, 500GB

pepalogik
Level 1
Level 1
Posts: 20
Joined: Sat Aug 02, 2014 5:20 pm
Location: Czech Republic

Re: [Solved] Unable to set hardware power button to 'shutdown' LM18.2

Post by pepalogik » Mon Oct 09, 2017 1:10 pm

I did look at it. Here is the beginning of the original script (initial comments skipped):

Code: Select all

[ -r /usr/share/acpi-support/power-funcs ] && . /usr/share/acpi-support/power-funcs

# If logind is running, it already handles power button presses; desktop
# environments put inhibitors to logind if they want to handle the key
# themselves.
if pidof systemd-logind >/dev/null; then
    exit 0
fi
The first line did nothing, because /usr/share/acpi-support/power-funcs does not exist. The following if-block used to terminate the script, because systemd-logind is always running in this system.

As I cannot configure systemd-logind to turn the computer off, I have configured it to do nothing (using the system settings GUI) and modified the script to execute poweroff. Anything wrong with this?

PhilSter
Level 1
Level 1
Posts: 1
Joined: Fri Sep 21, 2018 9:23 pm

Re: [Solved] Unable to set hardware power button to 'shutdown' LM18.2

Post by PhilSter » Fri Sep 21, 2018 10:41 pm

pepalogik,

I ran into this problem myself on 18.3 and it really is a big deal when you're running a headless system. Your fix works and the XFCE guys need to add this feature back in because headless systems do not have monitors/mice!

Thanks,
Phil

Locked

Return to “Newbie Questions”