Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


gpio-shutdown overlay and Moode SIGTERM handling
#1
Hi,

I just installed the latest moode version on an Audiophonics HiFi streamer (fantastic quality and value for the money - https://www.audiophonics.fr/en/network-a...13100.html).

The device embeds a separate power supply and management board (https://www.audiophonics.fr/en/raspberry...11504.html). Pressing the front panel hardware button shutdowns the system handeld by a gpio-shutdown overlay.

The time needed to shutdown the sytem this way is significantly shorter than when Moode is shutdown through its interface.

Does-it mean than the graceful shutdown is not the same in both cases ? When shutdown is requested through the UI Moode issues a  "mpc stop" and "systemctl stop nginx".

I understand (I am not a Linux expert) that shutdown (as well as reboot, poweroff ?) sends a sigterm signal to Moode (and other processes)

Q1 : does Moode catch the signal to do the housekeeping ?
Q2 : if not, what are the consequences of a hardware shutdown.

Thank you.

Regards.

Philippe
Reply
#2
Shutdown from moOde WebUI takes ~15 seconds and includes the following:

- Up to 3 secs for moOde's job processing daemon to wake up and process the "poweroff" job sent from the WebUI
- Poweroff job executes the script /var/local/www/commandw/restart.sh poweroiff
- The poweroff section in restart.sh stops playback, stops the nginx web server then executes linux poweroff command
- The poweroff command shuts Linux down and powers off the Raspberry Pi (power LED flashes 10 times)

moOde does not catch or process any SIGTERM signals.
I have no idea what the audiophonics power board does.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#3
Hi Tim,

Thank you for your answer. Among other things, the hardware power button attached to the Audiophonic boards is wired to one GPIO pin. Pressing the button shutdowns the system (dtoverlay=gpio-shutdown,gpio_pin=17,active_low=0,gpio_pull=down added in config.txt).

I understand fom your answer that shutting down the sytem this way does not make Moode stop mpc playback (mpc stop), nor nginx (systemctl stop nginx).

Q1 : do you know wether mpc or nginx catch and process any shutdown related signal and do their own housekeeping ?
Q2 : if not, do you anticipate any issue raised from this "not fully" graceful shutdown ?

Best regards.

Philippe
Reply
#4
@chano22000
A system shutdown on Linux stops everything gracefully, otherwise it wouldn't be a shutdown. Just executing "poweroff" is sufficient, all services are stopped, processes are sent a sigterm signal and filesystems are synced before the system is powered off.
Alternatively executing "poweroff -f" performs an immediate ungraceful system halt.
Reply
#5
@vinnn : Thank you.

A far as I understand and if the Raspbian implementation has not changed, the dtoverlay=gpio-shutdown generates a KEY_POWER event which is processed according to /etc/systemd/logind.conf which is "poweroff" by default

I am fully reassured !
Reply


Forum Jump: