From 66a5e5304b83b328771d2c1d530941df3e552650 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sun, 31 Aug 2025 14:00:51 +0200 Subject: [PATCH] board/common: fix container network change detection on pull When a container's image is on an inaccessible remote server, the container wrapper script waits in the background for any netowrk changes to retry download of the image. This change avoids the dangerous previous construct, and is also easier to read: timeuot after 60 seconds unless ip monitor reads at least one event before that. Fixes #1124 Signed-off-by: Joachim Wiberg --- board/common/rootfs/usr/sbin/container | 6 +++++- doc/ChangeLog.md | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/board/common/rootfs/usr/sbin/container b/board/common/rootfs/usr/sbin/container index 1b0746bb..fe68c85a 100755 --- a/board/common/rootfs/usr/sbin/container +++ b/board/common/rootfs/usr/sbin/container @@ -782,7 +782,11 @@ case $cmd in while ! "$script"; do log "${name}: setup failed, waiting for network changes ..." - read -t 60 _ < <(ip monitor address route) + + # Timeout and retry after 60 seconds, on SIGTERM, or when + # any network event is caught. + timeout -s TERM -k 1 60 sh -c \ + 'ip monitor address route 2>/dev/null | head -n1 >/dev/null' || true # On IP address/route changes, wait a few seconds more to ensure # the system has ample time to react and set things up for us. diff --git a/doc/ChangeLog.md b/doc/ChangeLog.md index a11f3565..9916f5e8 100644 --- a/doc/ChangeLog.md +++ b/doc/ChangeLog.md @@ -15,6 +15,8 @@ All notable changes to the project are documented in this file. ### Fixes - Fix #1098: Prune dangling container images to reclaim disk space - Fix #1123: Disabling or removing a container may cause podman to hang +- Fix #1124: Container setup with unreachable remote image spawns + excessive `ip monitor` processes [RPI-TOUCH]: https://www.raspberrypi.com/products/raspberry-pi-touch-display/