Cannot update snap namespace: cannot recover from trespassing over / snap-update-ns failed with code 1

Good morning or afternoon, so after discovering the following problems: https://askubuntu.com/questions/1368476/i-ran-the-following-commands-by-mistake-in-my-ubuntu-21-04-machine-and-then-ever https://askubuntu.com/questions/1369017/usr-bin-update-manager-is-not-working-properly which was caused by silly powerful commands like:

sudo chown john: /*
sudo chown john: /**
sudo chown john: /**/**

on my Ubuntu 21.04(Currently upgraded to 21.10) Machine, I found that many things are broken like snaps and update manager and many other packages… and when i try to run telegram-desktop it results in cannot update snap namespace: cannot recover from trespassing over / snap-update-ns failed with code 1 and when i tried to launch blender it results in /var not root-owned 1000:1000

please note that i tried the following discussions… Snap-update-ns failing, cannot launch snaps and specially sudo apparmor_parser -r /var/lib/snapd/apparmor/profiles/* but it didn’t work…

please some help

It is almost impossible to completely recover from such a situation that arises from chown $USER /*. Instead you need to either restore from backup or install your distribution anew.

Indeed, this sounds like a serious problem. I don’t think there is a sane way to restore those permissions correctly with dpkg. As a last resort, I would try reinstalling all installed packages. This should reset the permissions of files that are part of each package, but I don’t think the permissions of data generated by various services would be reset.