How to prevent data loss when removing a snap

I did umount /dev/loop8

Anyway, after changing .history permissions remove command succeeded.
Thank you for a valuable information.

does losetup /dev/loop8 tell you anything about the backing file?

I connected loop8 back to the same file that it was before and mounted on the same folder as before, enabled and removed. Trying to reinstall but that is another story. Thanks again.

For future reference in case anyone else sees this problem of not being able to remove a snap due to the snapshot failing and wants to disable the snapshot, you disable automatic snapshotting with:

$ snap set system snapshots.automatic.retention=no

(as documented at https://snapcraft.io/docs/snapshots under “Automatic snapshots”).

In other news, for users with snap-updated snapd versions, 2.40 has landed in stable channel of the core snap, and a release for distros like Fedora should be forthcoming