dtoverlay=gpio-shutdown,gpio_pin=3,active_low=1,gpio_pull=up

Having issues with your DietPi installation, or, found a bug? Post it here.
johncolman
Posts: 8
Joined: Sat Aug 17, 2019 8:05 pm

Re: dtoverlay=gpio-shutdown,gpio_pin=3,active_low=1,gpio_pull=up

Post by johncolman » Mon Aug 19, 2019 1:38 pm

@MichaIng

Also if I run dtoverlay -l I get No overlays loaded

User avatar
MichaIng
Legend
Posts: 1638
Joined: Sat Nov 18, 2017 5:21 pm

Re: dtoverlay=gpio-shutdown,gpio_pin=3,active_low=1,gpio_pull=up

Post by MichaIng » Mon Aug 19, 2019 4:32 pm

@johncolman
lsmod is the command you should use and the output should contain gpio_keys.

dtoverlay -l only shows the overlays loaded at runtime, thus not the ones added to config.txt.

Note as mentioned above that the syntax for loading overlays at runtime is slightly different, e.g.:
dtoverlay gpio-shutdown gpio_pin=3 active_low=1 gpio_pull=up
Not sure currently if this fails, when loaded via config.txt already, but AFAIK it works. Then you can check via dtoverlay -l if it has been successfully loaded, respectively otherwise the first will throw an error message already.

If overlay and module is loaded and systemd-logind running (systemctl status systemd-logind) and the shutdown button does still not work, then we have to check if the pins are responding as expected. I don't have the commands here, but it is possible to send input to the keys from command lines as well, as well as checking the current state of the physical pins.

johncolman
Posts: 8
Joined: Sat Aug 17, 2019 8:05 pm

Re: dtoverlay=gpio-shutdown,gpio_pin=3,active_low=1,gpio_pull=up

Post by johncolman » Mon Aug 19, 2019 5:23 pm

Ok typed the wrong thing for lsmod, this is the reply from lsmod
gpio_keys 9575 0

When I run the overlay from the command line with spaces I get
* Failed to apply overlay '0_gpio-shutdown' (kernel)

This is what I get when I run systemctl
[email protected]:~# systemctl unmask systemd-logind
[email protected]:~# systemctl status systemd-logind
● systemd-logind.service - Login Service
Loaded: loaded (/lib/systemd/system/systemd-logind.service; static; vendor preset: enabled)
Active: inactive (dead)
Condition: start condition failed at Sat 2019-08-17 22:06:53 BST; 1 day 19h ago
Docs: man:systemd-logind.service(8)
man:logind.conf(5)
http://www.freedesktop.org/wiki/Software/systemd/logind
http://www.freedesktop.org/wiki/Softwar ... /multiseat

User avatar
MichaIng
Legend
Posts: 1638
Joined: Sat Nov 18, 2017 5:21 pm

Re: dtoverlay=gpio-shutdown,gpio_pin=3,active_low=1,gpio_pull=up

Post by MichaIng » Mon Aug 19, 2019 6:01 pm

@johncolman
Ah that's it, dbus is missing, didn't think about that:
G_AGI dbus
systemctl restart systemd-logind


Actually libpam-systemd might be required as well: G_AGI libpam-systemd

johncolman
Posts: 8
Joined: Sat Aug 17, 2019 8:05 pm

Re: dtoverlay=gpio-shutdown,gpio_pin=3,active_low=1,gpio_pull=up

Post by johncolman » Mon Aug 19, 2019 6:32 pm

Bingo

It shuts down and a second click of the button it restarts. Tried it a few times and works ok. I will try adding the super capacitor UPS on pin 18 next.

Thanks very much.

User avatar
MichaIng
Legend
Posts: 1638
Joined: Sat Nov 18, 2017 5:21 pm

Re: dtoverlay=gpio-shutdown,gpio_pin=3,active_low=1,gpio_pull=up

Post by MichaIng » Mon Aug 19, 2019 6:36 pm

@johncolman
Great, probably some info we should add somewhere, at least to dietpi.txt where you can set systemd-logind to be enabled prior to first boot.

Was dbus sufficient or libpam-systemd required as well?

johncolman
Posts: 8
Joined: Sat Aug 17, 2019 8:05 pm

Re: dtoverlay=gpio-shutdown,gpio_pin=3,active_low=1,gpio_pull=up

Post by johncolman » Mon Aug 19, 2019 6:39 pm

Sorry I ran both first time before trying.

User avatar
MichaIng
Legend
Posts: 1638
Joined: Sat Nov 18, 2017 5:21 pm

Re: dtoverlay=gpio-shutdown,gpio_pin=3,active_low=1,gpio_pull=up

Post by MichaIng » Mon Aug 19, 2019 6:54 pm

Okay, could be tested, but actually the docs state that libpam-systemd is required for logind functionality in general: https://packages.debian.org/stretch/libpam-systemd
The only other thing that systemd-logind does, AFAIK, is automatically spawning gettys on demand, but not tracking/handling any session tasks.

johncolman
Posts: 8
Joined: Sat Aug 17, 2019 8:05 pm

Re: dtoverlay=gpio-shutdown,gpio_pin=3,active_low=1,gpio_pull=up

Post by johncolman » Sat Sep 07, 2019 3:26 pm

I just done another install and I didn't need to run G_AGI libpam-systemd for it to work.

Post Reply