Aptitude does not want to autoremove Linux kernel, while apt wants

Bug #1772688 reported by Dmitry Lapshin on 2018-05-22
This bug affects 2 people
Affects Status Importance Assigned to Milestone
aptitude (Ubuntu)

Bug Description

From some update last year or so, apt has achived the tools to remove old Linux kernels via /etc/kernel/postinst.d/apt-auto-removal. This is really great, but for some reason, all apt tools agree on this (apt-get autoremove, apt autoremove), but aptitude does not.

For example, here I have an installation where 4.15.0-20 is safe for deinstallation, and generated by script above config agrees:

  $ LANG=C apt --dry-run autoremove
  NOTE: This is only a simulation!
        apt needs root privileges for real execution.
        Keep also in mind that locking is deactivated,
        so don't depend on the relevance to the real current situation!
  Reading package lists... Done
  Building dependency tree
  Reading state information... Done
  The following packages will be REMOVED:
    linux-cloud-tools-4.15.0-20 linux-cloud-tools-4.15.0-20-generic linux-headers-4.15.0-20
    linux-headers-4.15.0-20-generic linux-image-4.15.0-20-generic linux-modules-4.15.0-20-generic
    linux-modules-extra-4.15.0-20-generic linux-tools-4.15.0-20 linux-tools-4.15.0-20-generic
  0 upgraded, 0 newly installed, 9 to remove and 0 not upgraded.
  Remv linux-cloud-tools-4.15.0-20-generic [4.15.0-20.21]
  Remv linux-cloud-tools-4.15.0-20 [4.15.0-20.21]
  Remv linux-headers-4.15.0-20-generic [4.15.0-20.21] <--- Those
  Remv linux-headers-4.15.0-20 [4.15.0-20.21] <--- little
  Remv linux-modules-extra-4.15.0-20-generic [4.15.0-20.21]
  Remv linux-image-4.15.0-20-generic [4.15.0-20.21] <--- buggers
  Remv linux-modules-4.15.0-20-generic [4.15.0-20.21] <--- here!
  Remv linux-tools-4.15.0-20-generic [4.15.0-20.21]
  Remv linux-tools-4.15.0-20 [4.15.0-20.21]

but aptitude does not:

  $ LANG=C aptitude --simulate safe-upgrade
  The following packages will be REMOVED:
    linux-cloud-tools-4.15.0-20{u} linux-cloud-tools-4.15.0-20-generic{u}
    linux-modules-extra-4.15.0-20-generic{u} linux-tools-4.15.0-20{u}
  0 packages upgraded, 0 newly installed, 5 to remove and 0 not upgraded.
  Need to get 0 B of archives. After unpacking 178 MB will be freed.

  Note: Using 'Simulate' mode.
  Do you want to continue? [Y/n/?] y
  Would download/install/remove packages.

Removing modules-extra seems fine for it, though!
I have looked over all apt configs, there was no sign for me that aptitude was configured specificly to keep the images.

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: aptitude 0.8.10-6ubuntu1
ProcVersionSignature: Ubuntu 4.15.0-21.22-generic 4.15.17
Uname: Linux 4.15.0-21-generic x86_64
NonfreeKernelModules: nvidia_modeset nvidia
ApportVersion: 2.20.9-0ubuntu7
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Tue May 22 19:48:48 2018
InstallationDate: Installed on 2017-03-05 (443 days ago)
InstallationMedia: Ubuntu 16.04 LTS "Xenial Xerus" - Release amd64 (20160420.1)
 PATH=(custom, no user)
SourcePackage: aptitude
UpgradeStatus: Upgraded to bionic on 2018-05-03 (18 days ago)

Dmitry Lapshin (lapshin-dv) wrote :
Dmitry Lapshin (lapshin-dv) wrote :

Forgot one thing: if ask aptitude explicitly why linux-image-... is needed, it will reply that no reason for this package was found.

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in aptitude (Ubuntu):
status: New → Confirmed
Hans W (lucem) wrote :

Exactly the same here

Hans W (lucem) wrote :

Might be related to /etc/apt/apt.conf.d/01autoremove{,-kernels}?

Dmitry Lapshin (lapshin-dv) wrote :

It's actually the files that configure apt to do intended behavior, but somehow aptitude has it's own mind :/

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers