43 lines
1.2 KiB
Diff
43 lines
1.2 KiB
Diff
From: Matthias Schiffer <mschiffer@universe-factory.net>
|
|
Date: Thu, 13 Jul 2017 00:19:32 +0200
|
|
Subject: base-files: upgrade: don't loop forever trying to kill processes
|
|
|
|
When processes don't die on SIGKILL (usually because of kernel bugs), it's
|
|
better to give up instead of looping forever.
|
|
|
|
upgraded will trigger a reboot in this case (and if this fails, a hardware
|
|
watchdog will eventually time out and reset the system, if present).
|
|
|
|
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
|
|
|
|
diff --git a/package/base-files/files/lib/upgrade/stage2 b/package/base-files/files/lib/upgrade/stage2
|
|
index bdbb8926643287f48a4ae62c5d1d4b4a29130859..097ad63adfecdd70019acaa5b652d2056e774c3f 100755
|
|
--- a/package/base-files/files/lib/upgrade/stage2
|
|
+++ b/package/base-files/files/lib/upgrade/stage2
|
|
@@ -87,6 +87,8 @@ switch_to_ramfs() {
|
|
}
|
|
|
|
kill_remaining() { # [ <signal> [ <loop> ] ]
|
|
+ local loop_limit=10
|
|
+
|
|
local sig="${1:-TERM}"
|
|
local loop="${2:-0}"
|
|
local run=true
|
|
@@ -117,8 +119,15 @@ kill_remaining() { # [ <signal> [ <loop> ] ]
|
|
|
|
[ $loop -eq 1 ] && run=true
|
|
done
|
|
+
|
|
+ let loop_limit--
|
|
+ [ $loop_limit -eq 0 ] && {
|
|
+ echo
|
|
+ echo "Failed to kill all processes."
|
|
+ exit 1
|
|
+ }
|
|
done
|
|
- echo ""
|
|
+ echo
|
|
}
|
|
|
|
|