In my ubuntu 22.04, I mainly use snap pacakages but whenever an snap is update it's old pacakage still remains, how can I remove that
-
That's not a bug; it's a feature. The older version is supposed to remain in case the newer fails for some reason.– user535733Jun 28, 2022 at 13:09
-
So whenever an new update older version, will still be there or will the older versions be automatically removed.– ABHILASH TJun 28, 2022 at 13:23
1 Answer
Snap retains a minimum of two old application versions, the documentation doesn't say why but we should assume it's to easily roll back if you encounter an issue.
https://snapcraft.io/docs/keeping-snaps-up-to-date#heading--refresh-retain
You can use sudo snap set system refresh.retain=2
to set it to the minimum value and snap will automatically remove the older versions. However, since 2018 this is already the default for Ubuntu so it likely won't make any difference.
If that doesn't help and you're low on space, this answer lists a script for removing old versions that you could try.
-
1
retain=2
became the default setting in 2018. The command is useful only for systems that pre-date the change. Jun 28, 2022 at 13:39