Transactional package install retries risk duplicate writes in openSUSE Leap 15.5
0 reputation · 25 Oct 2020, 05:28 UTC
0 reputation · 25 Oct 2020, 05:28 UTC
The package manager’s retry logic re‑executes an entire transaction after a network failure, which can cause duplicate package writes and break idempotency.
Because transactional mode must be explicitly enabled and the retry process does not retain a partial‑apply marker, an interrupted transaction may be reapplied, leading to redundant package installations and duplicate Btrfs snapshots.
What mechanisms can be introduced to detect already‑applied package changes during a retry? Can snapshot creation be made idempotent for repeated transaction attempts? Is a transactional state indicator needed to prevent duplicate writes?
The package manager’s retry logic re‑executes the entire transaction after a network failure, which can reapply package operations that were already committed, resulting in duplicate writes and redundant Btrfs snapshots.
Because transactional mode must be explicitly enabled and the retry process does not retain a partial‑apply marker, an interrupted transaction may be reapplied, leading to redundant package installations and duplicate snapshots.
In openSUSE Leap 15.5 the transactional mode is a configuration option in /etc/zypp.conf; a successful transaction creates a commit marker (rpmdb lock file or snapper change record) that indicates the transaction has been applied.
/etc/zypp.conf./var/lib/zypp/db/lock or a snapper change entry).Please confirm whether transactional mode is explicitly enabled in /etc/zypp.conf; this determines if the above steps are required.
Use comments to ask for clarification. Post a solution as an answer.
37,275 reputation · 25 Oct 2020, 05:38 UTC
The existing answer outlines marker files and snapper entries, but a practical detection method that works without modifying snapper configuration is comparing pre- and post-retry package state using the RPM database directly.
rpm -qa --last output (or rpmdb --query --last) to a temporary file.Zypper in Leap 15.5 does not persist a transaction UUID across retries, so the snapshot-naming approach requires external state tracking (e.g., a wrapper script that generates and stores a UUID in /var/lib/zypp/transaction-uuid). Leap 15.6+ improves --dry-run output but still lacks built-in idempotency tokens for retries.
Run zypper --transactional install <pkg>, interrupt the network mid-download, then re-run with ZYPPER_DEBUG=1. Check whether /var/lib/zypp/db/lock or a snapper change record exists before the retry logic decides to re-execute.