How to unseed Snaps from a system (i.e. unpacked ISO squashfs) that has seeded but not yet installed Snaps?

At my workplace, we use a customized image of Kubuntu 24.04. There are some Snaps present on that ISO that are unnecessary for our purposes, so we’ve been unseeding them from the ISO by doing roughly the following:

  • Chroot into the unpacked squashfs
  • Do our normal tweaks, including running a full apt update && apt full-upgrade
  • cd /var/lib/snapd/seed
  • rm assertions/snapname*.assert snaps/snapname*.snap ../snaps/snapname*.snap
  • vim seed.yaml
    • Find the snap in question and remove its entry from the file

Then we repack the ISO and use it (using Cubic to simplify most of the process here). What this is supposed to do (and what it used to do until just recently) is prevent the Snap from being present in the live environment or the installed system. The output of snap list would show that the Snaps simply weren’t there. However, with the 24.04.1 ISO, something about the ISO or something about the software updates installed during the rebuild has thrown a wrench in the works here - snap list now shows the unseeded Snaps as being broken but present. Attempting to launch them with snap run fails as one might expect. Removing them fully with snap remove works just fine.

How exactly should one unseed a Snap? Is there any recent change in snapd that might be causing this?

Hmm, I may have solved this myself, additionally removing the Snap entries for the Snaps in question from /var/lib/snapd/state.json seems to have done the trick.