Skip to content

doinst.sh stale-component cleanup may select previous -upgraded- package manifest #2106

Description

@galaksy2020

doinst.sh stale-component cleanup may select previous -upgraded- package manifest

Environment

  • Unraid OS 7.3.2
  • Upgrade: dynamix.unraid.net-4.37.4-x86_64-5 → 4.37.5-x86_64-2
  • 4.37.5 installed automatically through Plugin Auto Update

Reproduction

After the upgrade, pkgtools contained both:

/var/lib/pkgtools/packages/dynamix.unraid.net-4.37.4-x86_64-5-upgraded-2026-10-01,05:30:14
/var/lib/pkgtools/packages/dynamix.unraid.net-4.37.5-x86_64-2

The cleanup added in #2063 uses:

for candidate in var/lib/pkgtools/packages/dynamix.unraid.net-* var/log/packages/dynamix.unraid.net-*; do
  if [ -f "$candidate" ]; then
    package_db="$candidate"
    break
  fi
done

Because the glob returns the previous 4.37.4-...-upgraded-... entry before 4.37.5, package_db points to the previous package manifest, not the newly installed one.

The cleanup then treats new 4.37.5 components as stale and deletes them.

Observed examples:

HeaderVersion-D0NK2O8v.js
BaseLogViewer-CdKyG-uI.js
ServerStatus-C-vSmgEE.js
SingleLogViewer-C7GZ7DTf.js
notification.subscription-B2qxOKMN.js

This caused missing WebGUI elements. Re-running installpkg reproduced the deletions (Removing stale component file: ...).

Extracting unraid-components directly from the same valid 4.37.5 TXZ, without running doinst.sh, restored the files and immediately restored the WebGUI.

Root cause

The cleanup assumes that the first dynamix.unraid.net-* package database entry is the current package.

That assumption is not valid during/after an upgradepkg operation when the previous -upgraded-... manifest and the new manifest coexist.

Suggested fix

Select the manifest corresponding explicitly to the package currently being installed instead of selecting the first wildcard match.

At minimum, *-upgraded-* entries should not be eligible when identifying the current package manifest.

A regression test should cover:

/var/lib/pkgtools/packages/
  dynamix.unraid.net-4.37.4-x86_64-5-upgraded-...
  dynamix.unraid.net-4.37.5-x86_64-2

and verify that the 4.37.5 manifest is selected and current 4.37.5 components are preserved.

Related: #2063 — fix(plugin): clean stale web components from TXZ installs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions