Acer Nitro 5 power button broken in Ubuntu 20.04

Update 2023.03.17: a reader of this blog, W0CKY, came up with a much better solution:

sudo setkeycodes 55 116

I packaged that into a script:

#!/bin/bash

if [[ $EUID -ne 0 ]];
then
    echo re-running as root
    exec sudo /bin/bash "$0" "$@"
else
   echo rewriting key codes
   setkeycodes 55 116
fi

… configured sudoers to run the script without sudo

… and am running the script after login.

Obsolete solution

After an BIOS update, the Acer Nitro 5’s power button doesn’t work any more under Ubuntu 20.04. The smart folks at Mint figured out [1] what’s wrong, but I couldn’t get their solution working and I’ve long given up on opening launchpad bugs just to watch them triage. Also I love a good workaround, so here it is!

First – and to my good luck – every time the power button is pressed, syslog will print this message:

Unknown key pressed (translated set 2, code 0x55 on isa0060/serio0)

So the action plan is to write a script which tails syslog, greps for the exact message and run a suspend or shutdown command. The script should be started when the user logs on.

The script is on github [2]. For convenience I registered it with the “Startup Application” Gnome desktop app which runs the script after the user logs into the desktop environment.

Shutdown icons created by lakonicon – Flaticon

References

[1] Power button does not work after BIOS update (acer nitro 5)
https://forums.linuxmint.com/viewtopic.php?t=373800

[2] acer nitro 5 power button workaround script
https://github.com/ggeorgovassilis/linuxscripts/blob/master/powersave/acer-nitro5-powerbutton-workaround.sh

2 thoughts on “Acer Nitro 5 power button broken in Ubuntu 20.04

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.