Skip to content

Commit b21043c

Browse files
committed
package/podman: bump 4.5.0 -> 4.9.5
This major upgrade, along with the upgrade to Finit v4.14, is what is needed to fix #1123, which was caused by some odd futex locking bug in Podman that left lingering issues in /var/lib/containers state files. The root cause as fixed already in v4.7.x, but since CNI is supported up to and including 4.9.5, going with a later release seemd prudent. Full changelogs at: - <https://github.com/containers/podman/releases/tag/v4.5.1> - <https://github.com/containers/podman/releases/tag/v4.6.0> - <https://github.com/containers/podman/releases/tag/v4.6.1> - <https://github.com/containers/podman/releases/tag/v4.6.2> - <https://github.com/containers/podman/releases/tag/v4.7.0> - <https://github.com/containers/podman/releases/tag/v4.7.1> - <https://github.com/containers/podman/releases/tag/v4.7.2> - <https://github.com/containers/podman/releases/tag/v4.8.0> - <https://github.com/containers/podman/releases/tag/v4.8.1> - <https://github.com/containers/podman/releases/tag/v4.8.2> - <https://github.com/containers/podman/releases/tag/v4.8.3> - <https://github.com/containers/podman/releases/tag/v4.9.0> - <https://github.com/containers/podman/releases/tag/v4.9.1> - <https://github.com/containers/podman/releases/tag/v4.9.2> - <https://github.com/containers/podman/releases/tag/v4.9.3> - <https://github.com/containers/podman/releases/tag/v4.9.4> - <https://github.com/containers/podman/releases/tag/v4.9.5> Fixes #1123 Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
1 parent ab9b2f5 commit b21043c

File tree

7 files changed

+65
-28
lines changed

7 files changed

+65
-28
lines changed

board/common/rootfs/usr/sbin/container

Lines changed: 59 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#
99
DOWNLOADS=/var/lib/containers/oci
1010
BUILTIN=/lib/oci
11-
TMPDIR=/var/tmp
11+
BASEDIR=/var/tmp
1212
container=$0
1313
checksum=""
1414
extracted=
@@ -29,10 +29,10 @@ err()
2929
rc=$1; shift
3030
logger -I $PPID -t container -p local1.err -- "Error: $*"
3131

32-
if [ -n "$extracted" ]; then
33-
if [ -d "$TMPDIR/$dir" ]; then
34-
log "Cleaning up extracted $dir"
35-
rm -rf "$dir"
32+
if [ -n "$extracted" ] && [ -n "$tmpdir" ]; then
33+
if [ -d "$tmpdir" ]; then
34+
log "Cleaning up temporary directory $tmpdir"
35+
rm -rf "$tmpdir"
3636
fi
3737
fi
3838

@@ -110,10 +110,11 @@ EOF
110110
return 1
111111
}
112112

113-
# Unpacks a given oci-archive.tar[.gz] in the current directory. Sanity
114-
# checks, at least one index.json in the top-level dir of the archive.
115-
# If there are more index files, this function does not handle them.
116-
unpack_archive()
113+
# Extracts an oci-archive.tar[.gz] in a temporary directory. Finds and
114+
# sanity checks that at least one index.json exist in the archive. This
115+
# is the OCI directory fed to `podman load` and also used as repo name.
116+
# NOTE: if there are >1 index.json, this function does not handle them.
117+
load_archive()
117118
{
118119
uri=$1
119120
tag=$2
@@ -158,49 +159,81 @@ unpack_archive()
158159
fi
159160
fi
160161

162+
file=$(realpath "$file")
161163
if [ -d "$file" ]; then
162164
index=$(find "$file" -name index.json)
163165
if [ -z "$index" ]; then
164166
err 1 "cannot find index.json in OCI image $file"
165167
fi
166168
else
167-
cd "$TMPDIR" || err 0 "failed cd $TMPDIR, wiill use $(pwd) for OCI archive extraction."
169+
# Extract files in a temporary directory, because most OCI
170+
# archives are flat/bare, all files in the root w/o a dir/
171+
tmpdir=$(mktemp -d -p "$BASEDIR") || err 1 "failed creating temporary directory"
172+
cd "$tmpdir" || err 1 "failed cd to temporary directory $tmpdir"
168173

169-
index=$(tar tf "$file" |grep index.json)
174+
index="$tmpdir/$(tar tf "$file" |grep index.json)"
170175
if [ -z "$index" ]; then
171176
err 1 "invalid OCI archive, cannot find index.json in $file"
172177
fi
173178

174179
[ -n "$quiet" ] || log "Extracting OCI archive $file ..."
175-
tar xf "$file" || err 1 "failed unpacking $file in $(pwd)"
180+
tar xf "$file" || err 1 "failed unpacking $file in $tmpdir"
176181
extracted=true
182+
cd - >/dev/null || err 0 "failed cd -"
177183
fi
178184

179185
dir=$(dirname "$index")
180-
if echo "$dir" | grep -q ":"; then
186+
187+
# Handle flat tarballs without a sub-directory, because
188+
# the $dir name is used as fallback when retagging below.
189+
if [ -n "$extracted" ] && [ "$dir" = "$tmpdir" ]; then
190+
parent=$(dirname "$dir")
191+
dirnam=$(echo "$img" | sed 's/\(.*\)\.tar.*/\1/')
192+
tmpdir="${parent}/${dirnam}"
193+
mv "$dir" "$tmpdir"
194+
dir="$tmpdir"
195+
fi
196+
197+
if basename "$dir" | grep -q ":"; then
181198
if [ -z "$tag" ]; then
182-
tag="$dir"
199+
tag=$(basename "$dir")
183200
fi
201+
184202
sanitized_dir=$(echo "$dir" | cut -d':' -f1)
185203
mv "$dir" "$sanitized_dir" || err 1 "failed renaming $dir to $sanitized_dir"
186204
dir="$sanitized_dir"
187205
fi
188206

189207
[ -n "$quiet" ] || log "Loading OCI image $dir ..."
190-
podman load -qi "$dir" >/dev/null
208+
output=$(podman load -qi "$dir")
209+
210+
# Extract image ID from podman load output:
211+
# "Loaded image: sha256:cd9d0aaf81be..."
212+
if echo "$output" | grep -q "sha256:"; then
213+
img_id="${output##*sha256:}"
214+
else
215+
# Fallback to directory name if no SHA found
216+
img_id="$dir"
217+
fi
218+
219+
# On podman < 4.7.0 we had to retag images from default $dir:latest
220+
# From >= 4.7.0 we always tag since loads come in as <none>:<none>
221+
if [ -z "$tag" ]; then
222+
tag=$(basename "$dir")
223+
fi
224+
225+
# Repo names must be lowercase, and only '[a-z0-9._/-]+' and ':tag'
226+
tag=$(printf "%s" "$tag" | tr '[:upper:]' '[:lower:]' | tr -c 'a-z0-9._/:-' '-')
227+
228+
[ -n "$quiet" ] || log "Tagging loaded image $img_id as $tag"
229+
if ! podman tag "$img_id" "$tag"; then
230+
err 1 "failed tagging image as $tag"
231+
fi
191232

192233
# Clean up after ourselves
193234
if [ -n "$extracted" ]; then
194235
log "Cleaning up extracted $dir"
195-
rm -rf "$dir"
196-
fi
197-
198-
# Retag image from podman default $dir:latest
199-
if [ -n "$tag" ]; then
200-
podman tag "$dir" "$tag" >/dev/null
201-
podman rmi "$dir" >/dev/null
202-
else
203-
tag=$dir
236+
rm -rf "$tmpdir"
204237
fi
205238

206239
echo "$tag"
@@ -228,7 +261,7 @@ create()
228261

229262
# Unpack and load docker-archive/oci/oci-archive, returning image
230263
# name, or return docker:// URL for download.
231-
if ! image=$(unpack_archive "$image"); then
264+
if ! image=$(load_archive "$image"); then
232265
exit 1
233266
fi
234267

@@ -666,7 +699,7 @@ case $cmd in
666699
;;
667700
load)
668701
# shellcheck disable=SC2086
669-
name=$(unpack_archive "$1" $2)
702+
name=$(load_archive "$1" $2)
670703
[ -n "$name" ] || exit 1
671704

672705
# Show resulting image(s) matching $name

doc/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ All notable changes to the project are documented in this file.
1414

1515
### Fixes
1616
- Fix #1098: Prune dangling container images to reclaim disk space
17+
- Fix #1123: Disabling or removing a container may cause podman to hang
1718

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

package/podman/podman.hash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Locally computed
2-
sha256 830a633630bf6e61f2b8d4ca00efdd9a173ef25cdd49d4a4364c293e088561df podman-4.5.0-go2.tar.gz
2+
sha256 53f6bf7a8e4b647b2378ea8bfee6c67e03e412bf027b4dc0ff37a3a764703405 podman-4.9.5-go2.tar.gz
33
sha256 62fb8a3a9621dc2388174caaabe9c2317b694bb9a1d46c98bcf5655b68f51be3 LICENSE

package/podman/podman.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
################################################################################
66

7-
PODMAN_VERSION = 4.5.0
7+
PODMAN_VERSION = 4.9.5
88
PODMAN_SITE = $(call github,containers,podman,v$(PODMAN_VERSION))
99
PODMAN_LICENSE = Apache-2.0
1010
PODMAN_LICENSE_FILES = LICENSE

package/podman/unconfined.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1+
[Network]
2+
network_backend = "cni"
3+
14
[containers]
25
seccomp_profile = "unconfined"
File renamed without changes.

patches/podman/4.5.0/0002-Add-log-driver-for-syslog.patch renamed to patches/podman/4.9.5/0002-Add-log-driver-for-syslog.patch

File renamed without changes.

0 commit comments

Comments
 (0)