Automatic snapshots, snap remove --purge proposal

With automatic snapshots feature landed and to be released with 2.39, snapd now creates a snapshot of the snap data and configuration automatically on snap remove and keeps it around for 31 days by default. It has been observed that because of that some snaps are now slow to remove if they create lots of data (one example is multipass snap, with 2GB+ of data).

While the feature can be disabled with snap set core snapshots.automatic.retention=no, it acts as a global flag. Therefore after a short discussion about the issue it has been proposed that remove command grows a new flag that disables automatic snapshot when removing the given snap only, e.g:

snap remove --purge myfatsnap

Any thoughs/suggestions about the new flag are welcome and if there is no disagreement, Iā€™ll implement it soon.

13 Likes

I support having a --purge flag, for exactly the case you described, removing multipass which generates gigabytes of data.

4 Likes

Sounds reasonable to me and I canā€™t think of any downsides to having this flag. The name of the flag seems obvious and a good choice.

Thanks for feddback! The tentative PR is here: https://github.com/snapcore/snapd/pull/6870

Thanks for this, I was just about to ask for just such a thing. The snap remove now takes too long for my tastes due to it creating a snapshot for the data.

One quick comment on this older item. Is this behaviour in the documents? I went searching for this as someone pointed out that a user would never know this behavior by default.

EDIT Found it. In the snapshot portion of the docs. I think itā€™s pretty deep in there for an average user though.

Edit 2 Iā€™m taking a Mulligan on this one. It is in the getting started guide as well

You have a point though, it should probably be documented (or referenced) close to snap remove as well. CC @degville

Thanks for flagging this (cc @bashfulrobot). Itā€™s an option that should definitely be more discoverable. Iā€™ve added it to the Getting started guide, and Iā€™ve also added some hopefully better navigation on that page to help see what information it includes. Iā€™ll add some quick details on snapshots too.

No problem. It just came up as I was having a friendly discussion with a user who tends to be a little negative towards the tech.

I would suggest that things that are critical to a users data may even warrant some visibility within the cli tool --help command. Maybe even under the ā€œremoveā€ button in gnome software.

The reality is, there are users who will not go search out the docs, or maybe even be a new user to Linux who may not realise where to go and look. So putting the data sensitive info into a spot that is maybe a little more intuitive - could be a good thing? ĀÆ_(惄)_/ĀÆ

I know that might be a stretch goal, or require other teams, but I am just spit-balling here.

Incidentally, the cli (snap remove --help) was updated just a few days ago with https://github.com/snapcore/snapd/pull/8782 (will become available with snapd 2.46 I suppose).

1 Like

perfect!

That is the first place I would hope to find it.

Btw, I couldnā€™t remove lxd at all due to this automatic snapshot thing. It tried to do something for several hours and then failed. Iā€™m glad Google took me here and --purge was an acceptable solution to a problem that shouldnā€™t exist.

Right, there are some extreme cases (lxd, multipassā€¦) where it would probably make sense to ask/warn about potentially huge snapshot (not doing automatic snapshots by default because of extreme cases isnā€™t a good idea IMHO; for users wanting that there is always ā€œsnapshots.automatic.retention=noā€ config option mentioned earlier).

FWTW, there are some other improvements in the works such as not attempting an automatic snapshot if disk space is low and doesnā€™t guarantee successful operation.

1 Like

this snapshot feature is a horrible thing, on servers this is ok (probably, but maybe not, what if it contains terrabytes of BLOBs or something) but for common users it is nightmare! I in UI just clicked remove for Steam app and it just hangs forever, tried aborting it - nothing! And about hour or two of my struggle led me here where I learned that when I remove an app it creates backup for it - seriously? - I want it to be removed! just removed! NOT TO CREATE A SNAPSHOT OF ABOUT HALF OF TERRABYTE!!! F*ck That is exactly why Linux has the reputation of being hard! No regard of user experience, I should not figure out all the internals of how things work - I have enough of that when I am at work.

At least a warning would be great.