Often WSL2 does not work well anymore, and those commands have saved me some time and headaches.
If you have messed-up something (e.g. sudo), login to the WSL as root (from windows CMD)
C:\>wsl -u root
Restart WSL2, sometimes needed when you can't connect from your windows to the servicess runing on it (e.g. to access a localhost website running on WSL)