Cannot --purge snap nextcloud

Nextcloud version (eg, 29.0.5): 27.1.9snap1
Operating system and version (eg, Ubuntu 29.04): Ubuntu 22.04.4 LTS

The issue you are facing:

After having something broken in my nextcloud snap package, I tried to cleanly uninstall and reinstalling it, but i’m faced with the following error:

error: cannot perform the following tasks:
- Remove data for snap "nextcloud" (42230) (failed to remove snap "nextcloud" base directory: remove /root/snap/nextcloud: directory not empty)

I don’t know what else to do, since trying to get rid of that directory just by “rm -rf” obviously gives me an error, since they are read-only files.

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. run sudo snap remove --purge nextcloud