Skip to content

Commit 66a5e53

Browse files
committed
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 <[email protected]>
1 parent 12df83e commit 66a5e53

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

board/common/rootfs/usr/sbin/container

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,11 @@ case $cmd in
782782

783783
while ! "$script"; do
784784
log "${name}: setup failed, waiting for network changes ..."
785-
read -t 60 _ < <(ip monitor address route)
785+
786+
# Timeout and retry after 60 seconds, on SIGTERM, or when
787+
# any network event is caught.
788+
timeout -s TERM -k 1 60 sh -c \
789+
'ip monitor address route 2>/dev/null | head -n1 >/dev/null' || true
786790

787791
# On IP address/route changes, wait a few seconds more to ensure
788792
# the system has ample time to react and set things up for us.

doc/ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ All notable changes to the project are documented in this file.
1515
### Fixes
1616
- Fix #1098: Prune dangling container images to reclaim disk space
1717
- Fix #1123: Disabling or removing a container may cause podman to hang
18+
- Fix #1124: Container setup with unreachable remote image spawns
19+
excessive `ip monitor` processes
1820

1921
[RPI-TOUCH]: https://www.raspberrypi.com/products/raspberry-pi-touch-display/
2022

0 commit comments

Comments
 (0)