"snap remove" failed due to non-empty base directory ($HOME/snap/$SNAP_NAME); how to recover?

Hello,

Yesterday I decided to remove my mattermost-desktop snap in favor of just using Mattermost via the web. Unfortunately, it hung.

Here is the timeline (based on my system’s local time, not UTC):

Yesterday:

  • 2025-12-11T15:51:14: Executed “snap remove mattermost-desktop”. This command would hang until I shut down my system.
  • 2025-12-11T15:51:54: Snapd logs show error: taskrunner.go:304: Change 64 task (Remove data for snap "mattermost-desktop" (820)) failed: failed to remove snap "mattermost-desktop" base directory: remove /home/$USER/snap/mattermost-desktop: directory not empty
  • 2025-12-11T16:53:15: Ran snap changes, identified ID 64 as being related to removal of the snap.
  • 2025-12-11T16:53:28: Ran sudo snap abort 64
  • Ran a few more times to check and see if it would undo - it did not.
  • 2025-12-11T16:54:02: Shut down the system since “abort” seemed to do nothing and the “snap remove” command was still hung.

Today:

  • Checked the snap list: was still there
  • Attempted both snap remove mattermost-desktop and snap remove --purge mattermost-desktop; these did not work either.
  • Again, retried snap changes and sudo snap abort 64, but no changes observed; the snap persists.
  • Finally, per reviewing other topics here, checked the snapd journalctl log to find the log entry mentioned above re: /home/$USER/snap/mattermost-desktop not being empty.

I have tried to force-remove things in the past, and one time in particular that particularly did not end well - so I’m asking for help here before I cause damage I cannot easily reverse.

Can anyone assist?

Also, in case it helps, here is my output from snap changes:

$ snap changes
ID   Status  Spawn                   Ready                   Summary
60   Done    yesterday at 15:01 PST  yesterday at 15:03 PST  Pre-download "firefox", "mattermost-desktop" for auto-refresh
61   Done    yesterday at 15:01 PST  yesterday at 15:02 PST  Auto-refresh snap "chromium"
62   Done    yesterday at 15:50 PST  yesterday at 15:50 PST  Auto-refresh snap "firefox"
63   Done    yesterday at 15:51 PST  yesterday at 15:51 PST  Auto-refresh snap "mattermost-desktop"
64   Undo    yesterday at 15:51 PST  -                       Remove "mattermost-desktop" snap

Additionally, journalctl logs with some minor redaction:

