apt doesn't correctly fill APT::NeverAutoRemove

Bug #1427910 reported by nimnull
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
apt (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

After kernel update I have 3 kernel packages:
ii linux-headers-3.13.0-43
ii linux-headers-3.13.0-45
ii linux-headers-3.13.0-43-generic
ii linux-headers-3.13.0-45-generic
ii linux-headers-3.13.0-46
ii linux-headers-3.13.0-46-generic
ii linux-headers-generic 3.13.0.46.53
ii linux-image-3.13.0-43-generic
ii linux-image-3.13.0-45-generic
ii linux-image-3.13.0-46-generic
ii linux-image-extra-3.13.0-43-generic
ii linux-image-extra-3.13.0-45-generic
ii linux-image-extra-3.13.0-46-generic

And apt-config dump | grep linux returns:

APT::NeverAutoRemove:: "^linux-image-3\.13\.0-45-generic$";
APT::NeverAutoRemove:: "^linux-image-3\.13\.0-46-generic$";
APT::NeverAutoRemove:: "^linux-headers-3\.13\.0-45-generic$";
APT::NeverAutoRemove:: "^linux-headers-3\.13\.0-46-generic$";
APT::NeverAutoRemove:: "^linux-image-extra-3\.13\.0-45-generic$";
APT::NeverAutoRemove:: "^linux-image-extra-3\.13\.0-46-generic$";
APT::NeverAutoRemove:: "^linux-signed-image-3\.13\.0-45-generic$";
APT::NeverAutoRemove:: "^linux-signed-image-3\.13\.0-46-generic$";
APT::NeverAutoRemove:: "^linux-backports-modules-.*-3\.13\.0-45-generic$";
APT::NeverAutoRemove:: "^linux-backports-modules-.*-3\.13\.0-46-generic$";
APT::NeverAutoRemove:: "^linux-tools-3\.13\.0-45-generic$";
APT::NeverAutoRemove:: "^linux-tools-3\.13\.0-46-generic$";

Then I do:

apt-get purge linux-headers-3.13.0-43 linux-headers-3.13.0-43-generic linux-image-3.13.0-43-generic linux-image-extra-3.13.0-43-generic

Then again apt-config dump | grep linux returns:

APT::NeverAutoRemove:: "^linux-image-3\.13\.0-43-generic$";
APT::NeverAutoRemove:: "^linux-image-3\.13\.0-46-generic$";
APT::NeverAutoRemove:: "^linux-headers-3\.13\.0-43-generic$";
APT::NeverAutoRemove:: "^linux-headers-3\.13\.0-46-generic$";
APT::NeverAutoRemove:: "^linux-image-extra-3\.13\.0-43-generic$";
APT::NeverAutoRemove:: "^linux-image-extra-3\.13\.0-46-generic$";
APT::NeverAutoRemove:: "^linux-signed-image-3\.13\.0-43-generic$";
APT::NeverAutoRemove:: "^linux-signed-image-3\.13\.0-46-generic$";
APT::NeverAutoRemove:: "^linux-backports-modules-.*-3\.13\.0-43-generic$";
APT::NeverAutoRemove:: "^linux-backports-modules-.*-3\.13\.0-46-generic$";
APT::NeverAutoRemove:: "^linux-tools-3\.13\.0-43-generic$";
APT::NeverAutoRemove:: "^linux-tools-3\.13\.0-46-generic$";

It has 43 and 46.

Suppose to be two last versions 45 and 46, because I have them.

Apt doesn't work correctly.
It now suggests:

apt-get autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED
  linux-image-3.13.0-45-generic linux-image-extra-3.13.0-45-generic

It needs to be fixed.

Thank you in advance.

Tags: bot-comment
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. It seems that your bug report is not filed about a specific source package though, rather it is just filed against Ubuntu in general. It is important that bug reports be filed about source packages so that people interested in the package can find the bugs about it. You can find some hints about determining what package your bug might be about at https://wiki.ubuntu.com/Bugs/FindRightPackage. You might also ask for help in the #ubuntu-bugs irc channel on Freenode.

To change the source package that this bug is filed about visit https://bugs.launchpad.net/ubuntu/+bug/1427910/+editstatus and add the package name in the text box next to the word Package.

[This is an automated message. I apologize if it reached you inappropriately; please just reply to this message indicating so.]

tags: added: bot-comment
Revision history for this message
nimnull (macachuto) wrote :

apt 1.0.1ubuntu2.6 amd64

affects: ubuntu → apt (Ubuntu)
Revision history for this message
Launchpad Janitor (janitor) wrote :

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

Changed in apt (Ubuntu):
status: New → Confirmed
Revision history for this message
Doug Smythies (dsmythies) wrote :

autoremove seems to want to remove the second to last regular kernel on my systems also.
I always have a bunch of mainline kernels installed on my computers, and maybe that is the reason.

Example:

$ sudo apt-get autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  gconf-service gconf-service-backend gconf2 gconf2-common libavahi-glib1 libbonobo2-0 libbonobo2-common libcanberra0 libgconf-2-4 libgnome-2-0 libgnome2-common libgnomevfs2-0
  libgnomevfs2-common libllvm3.8 libmircommon5 liborbit-2-0 linux-headers-4.4.0-67 linux-headers-4.4.0-67-generic linux-headers-4.4.0-72 linux-headers-4.4.0-72-generic
  linux-headers-4.4.0-77 linux-headers-4.4.0-77-generic linux-headers-4.4.0-83 linux-headers-4.4.0-83-generic linux-headers-4.4.0-92 linux-headers-4.4.0-92-generic
  linux-image-4.4.0-67-generic linux-image-4.4.0-72-generic linux-image-4.4.0-77-generic linux-image-4.4.0-83-generic linux-image-4.4.0-92-generic linux-image-extra-4.4.0-67-generic
  linux-image-extra-4.4.0-72-generic linux-image-extra-4.4.0-77-generic linux-image-extra-4.4.0-83-generic linux-image-extra-4.4.0-92-generic sound-theme-freedesktop
0 upgraded, 0 newly installed, 37 to remove and 0 not upgraded.
After this operation, 1,535 MB disk space will be freed.
Do you want to continue? [Y/n] n
Abort.

The current regular kernel is 4.4.0-93 and I expect 4.4.0-92 to be left alone.
I am running servers 16.04.3 and apt 1.2.24.

Revision history for this message
Julian Andres Klode (juliank) wrote :

OK, so what does /etc/apt/apt.conf.d/01autoremove-kernels say in the "debug information" comment?

Revision history for this message
Doug Smythies (dsmythies) wrote :
Revision history for this message
Julian Andres Klode (juliank) wrote :

Well, Doug, it preserves the latest 2 kernels. You have several 4.13 and 4.10 builds, and 4.13 > 4.10 > 4.4.

# Last kernel: 4.13.0-rc7-stock-274
# Previous kernel: 4.13.0-rc5-stock-273

Note that your version number is wrong too, it should be ~rc7, not -rc7, otherwise 4.13.0-rc7-blah is larger than 4.13.0-blah (or 4.13.0-number-blah).

Revision history for this message
Doug Smythies (dsmythies) wrote :

> Well, Doug, it preserves the latest 2 kernels.
> You have several 4.13 and 4.10 builds, and 4.13 > 4.10 > 4.4.

Didn't it used to ignore manually installed kernels and only count automatically installed kernels?
This issue only came up about a year or two ago, I think.

> Note that your version number is wrong too,
> it should be ~rc7, not -rc7,

That is not under my control. And yes, I know it doesn't sort properly.

Revision history for this message
Julian Andres Klode (juliank) wrote :

As we found out, this is due to custom kernel packages, so I'm closing the bug.

Changed in apt (Ubuntu):
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.