[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#981470: Old kernels piling up



On Sun, Jan 31, 2021 at 10:52:24PM +0100, Julian Andres Klode wrote:
> On Mon, Feb 01, 2021 at 01:02:47AM +0800, 積丹尼 Dan Jacobson wrote:
> > Package: apt
> > Version: 2.1.18
> > Severity: minor
> > 
> > I'm not sure if these are getting removed automatically correctly ever:
> > 
> > linux-image-5.10.0-1-amd64:amd64 5.10.5-1 installed: No available version in archive
> > linux-image-5.9.0-2-amd64:amd64 5.9.6-1 installed: No available version in archive
> > linux-image-5.9.0-4-amd64:amd64 5.9.11-1 installed: No available version in archive
> > linux-image-5.9.0-5-amd64:amd64 5.9.15-1 installed: No available version in archive
> 
> Your output of apt autoremove you showed later shows that it works:
> 
> Found kernel 5.9.0-5-amd64(5.9.15-1)
> Found kernel 5.9.0-4-amd64(5.9.11-1)
> Found kernel 5.9.0-2-amd64(5.9.6-1)
> Found kernel 5.10.0-1-amd64(5.10.5-1)
> Found kernel 5.10.0-2-amd64(5.10.9-1)
> Keeping booted kernel 5.10.9-1
> Keeping installed kernel 5.10.9-1
> Keeping latest kernel 5.10.9-1
> Keeping previous kernel 5.10.5-1
> [...]
> The following packages will be REMOVED:
>   linux-image-5.9.0-2-amd64* linux-image-5.9.0-4-amd64*
>     linux-image-5.9.0-5-amd64*
>     0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
> 
> Automatic kernel removal is part of autoremove, or apt{,-get}
> {dist,full}-upgrade, not any other commands.
> 
> Not sure what's up with aptitude though, that does not
> remove the command (sample from my Ubuntu system). I assume that's what you normally use and where you expected the removal to happen?
> 
> root@jak-t480s:/etc# yes n | aptitude remove
> The following packages will be REMOVED:
>   libmysqlclient21{u} libmysqlclient21:i386{u} libphonenumber7{u} libsnmp35{u} libsnmp35:i386{u} mysql-common{u}
> 0 packages upgraded, 0 newly installed, 6 to remove and 0 not upgraded.
> Need to get 0 B of archives. After unpacking 23,5 MB will be freed.
> Do you want to continue? [Y/n/?] Abort.
> root@jak-t480s:/etc# yes n | apt autoremove
> Reading package lists... Done
> Building dependency tree
> Reading state information... Done
> The following packages will be REMOVED:
>   libmysqlclient21 libmysqlclient21:i386 libphonenumber7 libsnmp35 libsnmp35:i386 linux-image-5.8.0-42-generic linux-modules-5.8.0-42-generic mysql-common
> 0 upgraded, 0 newly installed, 8 to remove and 0 not upgraded.
> After this operation, 115 MB disk space will be freed.
> Do you want to continue? [Y/n] Abort.
> 
> # ... apt autoremove ...
> Auto-Installed : linux-image-5.8.0-42-generic:amd64
> AutoDep: linux-image-5.8.0-42-generic:amd64
> Garbage: linux-image-5.8.0-42-generic:amd64
> 
> # ... aptitude remove ....
> 
> AutoDep: linux-image-5.8.0-42-generic:amd64
> Marking: linux-image-5.8.0-42-generic:amd64 5.8.0-42.47 (Blacklisted [APT::NeverAutoRemove])
> Following dep: linux-image-5.8.0-42-generic:amd64 Depends on linux-modules-5.8.0-42-generic:amd64 < 5.8.0-42.47 @ii K >
> Following dep: linux-image-5.8.0-42-generic:amd64 Recommends on linux-initramfs-tool:amd64 < none @un H >, provided by initramfs-tools:amd64 0.137ubuntu12 (1/1)
> 
> This is odd, why does aptitude see it blacklisted, and apt not? Need to do some digging at some point.

Aptitude defines its own root set func

[...] AptitudeInRootSetFunc [...]
[...]
    std::string matchterm = aptcfg->Find(PACKAGE "::Keep-Unused-Pattern", "~nlinux-image-.*");

So it does not respect any of the apt autoremove settings. Or well, it
keeps _all_ kernels installed (it does chain to the apt one) - setting
aptitude::Keep-Unused-Pattern to ~F should fix it.

Probably the default should change, that kernel keeping bit is probably
from decades ago when we did not have the kernel keep logic in apt.

Shall we reassign this bug there, is this what you were after?

-- 
debian developer - deb.li/jak | jak-linux.org - free software dev
ubuntu core developer                              i speak de, en


Reply to: