From f567f7eb8bdebeae066f5ad6ccd468e03ea07e30 Mon Sep 17 00:00:00 2001 From: Xiaofeng Wang Date: Wed, 21 Jan 2026 10:24:10 +0800 Subject: [PATCH] Fix destructive-cleanup failure when no old packages exist When rpm -qa returns no packages, xargs would still invoke rpm -e with no arguments, causing failure with "no packages given for erase" (exit code 123). Add -r flag to xargs to skip execution when input is empty. Signed-off-by: Xiaofeng Wang --- contrib/scripts/fedora-bootc-destructive-cleanup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/scripts/fedora-bootc-destructive-cleanup b/contrib/scripts/fedora-bootc-destructive-cleanup index 5a07b802..bf3dc99e 100644 --- a/contrib/scripts/fedora-bootc-destructive-cleanup +++ b/contrib/scripts/fedora-bootc-destructive-cleanup @@ -5,7 +5,7 @@ set -xeuo pipefail # Remove all RPMs installed in the physical root (i.e. the previous OS) mount -o remount,rw /sysroot -rpm -qa --root=/sysroot --dbpath=/usr/lib/sysimage/rpm | xargs rpm -e --root=/sysroot --dbpath=/usr/lib/sysimage/rpm +rpm -qa --root=/sysroot --dbpath=/usr/lib/sysimage/rpm | xargs -r rpm -e --root=/sysroot --dbpath=/usr/lib/sysimage/rpm # Remove all container images (including the one that was used to install) # Note that this does not remove stopped containers, and so some storage