How to uninstall a snap package manually?

I am trying to remove a snap package, leagueoflegends, but i am getting this error:

error: cannot perform the following tasks:
- Disconnect leagueoflegends:desktop-legacy from core:desktop-legacy (internal error: connection "leagueoflegends:desktop-legacy core:desktop-legacy" not found in state)
- Disconnect leagueoflegends:wine-4-staging from wine-platform-4-staging:wine-4-staging (cannot setup apparmor for snap "leagueoflegends": cannot load apparmor profiles: exit status 10
apparmor_parser output:
)
- Disconnect leagueoflegends:wine-4-staging from wine-platform-4-staging:wine-4-staging (cannot load apparmor profiles: exit status 10
apparmor_parser output:
)
- Disconnect leagueoflegends:home from core:home (cannot setup apparmor for snap "leagueoflegends": cannot load apparmor profiles: exit status 10
apparmor_parser output:
)
- Disconnect leagueoflegends:home from core:home (cannot load apparmor profiles: exit status 10
apparmor_parser output:
)
- Disconnect leagueoflegends:icon-themes from gtk-common-themes:icon-themes (cannot setup apparmor for snap "leagueoflegends": cannot load apparmor profiles: exit status 10
apparmor_parser output:
)
- Disconnect leagueoflegends:icon-themes from gtk-common-themes:icon-themes (cannot load apparmor profiles: exit status 10
apparmor_parser output:
)

I have attempted to remove the snap package from all the folders its stored at except for /snap/leagueoflegends, where I am getting write-protection error: "cannot remove ... "Read-only file system".


Solution 1:

You may have created a problem if you have deleted files as indicated.
The "normal" way to handle snap packages is via the snap utility. I have included help text and examples below to get you an impression what to use.

How exactly to get out of the situation you have created is harder to tell.
I suggest you do snap list to find out the actual name of the package you wish to remove, and then try sudo snap remove packagename - for that package.

If that displays errors, then you need to deal with those in a sane manner.


Some tips on "snap" usage...

$ snap list
<list of installed packages here>

$ snap help
The snap command lets you install, configure, refresh and remove snaps.
Snaps are packages that work across many different Linux distributions,
enabling secure delivery and operation of the latest apps and utilities.

Usage: snap  [...]

- - - 8<- - - - -  

For more information about a command, run 'snap help '.
For a short summary of all commands, run 'snap help --all'.

$ snap help remove
Usage:
  snap remove [remove-OPTIONS] ...

The remove command removes the named snap instance from the system.

By default all the snap revisions are removed, including their data and the
common data directory. When a --revision option is passed only the specified
revision is removed.

[remove command options]
      --no-wait     Do not wait for the operation to finish but just print the change id.
      --revision=   Remove only the given revision

$ sudo snap remove ...

Note that at least "core" needs to be there for snap to function... I'm not as sure about the others here, they might be required too.

$ snap list
Name                Version          Rev   Tracking  Publisher     Notes
core                16-2.39.3        7270  stable    canonical✓    core
core18              20190709         1066  stable    canonical✓    base
gtk-common-themes   0.1-22-gab0a26b  1313  stable    canonical✓    -
gtk2-common-themes  0.1              5     stable    canonical✓    -

... installing e.g. gimp or vlc adds a single line each.