Configure number of old revisions to keep

I have a system with a small SSD. I would like some configurable policy for automatic removal of old snap versions.

It is annoying to require the user to ‘snap list --all’ and then iterate ‘snap remove --revision #### $snapname’ for each old version that is hanging around when they notice that disk space is low.

I know old versions are kept so that ‘snap revert’ works, but I would like to see a sensible default and tunable controlling retention of disabled snaps.

2 Likes

snapd only keeps three revisions. Are you seeing more?

I had three. I didn’t see a reason for keeping two old core snaps, especially given how old the 3rd was. I felt that 2 would have been sufficient.

We can surely look at making this configurable. I won’t be able to give you a timeline for this yet, but adding to the backlog.

Has there been any progress investigating adding support for a configurable number of snap revisions to store?

1 Like

I too would like to see some way to snap purge to remove old releases. My disk is full and it feels like 1999 to be using tools like ncdu and du to micro-manage the space.

1 Like

I should’ve updated this when the code landed (I thought I had! maybe it’s somewhere else but I can’t find it).

You can configure the number of revisions to keep with

snap set system refresh.retain=N

N can’t be less than 2, for now at least.

2 Likes