Ubuntu LTS is always lagging behind in newer releases of software, for stability reason, though it’s not always true, because one of the most stable Linux distribution Red Hat has reported kernel security issues which was already fixed 17 months prior. Anyway, to have software updated, Snap is a good choice and preinstalled in all recent Ubuntu releases, and I loved it before I knew how exactly it works.
Snap is a sandbox environment for software, where program is bundled by the developer all together into a single platform independent package, which can run in all systems with
snapd installed. Then many problems occur, generally performance related, snap daemon constantly causes high resource usage and slow down my system, and whenever I shutdown or reboot the system, snap always block there to stop something for minutes.
Another serious problem for me is input method engine, because the Snap sandbox isolates the program with host so that it can’t access the host environment. I use fcitx a lot, so when I run VS Code from snap, I was not able to input Chinese, until then I searched around and realized how does snap work. And I even found another sandbox Flatpak, gave it a try but unfortunately fcitx didn’t work neither. So I removed all those sandboxes.
The first step is reboot your system, because without that snap may block you from removing packages. Then do a
snap list to get all the packages installed, and remove them.
Looks scary, huh? Yes they have
core installed, and you may also have
gtk-common-themes, all seems something you should not remove, otherwise they would break your system. However I did remove all of them with
sudo snap remove core18 and blah blah.
After all of them removed, I purged the snapd package by
sudo apt purge snapd and made a system reboot.
All good, and shutdown is never stuck.