[PATCH] base-files: stage2: stop Wi-Fi service on firmware upgrade

Florian Eckert fe at dev.tdt.de
Thu Nov 13 00:58:18 PST 2025


It may happen that the WiFi service cannot be stopped with a 'TERM' and
'KILL' signal. As a result the firmware upgrade is failing with the
following log messages.

Mon Nov  3 21:28:06 CET 2025 upgrade: Sending KILL to remaining processes ...
Mon Nov  3 21:28:06 CET 2025 upgrade: Sending signal KILL to hostapd (5664)
Mon Nov  3 21:28:09 CET 2025 upgrade: Sending signal KILL to hostapd (5688)
Mon Nov  3 21:28:11 CET 2025 upgrade: Sending signal KILL to hostapd (5688)
Mon Nov  3 21:28:13 CET 2025 upgrade: Sending signal KILL to hostapd (5688)
Mon Nov  3 21:28:15 CET 2025 upgrade: Sending signal KILL to hostapd (5688)
Mon Nov  3 21:28:17 CET 2025 upgrade: Sending signal KILL to hostapd (5688)
Mon Nov  3 21:28:19 CET 2025 upgrade: Sending signal KILL to hostapd (5688)
Mon Nov  3 21:28:22 CET 2025 upgrade: Sending signal KILL to hostapd (5688)
Mon Nov  3 21:28:24 CET 2025 upgrade: Sending signal KILL to hostapd (5688)
Mon Nov  3 21:28:26 CET 2025 upgrade: Sending signal KILL to hostapd (5688)
Mon Nov  3 21:28:28 CET 2025 upgrade: Failed to kill all processes.
sysupgrade aborted with return code: 256

It appears that this is because clients remain connected to the system
via Wi-Fi during the system upgrade. The script call '/sbin/wifi down'
before sending the 'TERM' and 'KILL' signal fixes the problem and the
sysupgrade is completed successfully.

Signed-off-by: Florian Eckert <fe at dev.tdt.de>
---
 package/base-files/files/lib/upgrade/stage2 | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/package/base-files/files/lib/upgrade/stage2 b/package/base-files/files/lib/upgrade/stage2
index 5ce0b3549c..00c957c8eb 100755
--- a/package/base-files/files/lib/upgrade/stage2
+++ b/package/base-files/files/lib/upgrade/stage2
@@ -154,6 +154,11 @@ killall -9 telnetd 2>/dev/null
 killall -9 dropbear 2>/dev/null
 killall -9 ash 2>/dev/null
 
+[ -f /sbin/wifi ] && {
+	v "Stopping Wi-Fi service"
+	/sbin/wifi down
+}
+
 kill_remaining TERM
 sleep 4
 kill_remaining KILL 1
-- 
2.39.5




More information about the openwrt-devel mailing list