SOLVED: Watchdog TImer Help [S905X has no Shutdown State]

Running Linux raspberrypi 6.0.12-00858-gb98721ea4575 #1 SMP PREEMPT_DYNAMIC Thu Dec 8 19:08:19 UTC 2022 aarch64 GNU/Linux on AML-S905X-CC.

Raspbian-64 watchdog commands don’t seem to turn off watchdog timer.

Is it possible to:

  • disable
  • enable
  • check status

the watchdog timer?

The only related commands in the forums are:

root@raspberrypi:~# echo 'V' > /dev/watchdog
root@raspberrypi:~# echo 'V' | tee /dev/watchdog
V
root@raspberrypi:~# 

These don’t seem to do anything. Using the standard GUI method to shut down the system, Start Menu → Logout - Shutdown behaves exactly like Reboot. I suspect the watchdog timer is not being turned off.

shutdown -H halts the potato.
shutdown -P reboots the potato.

If the watchdog commands do in fact work, is it possible the watchdog timer is being turned on as the system powers down?

This is not the desired behavior.

Thanks.

AML-S905X-CC does not have a PMIC so there’s no shutdown state. When you shutdown, it triggers the reset GPIO on the SoC and the SoC effectively reboot. This is not related to the watchdog.

So there’s no way of shutting down at all?

There’s only the halt state where everything but the power supply shuts down.

Confused. Whatever I have tried only reboots. I assume that that’s what is meant by the above comment?

sudo shutdown -H now

OK. I see why mine did not work. I used sudo shutdown -h (lower case ‘h’, which is what I have always used before).

My comments apply to my setup which is the Bullseye Raspberry OS as downloaded from the Libre repository maybe a couple of weeks ago (2022-09-22-raspbian-bullseye-arm64+aml-s905x-cc.img.xz — with output from uname -a as “6.0.12-00858-gb98721ea4575 #1 SMP PREEMPT_DYNAMIC Thu Dec 8 19:08:19 UTC 2022 aarch64 GNU/Linux”) and with the default desktop environment (Pixel, I believe) and window manager (Openbox, I believe) for that install.

What I am also seeing is that, as observed by the OP, if I use the Shutdown option from the GUI I get a reboot.

It looks like this button in the GUI invokes a program called lxde-pi-shutdown-helper to get that menu. As far as I could tell, short of getting dirty and recompiling things, there may be no way to change some configuration item somewhere to have it execute shutdown -H instead of whatever lxde-pi-shutdown-helper is executing? Or maybe I am just missing something very obvious?

So we could provide a different quit session command and edit the entry appropriately at ~/.config/lxpanel/LXDE-pi/config to reflect this?

The tkinter library is supposed to be pretty easy to use but I just “figured it out” by copying (and slightly modifying) the code from Lubuntu 17.10 - Removing suspend, switch user, lock screen options from "Shutdown" Launcher - Ask Ubuntu .

So here are my directions.

First, to create a backup, run:

cp ~/.config/lxpanel/LXDE-pi/config ~/.config/lxpanel/LXDE-pi/config.bak

Then, create a file and call it session-logout-hack.py (use nano, mousepad, or whatever pleases you) and make the contents look as follows:

#!/usr/bin/env python3

from tkinter import *
import os

window = Tk()
B1 = Button(window, text = "Shutdown", command = lambda: os.system('shutdown -H now'))
B2 = Button(window, text = "Reboot", command = lambda: os.system('reboot'))
B3 = Button(window, text = "Logout", command = lambda: os.system('pkill -SIGTERM -f lxsession'))
B4 = Button(window, text = "LXDE shutdown menu", command = lambda: os.system('lxde-logout'))
B5 = Button(window, text = "Quit", command = lambda: quit())
B1.pack()
B2.pack()
B3.pack()
B4.pack()
B5.pack()
window.mainloop()

Then save it and move it to somewhere in the path like:
sudo mv session-logout-hack.pi /usr/bin/

Then copy the permissions of lxde-pi-shutdown-helper with
sudo chmod --reference=/usr/bin/lxde-pi-shutdown-helper /usr/bin/session-logout-hack.py

Then edit ~/.config/lxpanel/LXDE-pi/config to read as follows:

[Command]
Logout=session-logout-hack.py

Now log out of the session or reboot & it should be presenting you with a menu that will have a shutdown option that actually halts the Le Potato.

Note that the logout option will logout all active lxde sessions which is probably undesirable. Because of this, I added an option that invokes a the LXDL logout/shutdown menu. It has the same problem with halt but at least it can log out only your active session.

Logging out only your active session is probably very easy (I just haven’t found the answer); but it could also be the sort of thing that requires getting a session ID and using it in some way to log out of that session only. In either case, once you figure out that part, the Python code additions should be trivial.

If you can figure out how to logout only the current session, please reply to my comment and add to my answer (or you if find that everything I did was a waste of effort because there are much, much simpler ways of achieving what we want, that would be even better).

1 Like

Also, one could obviously play with the tkinter to make the menu look better. I did not feel so inclined as I overspent enough time on this as it is.

That should have been sudo mv session-logout-hack.py /usr/bin/