Symptom
sub-pkg installation is getting failed by asking to restore the some previous version in flash.
Product: 9300
device: 8.18.18.75(on request will be provided)
admin/rma123
Error snippet:
===========
C9300_R16_75#install add file flash:C9800-SW-iosxe-wlc.17.06.01.SPA.bin activate commit
install_add_activate_commit: START Fri Nov 25 11:12:29 UTC 2022
install_add_activate_commit: Adding PKG
install_add_activate_commit: Checking whether new add is allowed ....
--- Starting initial file syncing ---
Info: Finished copying flash:C9800-SW-iosxe-wlc.17.06.01.SPA.bin to the selected switch(es)
Finished initial file syncing
--- Starting PKG Add operation ---
Performing PKG_ADD on all members
[1] PKG_ADD package(s) on switch 1
FAILED: install_add /flash/C9800-SW-iosxe-wlc.17.06.01.SPA.bin: Improper State./flash/C9800-SW-iosxe-wlc.17.09.01.SPA.bin not present. Please restore file for stability.
[1] Finished PKG_ADD on switch 1
Checking status of PKG_ADD on [1]
PKG_ADD: Passed on []. Failed on [1]
Finished PKG Add operation
FAILED: install_add_activate_commit exit(1) Fri Nov 25 11:13:24 UTC 2022
C9300_R16_75#
Workaround
IF we add the mentioned file in the logs, it works in the above example it was "C9800-SW-iosxe-wlc.17.09.01.SPA.bin"
Sometimes it will expect previous smu files and subpkgs to be present in the flash
Further Problem Description
If an image installed a SMU or wireless subpkg in the past, then installs different base image, then removes the SMU or wireless subpkg, the install of a different SMU will cause this issue. The patch.sta files will retain the previous history of the SMU/subpkg installs - this is both for rollback history, and also so that if the base image is ever re-installed, the SMU/subpkg will automatically apply.