I have connected Power button via J40, and it is working as expected.
But on Ubuntu lock screen it is doing nothing.
Please advice how to configure it to shut down on power button pressed.
Hi julyighor,
The power off is working by using power pin in J40 pins 1 and 2.
Pins 1 and 2 initiate power-on if auto power-on is disabled.
Please check User Guide page.7-8 for detail.
Hello, as I said, I have connected Power button, and it is working as expected. I used J40 Pins.
It does work button itself, but Ubuntu ignoring it on lockscreen, I have to hold Power button for 10 seconds to shut it down.
But I want it to make graceful shut down, how can I configure Ubuntu to react on Power button while it is on lock screen?
Any googled ways to do it related to ACPI script, but there is no ACPI in the Jetson Nano.
Hi julyighor,
The 10 second is limited by the PMIC. If you don’t want to have this 10 sec limitation, maybe you could use a gpio as button and monitor this gpio to trigger the shutdown command.
I don’t want to shut it down instantly, I need to achieve graceful shutdown from Ubuntu lock screen state.
I’m not positive, but in the settings of the GUI (I think the upper right) you might be able to go through some of the screen saver and related settings and be able to change shutdown behavior. Whether or not the power button will be visible to the GUI display manager or not when pressed I don’t know, but it is worth experimenting.
I don’t think we can resolve this here since it sounds a ubuntu issue.
There is no shutdown prompt in screen lock page.
I’m thinking that in this case perhaps the behavior of “CTRL-ALT-DEL” could be adjusted through options, and this hot key combination might work in place of the power button. It is understandable that if someone has security locked a system that the system has to be protected from someone else interfering without the password.
Here is my solution:
#installing acpid service
sudo apt install acpid
#setup acpid to run /etc/acpi/handler.sh script on its events
sudo echo -e 'event=.*\naction=/etc/acpi/handler.sh %e' > /etc/acpi/events/anything
#install /etc/acpi/handler.sh script that handle power button actions
sudo echo -e '#!/bin/bash\n\ncase "$1" in\nbutton/power)\ncase "$2" in\nPBTN) shutdown now ;;\nesac\nesac\n' > /etc/acpi/handler.sh
sudo chmod +x /etc/acpi/handler.sh
#restarting acpid service
sudo systemctl restart acpid.service
It is easy to modify /etc/acpi/handler.sh script to make something like “press power button 5 times to shut down” “press power button 4 times to reboot”
This is an Ubuntu issue in the terminal:
hostnamectl set-chassis vm
and restart