Just adding another solution in case you've messed up with apparmor profiles and a service restart is not enough for you.
This would probably apply to you if you used aa-genprof to create a new profile of an app under the management of snapd, in my case it was VSCode.
Snap core package was broken so new snaps installation were also failing.
If you can't remove Firefox snap due to
Unlinkat /var/snap/firefox/common/host-hunspell/
try unmounting it umount /var/snap/firefox/common/host-hunspell
, before snap remove --purge firefox
mkdir -p ~/profile-backups ~/profile-backups/var ~/profile-backups/local
# Stop services before moving around profiles
sudo systemctl stop snapd.apparmor
sudo systemctl stop apparmor
find /etc/apparmor.d -type f -name "*snapd*"
# -> check what you find and the edit time, new stuff is suspicious stuff
ls -lt /etc/apparmor.d
sudo mv /etc/apparmor.d/*snap-confine* ~/profile-backups
sudo mv /etc/apparmor.d/local/*snap-confine* ~/profile-backups/local
sudo mv /var/lib/snapd/apparmor/profiles/*confine* ~/profile-backups/var
sudo apt purge snapd
sudo aa-remove-unknown
# -> restart
sudo apt install -y --install-recommends snapd
Install as classic or from apt only the trusted few packages that have issues with apparmor like starship or vscode
sudo snap install --classic what_you_like_to_not_be_restricted --channel latest/stable
Then install Firefox, VScode... from apt or official deb or as classic snaps.
sudo apt purge snapd snap-confine
That will uninstall a lot of applications and that's not what you normally want. – Rank