Only use a file as the real gzip if it is a working binary, otherwise
reinstall the gzip package; bail out without touching gzip if that
fails. Check the .distrib and wrapper writes, and never purge pigz
while gzip still depends on it.
A gzip package update overwrote the pigz wrapper, and uninstall could
restore a stale gzip.original over a newer binary. Use dpkg-divert
(--no-rename, gzip is Essential), migrate existing installs, and also
divert the /usr path on bookworm so a PVE 8 -> 9 upgrade keeps working.
The wrapper assigned GZIP="-1" without exporting it, so pigz never saw
it and compressed at its default level 6. Export it, and refresh
/bin/gzip on re-runs when gzip.original already exists so existing
installs pick up the corrected wrapper.