[systemd-devel] ShutdownWatchdogSec does not work as described
Michael Olbrich
m.olbrich at pengutronix.de
Mon Mar 19 09:19:39 UTC 2018
On Mon, Mar 19, 2018 at 11:41:33AM +0530, prashantkumar dhotre wrote:
> I am observing that ShutdownWatchdogSec setting in system.conf
>
> In man page, for ShutdownWatchdogSec , I see :
> " It works as a safety net to ensure that the reboot takes place even if a
> clean reboot attempt times out. "
> I am not clear what is meant by 'clean reboot' and 'times out ' here
>
> For testing, I have set it to 5 sec
>
> ++++++++++++++++++++++++++++++
> root at re1:~# grep ShutdownWatchdogSec /etc/systemd/system.conf
> ShutdownWatchdogSec=5sec
> root at re1:~#
> ++++++++++++++++++++++++++++++
>
>
> and I have my.service , which on stop will sleep for few minutes
>
> ++++++++++++++++++++++++++++++
> # cat /etc/systemd/system/my.service
> [Unit]
> Description="my"
>
> [Service]
> Type=oneshot
> RemainAfterExit=yes
> ExecStart=/bin/true
> ExecStopPost=/bin/sleep 3000
> Restart=no
>
> [Install]
> WantedBy=multi-user.target
> ++++++++++++++++++++++++++++++
>
> But I dont see hardware watchdog being kicked in.
> Is this a bug in ShutdownWatchdogSec ? if not am I missing any config ?
>
> I did some research and found below links which talk about effect of
> ShutdownWatchdogSec .
>
> https://utcc.utoronto.ca/~cks/space/blog/linux/SystemdNFSMountShutdown
> https://utcc.utoronto.ca/~cks/space/blog/linux/SystemdShutdownWatchdog
>
> as described in above pages, one option seem to be to lower value of
> JobTimeoutSec
> <https://www.freedesktop.org/software/systemd/man/systemd.unit.html> in
> reboot.target but that solution is still about software watchdog and not
> about hardware watchdog.
>
>
> My requirement is to put upper bound time limit of reboot, and once upper
> limit is reached, i want to kick in hardware watchdog
>
> Could you please let me know how do I achieve this ?
Rebooting with systemd can be split into 3 stages:
1. Activate reboot.target
That's just a normal transition in systemd. The mainloop is still
running and RuntimeWatchdogSec= is used and the watchdog is pinged as
needed.
2. Kill all remaining processes and unmount all filesystem. The mainloop is
no longer running at this point. This is covered by ShutdownWatchdogSec=
in case any of these operations does not finish.
3. Execute the reboot() system call.
I'm not sure if you can limit the duration of the first step reliably. You
can skip it with 'systemctl reboot -f'.
Michael
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the systemd-devel
mailing list