Linux – Systemd shutdown timer not working

linuxsystemd

From the systemd manual:-

ShutdownWatchdogSec=

ShutdownWatchdogSec= may be used to configure the hardware watchdog when the system is asked to reboot. 
It works as a safety net to ensure that the reboot takes place even if a clean reboot attempt times out.
By default RuntimeWatchdogSec= defaults to 0 (off), and ShutdownWatchdogSec= to 10min.
These settings have no effect if a hardware watchdog is not available.

Currently, there is an issue with shutting down my system wherein the kernel keeps printing the message "unregister_netdevice: waiting for to get free:Instance count=1" even 10 minutes after issuing reboot command. I don't know what could be causing this issue, but I was hoping ShutdownWatchdogSec would force reboot in this and other scenarios.

However the system doesn't shut down within the stipulated time. It still takes 10+min. I have made the required change in my /etc/systemd/system.conf:

ShutdownWatchdogSec=4min

Watchdog seems to be present on my system

root@bugkiller:~# dmesg|grep watchdog

[    0.044094] NMI watchdog: enabled on all CPUs, permanently consumes one hw-PMU counter.
[    4.051861] systemd[1]: Hardware watchdog 'iTCO_wdt', version 0
[    4.051874] systemd[1]: Set hardware watchdog to 1min 4s.

root@re0:~# uname -a

Linux re0 4.1.15-foo-00929-g15aa5b3 #1 SMP PREEMPT Mon Oct 3 18:01:53 PDT 2016 x86_64 GNU/Linux

root@re0:~# systemctl –version

systemd 219
+PAM -AUDIT -SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP -LIBCRYPTSETUP -GCRYPT +GNUTLS +ACL +XZ -LZ4 -SECCOMP +BLKID -ELFUTILS +KMOD -IDN

Best Answer

This worked when I compiled the kernel with the option CONFIG_WATCHDOG_NOWAYOUT. Without this setting, the kernel disables the watchdog when the daemon is stopped.

Also, the error unregister_netdevice went away when I upgraded to 4.4 kernel