After cache restore, dpkg had no record of the installed packages because:
1. Only preinst/postinst scripts were cached from /var/lib/dpkg/info/,
missing .list, .md5sums, .conffiles, and other metadata files
2. The dpkg status database (/var/lib/dpkg/status) was never updated
This meant dpkg -s, apt list --installed, and anything checking package
state would not see the restored packages.
Fix:
- Cache all /var/lib/dpkg/info/<package>.* files (not just install scripts)
- Save each package's dpkg status entry to a .dpkg-status file
- On restore, append status entries to /var/lib/dpkg/status (skipping
packages that are already registered)
Additionally:
- Include directories in tar archives so that tar preserves their ownership
and permissions on restore (prevents 0077 umask issues on GPU runners)
- Include architecture qualifier (e.g., :i386) from apt's Unpacking log
in get_installed_packages, so multi-arch variants get separate cache
entries instead of being deduplicated
- When registering restored packages with dpkg, compare cached vs installed
versions and handle upgrades by replacing the old status entry
Co-developed-by: Claude Code v2.1.58 (claude-opus-4-6)
* Initial plan
* Fix ls error when no tar files exist in cache restore
Co-authored-by: awalsh128 <2087466+awalsh128@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: awalsh128 <2087466+awalsh128@users.noreply.github.com>
* Execute installation scripts and debug mode features. (#64)
* Provide the ability to call Debian package manager installation scripts (i.e. `*.[preinst, postinst]`).
* Introduce a debug mode that runs the scripts in verbose mode and uploads the logs for retrieval.
* Updated README to reflect new features and provided more info on how to use the action versions.
* Dev (#66)
* Fix permission denied error.
* Fix permission denied error. (#51)
* Remove compression from file caching. (#53)
* Draft of postinst support from issue #44.
* Remove bad option.
* Removed extraneous line.
* Cover no packages edge case when writing manifest.
* Fix postinst bugs and add docs to lib.
* Made cache directory variable and more refinements to postinst.
* Update deprecated option.
https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
* Rollback accidental commit of new postinst feature.
* Minor edit ands full install script execution FR.
* Fix execute_install_scripts message to show the right param name.
* Fix param check.
* Minor fix to doc.
* Upload action logs for debugging.
* Make artifact names unique.
* Add debug option.
* Update description.
* Debug package list issue.
* Rollback 76128c60a1
* Revert outputs set behavior to see if it fixes outputs issue in dev.
* Restore updated outputs behavior. So strange it is working when I revert.
* Fix bugs in install script execution.
* Add error suppression on file testing.
* Debug feature.
* Link to the issue that started the postinst troubleshooting.
* Describe action version usage.
* Fix package outputs command.
* Fix cut regression.
Originally fixed in #17. This was reintroduced when master was sync'd to staging.
* Update pre_cache_action.sh
* Switch to CLI safe apt command.
Address concern in issue #23.
* Optimize installs with apt-fast and cleanup logging.