fix: Add more reliable method of killing stale processes

This commit is contained in:
ptrcnull 2021-12-29 06:07:28 +01:00
parent 9c8920067f
commit accab5dd87

View file

@ -91,7 +91,13 @@ echo '#!/bin/ash
rm third_stage.sh
# kill all remaining processes
lsof | grep old_root | awk "{print \$1}" | uniq | xargs kill -9 2>/dev/null
cd /proc
ps ax | awk "{print \$1}" | tail -n +3 | while read pid; do
if grep -qE "^/dev/\w+ / " /proc/$pid/mounts; then
kill -9 $pid
fi
done
cd /
/bin/umount -Rl old_root/* 2>/dev/null
/bin/umount old_root