Dec 11 15:50:47 vultaire-thinkpad snapd[1757]: backend.go:285: reloading profiles of snap-confine provided by the system snap
Dec 11 15:50:54 vultaire-thinkpad snapd[1757]: storehelpers.go:916: cannot refresh snap "firefox": snap has no updates available
Dec 11 15:51:08 vultaire-thinkpad snapd[1757]: spec.go:312: renaming mount entry for directory "/snap/mattermost-desktop/820/gpu-2404" to "/snap/mattermost-desktop/820/gpu-2404-2" to avoid a clash
Dec 11 15:51:08 vultaire-thinkpad snapd[1757]: backend.go:285: reloading profiles of snap-confine provided by the system snap
Dec 11 15:51:14 vultaire-thinkpad snapd[1757]: storehelpers.go:916: cannot refresh snap "mattermost-desktop": snap has no updates available
Dec 11 15:51:18 vultaire-thinkpad snapd[1757]: spec.go:312: renaming mount entry for directory "/snap/mattermost-desktop/820/gpu-2404" to "/snap/mattermost-desktop/820/gpu-2404-2" to avoid a clash
Dec 11 15:51:19 vultaire-thinkpad snapd[1757]: backend.go:285: reloading profiles of snap-confine provided by the system snap
Dec 11 15:51:19 vultaire-thinkpad snapd[1757]: spec.go:312: renaming mount entry for directory "/snap/mattermost-desktop/820/gpu-2404" to "/snap/mattermost-desktop/820/gpu-2404-2" to avoid a clash
Dec 11 15:51:20 vultaire-thinkpad snapd[1757]: backend.go:285: reloading profiles of snap-confine provided by the system snap
Dec 11 15:51:20 vultaire-thinkpad snapd[1757]: spec.go:312: renaming mount entry for directory "/snap/mattermost-desktop/820/gpu-2404" to "/snap/mattermost-desktop/820/gpu-2404-2" to avoid a clash
Dec 11 15:51:21 vultaire-thinkpad snapd[1757]: backend.go:285: reloading profiles of snap-confine provided by the system snap
Dec 11 15:51:21 vultaire-thinkpad snapd[1757]: spec.go:312: renaming mount entry for directory "/snap/mattermost-desktop/820/gpu-2404" to "/snap/mattermost-desktop/820/gpu-2404-2" to avoid a clash
Dec 11 15:51:22 vultaire-thinkpad snapd[1757]: backend.go:285: reloading profiles of snap-confine provided by the system snap
Dec 11 15:51:22 vultaire-thinkpad snapd[1757]: spec.go:312: renaming mount entry for directory "/snap/mattermost-desktop/820/gpu-2404" to "/snap/mattermost-desktop/820/gpu-2404-2" to avoid a clash
Dec 11 15:51:23 vultaire-thinkpad snapd[1757]: spec.go:312: renaming mount entry for directory "/snap/mattermost-desktop/820/gpu-2404" to "/snap/mattermost-desktop/820/gpu-2404-2" to avoid a clash
Dec 11 15:51:24 vultaire-thinkpad snapd[1757]: backend.go:285: reloading profiles of snap-confine provided by the system snap
Dec 11 15:51:24 vultaire-thinkpad snapd[1757]: spec.go:312: renaming mount entry for directory "/snap/mattermost-desktop/820/gpu-2404" to "/snap/mattermost-desktop/820/gpu-2404-2" to avoid a clash
Dec 11 15:51:25 vultaire-thinkpad snapd[1757]: spec.go:312: renaming mount entry for directory "/snap/mattermost-desktop/820/gpu-2404" to "/snap/mattermost-desktop/820/gpu-2404-2" to avoid a clash
Dec 11 15:51:25 vultaire-thinkpad snapd[1757]: backend.go:285: reloading profiles of snap-confine provided by the system snap
Dec 11 15:51:26 vultaire-thinkpad snapd[1757]: spec.go:312: renaming mount entry for directory "/snap/mattermost-desktop/820/gpu-2404" to "/snap/mattermost-desktop/820/gpu-2404-2" to avoid a clash
Dec 11 15:51:26 vultaire-thinkpad snapd[1757]: backend.go:285: reloading profiles of snap-confine provided by the system snap
Dec 11 15:51:26 vultaire-thinkpad snapd[1757]: spec.go:312: renaming mount entry for directory "/snap/mattermost-desktop/820/gpu-2404" to "/snap/mattermost-desktop/820/gpu-2404-2" to avoid a clash
Dec 11 15:51:27 vultaire-thinkpad snapd[1757]: spec.go:312: renaming mount entry for directory "/snap/mattermost-desktop/820/gpu-2404" to "/snap/mattermost-desktop/820/gpu-2404-2" to avoid a clash
Dec 11 15:51:27 vultaire-thinkpad snapd[1757]: backend.go:285: reloading profiles of snap-confine provided by the system snap
Dec 11 15:51:28 vultaire-thinkpad snapd[1757]: spec.go:312: renaming mount entry for directory "/snap/mattermost-desktop/820/gpu-2404" to "/snap/mattermost-desktop/820/gpu-2404-2" to avoid a clash
Dec 11 15:51:28 vultaire-thinkpad snapd[1757]: spec.go:312: renaming mount entry for directory "/snap/mattermost-desktop/820/gpu-2404" to "/snap/mattermost-desktop/820/gpu-2404-2" to avoid a clash
Dec 11 15:51:29 vultaire-thinkpad snapd[1757]: backend.go:285: reloading profiles of snap-confine provided by the system snap
Dec 11 15:51:29 vultaire-thinkpad snapd[1757]: spec.go:312: renaming mount entry for directory "/snap/mattermost-desktop/820/gpu-2404" to "/snap/mattermost-desktop/820/gpu-2404-2" to avoid a clash
Dec 11 15:51:29 vultaire-thinkpad snapd[1757]: backend.go:285: reloading profiles of snap-confine provided by the system snap
Dec 11 15:51:29 vultaire-thinkpad snapd[1757]: spec.go:312: renaming mount entry for directory "/snap/mattermost-desktop/820/gpu-2404" to "/snap/mattermost-desktop/820/gpu-2404-2" to avoid a clash
Dec 11 15:51:29 vultaire-thinkpad snapd[1757]: backend.go:285: reloading profiles of snap-confine provided by the system snap
Dec 11 15:51:30 vultaire-thinkpad snapd[1757]: spec.go:312: renaming mount entry for directory "/snap/mattermost-desktop/820/gpu-2404" to "/snap/mattermost-desktop/820/gpu-2404-2" to avoid a clash
Dec 11 15:51:30 vultaire-thinkpad snapd[1757]: backend.go:285: reloading profiles of snap-confine provided by the system snap
Dec 11 15:51:31 vultaire-thinkpad snapd[1757]: backend.go:285: reloading profiles of snap-confine provided by the system snap
Dec 11 15:51:31 vultaire-thinkpad snapd[1757]: backend.go:285: reloading profiles of snap-confine provided by the system snap
Dec 11 15:51:32 vultaire-thinkpad runuser[63618]: pam_unix(runuser:session): session opened for user $USER(uid=$UID) by (uid=0)
Dec 11 15:51:52 vultaire-thinkpad runuser[63618]: pam_unix(runuser:session): session closed for user $USER
Dec 11 15:51:54 vultaire-thinkpad snapd[1757]: taskrunner.go:304: Change 64 task (Remove data for snap "mattermost-desktop" (820)) failed: failed to remove snap "mattermost-desktop" base directory: remove /home/$USER/snap/mattermost-desktop: directory not empty
Dec 11 15:51:55 vultaire-thinkpad snapd[1757]: backend.go:285: reloading profiles of snap-confine provided by the system snap
Dec 11 15:51:55 vultaire-thinkpad snapd[1757]: backend.go:285: reloading profiles of snap-confine provided by the system snap
Dec 11 15:51:55 vultaire-thinkpad snapd[1757]: backend.go:285: reloading profiles of snap-confine provided by the system snap

