(Solved) Unable to remove LibreOffice snap

I removed the LibreOffice snap but the system refuses to remove it:

sudo snap remove libreoffice
error: cannot perform the following tasks:

  • Remove data for snap “libreoffice” (180) (failed to remove snap “libreoffice” base directory: remove /var/snap/libreoffice: directory not empty)

/var/snap/libreoffice contains a single, empty directory named “120”, owned by root:

ls /var/snap/libreoffice -lah
total 9.5K
drwxr-xr-x 3 root root 3 Aug 10 17:36 .
drwxr-xr-x 41 root root 41 Jul 28 09:29 …
drwxr-xr-x 2 root root 2 Mar 13 2019 120

ls /var/snap/libreoffice/120/ -lah
total 1.0K
drwxr-xr-x 2 root root 2 Mar 13 2019 .
drwxr-xr-x 3 root root 3 Aug 10 17:36 …

Re-trying after re-enabling and even reinstalling the snap does not work, even after a system reboot.

That’s weird and unexpected, removing a snap first removes data of installed revisions (such as /var/snap/libreoffice/120/), then at the end removes the base directory (/var/snap/libreoffice). It’s unclear how it got to the removal of /var/snap/libreoffice without removing 120 first. As a workaround you can manually remove 120 there, and then retry snap remove.

Before doing that, for completeness, could you please reproduce the error and attach the output of:

  • snap list --all libreoffice
  • reproduce snap remove error, then attach the output of ‘snap change --last=remove’.

Thanks

Sure thing. BTW I seem to have revision 180, not 120 if that is worth something.

snap list --all libreoffice
Name Version Rev Tracking Publisher Notes
libreoffice 6.4.4.2 180 latest/stable canonical✓ -

snap remove libreoffice
error: cannot perform the following tasks:

  • Remove data for snap “libreoffice” (180) (failed to remove snap “libreoffice” base directory: remove /var/snap/libreoffice: directory not empty)

snap change --last=remove
Status Spawn Ready Summary
Undone today at 13:00 CEST today at 13:01 CEST Stop snap “libreoffice” services
Undone today at 13:00 CEST today at 13:01 CEST Run remove hook of “libreoffice” snap if present
Done today at 13:00 CEST today at 13:01 CEST Disconnect interfaces of snap “libreoffice”
Undone today at 13:00 CEST today at 13:00 CEST Save data of snap “libreoffice” in automatic snapshot set #14
Undone today at 13:00 CEST today at 13:00 CEST Remove aliases for snap “libreoffice”
Done today at 13:00 CEST today at 13:00 CEST Make snap “libreoffice” unavailable to the system
Undone today at 13:00 CEST today at 13:00 CEST Remove security profile for snap “libreoffice” (180)
Error today at 13:00 CEST today at 13:00 CEST Remove data for snap “libreoffice” (180)
Hold today at 13:00 CEST today at 13:00 CEST Remove snap “libreoffice” (180) from the system
Undone today at 13:00 CEST today at 13:01 CEST Disconnect libreoffice:home from core:home
Undone today at 13:00 CEST today at 13:01 CEST Disconnect libreoffice:opengl from core:opengl
Undone today at 13:00 CEST today at 13:00 CEST Disconnect libreoffice:unity7 from core:unity7
Undone today at 13:00 CEST today at 13:01 CEST Disconnect libreoffice:x11 from core:x11
Undone today at 13:00 CEST today at 13:01 CEST Disconnect libreoffice:sound-themes from gtk-common-themes:sound-themes
Undone today at 13:00 CEST today at 13:01 CEST Disconnect libreoffice:wayland from core:wayland
Undone today at 13:00 CEST today at 13:01 CEST Disconnect libreoffice:pulseaudio from core:pulseaudio
Undone today at 13:00 CEST today at 13:01 CEST Disconnect libreoffice:gtk-3-themes from gtk-common-themes:gtk-3-themes
Undone today at 13:00 CEST today at 13:01 CEST Disconnect libreoffice:network-bind from core:network-bind
Undone today at 13:00 CEST today at 13:01 CEST Disconnect libreoffice:desktop-legacy from core:desktop-legacy
Undone today at 13:00 CEST today at 13:01 CEST Disconnect libreoffice:desktop from core:desktop
Undone today at 13:00 CEST today at 13:01 CEST Disconnect libreoffice:screen-inhibit-control from core:screen-inhibit-control
Undone today at 13:00 CEST today at 13:01 CEST Disconnect libreoffice:gsettings from core:gsettings
Undone today at 13:00 CEST today at 13:01 CEST Disconnect libreoffice:cups-control from core:cups-control
Undone today at 13:00 CEST today at 13:01 CEST Disconnect libreoffice:removable-media from core:removable-media
Undone today at 13:00 CEST today at 13:01 CEST Disconnect libreoffice:network from core:network
Undone today at 13:00 CEST today at 13:01 CEST Disconnect libreoffice:icon-themes from gtk-common-themes:icon-themes
Undone today at 13:00 CEST today at 13:01 CEST Disconnect libreoffice:gnome-3-28-1804 from gnome-3-28-1804:gnome-3-28-1804
Undone today at 13:00 CEST today at 13:01 CEST Disconnect libreoffice:audio-playback from core:audio-playback


Remove data for snap “libreoffice” (180)

2020-08-11T13:00:58+02:00 ERROR failed to remove snap “libreoffice” base directory: remove /var/snap/libreoffice: directory not empty

It almost looks like this “120” directory is a previous revision leftover that now prevents the removal or something like that. It is still empty.

Thanks!

Yes, exactly, something went wrong earlier and nothing will remove “120” anymore. “120” seems like a long time ago so evidence may be lost, but could you check snap changes for any older changes that could have affected libreoffice? This could be e.g. a change with “Auto-refresh…” in the summary. If you find a suspicious change, please paste its details again (i.e. snap change <ID of the change>).

I guess that would be worthwhile fixing, it is an irrelevant, empty directory so it seems and this condition would remain.

Only recent things appear:

snap changes
ID Status Spawn Ready Summary
411 Done yesterday at 14:03 CEST yesterday at 14:03 CEST Auto-refresh snap “remmina”
412 Error yesterday at 17:33 CEST yesterday at 17:34 CEST Remove “libreoffice” snap
413 Error yesterday at 17:34 CEST yesterday at 17:34 CEST Remove “libreoffice” snap
414 Done yesterday at 17:35 CEST yesterday at 17:35 CEST Enable “libreoffice” snap
415 Error yesterday at 17:35 CEST yesterday at 17:36 CEST Remove “libreoffice” snap
416 Done today at 11:24 CEST today at 11:25 CEST Refresh snaps “core”, “lxd”
417 Error today at 11:28 CEST today at 11:28 CEST Remove “libreoffice” snap
418 Done today at 12:59 CEST today at 12:59 CEST Enable “libreoffice” snap
419 Error today at 13:00 CEST today at 13:01 CEST Remove “libreoffice” snap

Can I make “snap changes” go back further?

No, unfortunately not, they are purged after some days.

Yes, I agree. I’ll look into it. Thanks for reporting.

I can confirm just deleting the directory is the workaround/fix to get out of this.

Thanks for following up so quickly.

~# snap enable libreoffice
libreoffice enabled
~# rmdir /var/snap/libreoffice/120
~# snap remove libreoffice
libreoffice removed
~# snap list --all libreoffice
error: no matching snaps installed

1 Like