Snap remove taking forever; abort wasn't working

I didn’t know about snap abort till now, so I rebooted my VM.

After reboot, snap abort --last remove would appear to work, but the state is still there.

$ sudo snap changes
ID   Status  Spawn               Ready               Summary
226  Done    today at 12:33 EDT  today at 12:34 EDT  Auto-refresh snap "firefox_edge"
227  Error   today at 12:42 EDT  today at 12:42 EDT  Revert "steam" snap
228  Hold    today at 12:46 EDT  today at 12:52 EDT  Remove "steam" snap
229  Hold    today at 12:55 EDT  today at 12:58 EDT  Remove "steam" snap
230  Done    today at 12:58 EDT  today at 12:58 EDT  Enable "steam" snap
231  Undo    today at 12:59 EDT  -                   Remove "steam" snap

I was trying to uninstall and reinstall Steam on my VM (workaround to this).

I managed to do it by

sudo rm /var/lib/snapd/state.json
sudo systemctl restart snapd

Although it seems the list of Snaps got cleared as a result

$ snap list
Name                    Version          Rev    Tracking            Publisher   Notes
bare                    1.0              5      latest/stable       canonical✓  base
core24                  20250829         1196   latest/stable       canonical✓  base
gaming-graphics-core24  25.2.2~kisak1~n  13     kisak-fresh/stable  canonical✓  -
gtk-common-themes       0.1-81-g442e511  1535   latest/stable       canonical✓  -
snapd                   2.71             25202  latest/stable       canonical✓  snapd
steam                   1.0.0.84         224    latest/stable/…     canonical✓  -

Trying to install some of them

$ sudo snap install firefox --channel beta/core24
error: cannot perform the following tasks:
- Mount snap "gnome-46-2404" (125) (cannot proceed, expected snap "gnome-46-2404" revision 125 to be mounted but is not)
$ sudo snap install gnome-46-2404
gnome-46-2404 0+git.4ca00c0-sdk0+git.df43897 from Canonical✓ installed

Some worked, like Firefox & Bitwarden

Shotwell, however, didn’t (EDIT: re-running works)

$ sudo snap install shotwell
error: cannot perform the following tasks:
- Mount snap "shotwell" (20) (cannot proceed, expected snap "shotwell" revision 20 to be mounted but is not)
$ sudo snap remove shotwell
snap "shotwell" is not installed
$ ls -l /var/snap/
total 0
drwxr-xr-x 1 root root 34 Aug 25 22:24 ark
drwxr-xr-x 1 root root 28 Oct 11 13:40 bare
drwxr-xr-x 1 root root 38 Sep 20 15:07 bitwarden
drwxr-xr-x 1 root root 32 Mar  9  2025 bpytop
drwxr-xr-x 1 root root 44 Oct 10 00:08 brave
drwxr-xr-x 1 root root 38 Oct 10 00:08 btop
drwxr-xr-x 1 root root 46 Aug 18 03:21 core
drwxr-xr-x 1 root root 42 Sep 24 23:05 core18
drwxr-xr-x 1 root root 42 Sep 27 00:43 core20
drwxr-xr-x 1 root root 42 Sep 20 15:07 core22
drwxr-xr-x 1 root root 42 Oct 11 13:40 core24
drwxr-xr-x 1 root root 42 Oct  4 01:00 cups
drwxr-xr-x 1 root root 34 Oct 10 00:08 desktop-security-center
drwxr-xr-x 1 root root 38 Aug 25 22:23 ffmpeg-2404
drwxr-xr-x 1 root root 50 Oct  7 01:05 firefox
drwxr-xr-x 1 root root 42 Oct 11 12:34 firefox_edge
drwxr-xr-x 1 root root 38 Aug 17 23:26 gaming-graphics-core22
drwxr-xr-x 1 root root 30 Oct 11 13:41 gaming-graphics-core24
drwxr-xr-x 1 root root 32 Mar  9  2025 gnome-3-28-1804
drwxr-xr-x 1 root root 38 Sep 27 00:43 gnome-42-2204
drwxr-xr-x 1 root root 44 Sep  7 09:15 gnome-46-2404
drwxr-xr-x 1 root root 34 Oct 11 13:41 gtk-common-themes
drwxr-xr-x 1 root root 38 Jul  8 22:43 gwenview
drwxr-xr-x 1 root root 34 Apr 20 21:24 haruna
drwxr-xr-x 1 root root 28 Mar  9  2025 icon-theme-breeze
drwxr-xr-x 1 root root 38 Aug 25 22:24 kate
drwxr-xr-x 1 root root 38 Aug 25 22:24 kdenlive
drwxr-xr-x 1 root root 34 Aug  9 12:05 kf6-core24
drwxr-xr-x 1 root root 42 Sep 27 21:08 mesa-2404
drwxr-xr-x 1 root root 38 Mar 30  2025 nvtop
drwxr-xr-x 1 root root 42 Sep 27 00:43 obs-studio
drwxr-xr-x 1 root root 38 Oct 10 00:08 prompting-client
drwxr-xr-x 1 root root 42 Sep 20 15:07 rustup
drwxr-xr-x 1 root root 34 Jul  5 04:19 shotwell
drwxr-xr-x 1 root root 34 Sep  3 22:30 skanpage
drwxr-xr-x 1 root root 66 Oct 11 13:40 snapd
drwxr-xr-x 1 root root 38 Jul  5 04:18 snapd-desktop-integration
drwxr-xr-x 1 root root 42 Oct 10 00:13 snap-store
drwxr-xr-x 1 root root 32 Oct 11 13:41 steam
drwxr-xr-x 1 root root 34 Mar 27  2025 vlc

That wiped all info snapd has about any snaps on your system without actually removing the mount units, the systemd service units, the apparmor profiles and whatever else gets generated on the fly by snapd/systemd interaction when installing a snap …

so you created a very broken state for your system now where snapd does not know what is installed and what is not (and thanks to things still being mounted or in case of services even still being running, you might hit many issues when trying to re-install any snaps) …

yea learned that the hard way haha

at least, its a VM, and reinstalling is easy enough

For snaps like Steam you can use snap remove steam --purge to skip the backup process thats likely contributing to the delay, on the assumption most the data can be easily downloaded again later.

I wouldn’t recommend people do this generally, those backups can be handy. --purge doesn’t delete more than what would otherwise happen, it just deletes it instantly, without a cooldown.

1 Like

Hi

yep. That is probably why I refrained to remove the state.json file. I was afraid something would go wrong.

But HOW DO YOU FIX THE PROBLEM?

Note that ‘snap abort’ does not do anything, after all of this was caused by a ‘snap remove’ that just hanged with no clear reasons whatsoever.

I followed several threads at this point looking for a solution with no proper answer. Even the question “how do I remove snap from Ubuntu” had unclear (and scary) answers.

So the question is: what is the clear and safe fix?

I ended up manipulating its json file

I have the same problem. losslesscut was not functioning (maybe because of Wayland). snap remove losslesscut took ages and seemed to hang I aborted the command session, and now whatever I want to do (install, refresh, remove), I have the message : errorr : snap “losslesscut” has “remove-snap” change in progress So that I no longer have the programm, and cannot remove or reinstall it.

Could you elaborate about the changes done you did there? I have a similar problem :confused: .

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 your remove change has a “Run remove hook …” task that 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

2 Likes

Thank you @miguelpires

The instructions in the link worked.

All the best

Marco