Hi.

This might be the same issue observed in Bug #2130315 “error: snap “thunderbird” has “remove-snap” change…” : Bugs : snapd package : Ubuntu

There was a bug in undoing failed removals that could cause the change to hang. This was fixed in 2.73 which is currently in beta. If you’re still experiencing this issue (the “Run remove hook …” task is stuck in “Undo”), please follow the steps in Comment #16 : Bug #2130315 : Bugs : snapd package : Ubuntu to unblock it and move to 2.73.

Thanks,

Miguel

Hi Miguel,

Thank you. This has helped.

  • Using the process you shared, I removed the offending change and switched to snapd beta channel (2.73, as described).
  • I retried a removal - this time using --purge from the start - and I am still failing to remove, however this time it did not hang.

Here is what I see re: relevant output:

$ sudo snap remove --purge mattermost-desktop
error: cannot perform the following tasks:
- Remove data for snap "mattermost-desktop" (820) (failed to remove snap "mattermost-desktop" base directory: remove /home/$USER/snap/mattermost-desktop: directory not empty)
$ snap changes
ID   Status  Spawn               Ready               Summary
65   Done    today at 07:07 PST  today at 07:08 PST  Auto-refresh snaps "cups", "kubectl"
66   Done    today at 07:32 PST  today at 07:33 PST  Refresh "snapd" snap from "latest/beta" channel
67   Error   today at 07:33 PST  today at 07:33 PST  Remove "mattermost-desktop" snap

After this, I could do the following to finish the removal:

$ rm -rf /home/$USER/snap/mattermost-desktop
$ sudo snap remove --purge mattermost-desktop

And with that, I could remove the problematic snap.

Thank you!

2 Likes