0

Is there a way to set maximum number of previous kernel and snap file versions preserved while doing system updates? I noticed that my hard drive usage was increasing automatically. I did a brute force deletion of kernel sources, modules, files in /boot, trimmed grub.cfg, and with sudo snap remove foo. It is a tedious and dangerous process, and I hope there is a safe, system-wide setting to do the same for the updates.

karel
  • 114,770
Janos
  • 951
  • 3
  • 12
  • 24
  • 1
    The setting is already there if you are using Ubuntu. Only 2 kernels are kept. – Pilot6 Jul 09 '22 at 13:22
  • Those limits are already in place in both apt and in snapd in all supported releases of Ubuntu. The question is how did you evade or disable those limits? Doing so is not easy; requires research and effort. – user535733 Jul 09 '22 at 15:22
  • @user535733 - I don't know how and when. Maybe when upgraded from 18 to 20.04? Recently I try not to fiddle with defaults just apply updates. If there is such setting then where is it, what did I evade? – Janos Jul 10 '22 at 15:08
  • Edit your question to include actual terminal output that clearly shows the problem you want help with. Sometimes the problem turns out to be entirely different --or easily fixed-- when we see actual output. Summaries and descriptions can be (unintentionally) misleading since we're not in the same room looking at your screen. – user535733 Jul 10 '22 at 15:14
  • @user535733 I noticed that my hard drive usage was way up, so I did a "df" then a "sudo du -h --max-depth=1 /" finding Gigs in /var, /snap, /usr and in /boot. Then I checked /usr/lib/modules/ and discovered modules from bunch of old kernels. Consequently I did a brute fore cleaning mentioned in my original question. Apparently the automatic cleaning did not work - something "evaded" it. Anyway, let us put this question to sleep until the next update comes. – Janos Jul 11 '22 at 16:36
  • Maybe I "evaded" it by using Discover for update. Discover just keeps adding new stuff without removing stale old stuff. i.e Software Updater already sees the updates made by Discover and therefore does not do the clean-up. – Janos Jul 12 '22 at 13:17

0 Answers0