tools: add read-only on-TV diagnostic dump

Run with: ssh root@<tv> 'sh -s' < tools/tv-diag.sh > tv-diag.txt

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Rene Kievits
2026-09-05 23:58:33 +02:00
co-authored by Claude Opus 5
parent bf2daac146
commit ae8229588e
+105
View File
@@ -0,0 +1,105 @@
#!/bin/sh
# Dumps everything needed to work out why the update popup still appears.
# Read-only: it changes nothing on the TV.
#
# ssh root@<tv-ip> 'sh -s' < tools/tv-diag.sh > tv-diag.txt
#
# Busybox-friendly on purpose - no bashisms, every command guarded.
SLUG=lgupdateblocker
STATE=/var/lib/webosbrew/$SLUG
section() { echo; echo "=================== $* ==================="; }
have() { command -v "$1" >/dev/null 2>&1; }
section "identity"
id
cat /etc/starfish-release 2>/dev/null || echo "(no /etc/starfish-release)"
cat /var/run/nyx/device_info.json 2>/dev/null | head -c 600
echo
uptime
date
section "did our boot hook run this boot?"
ls -l /var/lib/webosbrew/init.d/ 2>&1
echo "--- last 60 lines of $STATE/boot.log ---"
tail -60 "$STATE/boot.log" 2>&1
echo "--- config ---"
cat "$STATE/config.json" 2>&1
echo
echo "--- hosts list the hook uses ---"
cat "$STATE/hosts.txt" 2>&1
section "homebrew channel startup"
ls -la /var/lib/webosbrew/ 2>&1
ls -la /var/luna/preferences/ 2>/dev/null | grep -i webosbrew
echo "--- hbc startup script ---"
ls -l /media/developer/apps/usr/palm/services/org.webosbrew.hbchannel.service/startup.sh 2>&1
section "/etc/hosts"
cat /etc/hosts 2>&1
echo "--- is it bind-mounted? ---"
grep -i hosts /proc/mounts 2>&1
section "does blocking actually work?"
for h in su.lge.com snu.lge.com nsu.lge.com su-ssl.lge.com; do
if have nslookup; then
echo "$h -> $(nslookup "$h" 2>&1 | tail -3 | tr '\n' ' ')"
else
echo "$h -> $(ping -c 1 -W 2 "$h" 2>&1 | head -1)"
fi
done
section "staged firmware / update data"
find /mnt/lg -maxdepth 4 \( -iname '*swupdate*' -o -iname '*epk*' -o -iname '*upgrade*' \) 2>/dev/null | head -40
for d in /mnt/lg/cmn_data/swupdate /mnt/lg/swupdate /mnt/lg/user/swupdate; do
[ -e "$d" ] || continue
echo "--- $d ---"
ls -la "$d" 2>&1
du -sh "$d" 2>&1
done
echo "--- anything mounted over them? ---"
grep -i -E 'swupdate|/mnt/lg' /proc/mounts 2>&1
section "update services"
echo "--- upstart jobs ---"
ls /etc/init 2>/dev/null | grep -i -E 'update|upgrade|swup|ota'
echo "--- luna services ---"
ls /usr/palm/services 2>/dev/null | grep -i -E 'update|upgrade|swup|ota'
ls /var/palm/ls2/roles/prv 2>/dev/null | grep -i -E 'update|upgrade|swup|ota'
echo "--- running processes ---"
ps 2>/dev/null | grep -i -E 'swupdate|updater|upgrade' | grep -v grep
section "update-related settings"
for c in option general network commercial system; do
echo "--- category $c ---"
luna-send -n 1 -f "luna://com.webos.settingsservice/getSystemSettings" \
"{\"category\":\"$c\"}" 2>&1 |
tr ',' '\n' | grep -i -E 'update|upgrade|firmware|ota|epk'
done
section "what the update service itself says"
for svc in com.webos.service.swupdate com.webos.service.swupdater com.webos.service.update com.webos.service.upgrade; do
echo "--- $svc/getStatus ---"
luna-send -n 1 -t 3 -f "luna://$svc/getStatus" '{}' 2>&1 | head -c 500
echo
done
section "boot log: who raised the popup"
for f in /var/log/messages /var/log/syslog; do
[ -f "$f" ] || continue
echo "--- $f (update-related, last 60) ---"
grep -i -E 'swupdate|softwareupdate|upgrade|firmware' "$f" 2>/dev/null | tail -60
done
echo "--- notifications / alerts, last 40 ---"
grep -i -E 'createAlert|notificationmgr|systemAlert' /var/log/messages 2>/dev/null | tail -40
section "luna preferences that mention update"
grep -ril update /var/luna/preferences/ 2>/dev/null | head -20
for f in $(grep -ril update /var/luna/preferences/ 2>/dev/null | head -20); do
echo "--- $f ---"
head -c 300 "$f"
echo
done
section "done"