How do I restore /snap/bin contents, easily?

I was moving my system to a new disk and was silly enough to exclude /snap/* directory.

Now I have /snap/ with all the snaps inside, but I am missing /snap/bin/ and all the symlinks there.

I tried to remove one of the snaps (btop), and install it back, and that did create the symlink for that snap in /snap/bin, but btop failed to start:

root@buntor:~# btop cannot locate base snap core24: No such file or directory

Now since btop was the only snap using core24 I was able to reinstall core24 and then btop. But for my other snaps this is a bit tedious :slight_smile:

Is there a better/faster/proper way of restoring the contents of /snap/bin/ ?

I have developed a script to deal with the exact thing:

https://gitlab.com/brlin/fix-snap-bin

Note that there’s a known bug I haven’t fixed at the moment:

https://gitlab.com/brlin/fix-snap-bin/-/issues/3

This problem is fixed in the 1.0.2 version.