🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.user
Article #514

Re: APT::NeverAutoRemove::KernelCount "3"; Not quite working: I get more than three kernels

#514
From: Greg Wooledge
Date: Sun, 15 Nov 2026 13:50
55 lines
3900 bytes
On Sat, Nov 14, 2026 at 22:05:35 -0700, Charles Curley wrote:
> On Sat, 14 Nov 2026 21:51:35 -0500
> Greg Wooledge <greg@wooledge.org> wrote:
> > The setting you're looking at affects autoremove.  It doesn't
> > *trigger* an autoremove.  You still need to run it yourself.
> 
> Now you have me mystified. If I don't set
> APT::NeverAutoRemove::KernelCount then upgrades automatically install a
> new kernel. (I have linux-image-amd64 installed.) They also remove an
> old one, leaving me with the default net two kernels.
> 
> I don't think I have ever run "apt autoremove". I just did so on a
> machine with five kernels installed; none were removed.

Hmm.  Maybe it's a difference between apt-get and apt, then?  I usually
use apt-get, and it definitely doesn't do an autoremove for me.


hobbit:~$ apt-get -s upgrade
NOTE: This is only a simulation!
[...]
The following packages were automatically installed and are no longer required:
  enchant-2 ghp-import gir1.2-gtk-2.0 girepository-tools gsfonts gsfonts-x11
  [...]
Use 'apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.


I don't do autoremoves on that system.  On others where I do use it, it
has always (so far) kept only the 2 latest kernels, as expected.

> The current linux-image-amd64 depends on
> linux-image-6.12.117+deb13-amd64. So if autoremove worked on kernels,
> should it have removed all the kernels except
> linux-image-6.12.117+deb13-amd64? Maybe it makes an exception for
> kernels?

Well... there's /etc/apt/apt.conf.d/01autoremove which contains

  NeverAutoRemove
  {
        "^firmware-linux.*";
        "^linux-firmware$";
        "^linux-image-[a-z0-9]*$";
        "^linux-image-[a-z0-9]*-[a-z0-9]*$";
  };

So if you've got custom kernels whose package names match one of those
regexes, they're untouchable.

If your kernels are from Debian (and therefore don't match any of those
regexes), then they should be counted by the KernelCount variable as far
as I'm aware.

How *exactly* did you configure this variable?
Technical Details
Message-ID: <NZIMh-c35e-3@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod
References: <NZvYJ-bW04-11@gated-at.bofh.it> <NZyDf-bXfH-5@gated-at.bofh.it> <NZAF3-bYAN-1@gated-at.bofh.it>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod
From: Greg Wooledge <greg@wooledge.org>
Newsgroups: linux.debian.user
Subject: Re: APT::NeverAutoRemove::KernelCount "3"; Not quite working: I get  more than three kernels
Date: Sun, 15 Nov 2026 14:50:01 +0100
Message-ID: <NZIMh-c35e-3@gated-at.bofh.it>
References: <NZvYJ-bW04-11@gated-at.bofh.it> <NZyDf-bXfH-5@gated-at.bofh.it> <NZAF3-bYAN-1@gated-at.bofh.it>
X-Original-To: Charles Curley <charlescurley@charlescurley.com>
X-Mailbox-Line: From debian-user-request@lists.debian.org  Sun Nov 15 13:43:05 2026
Old-Return-Path: <greg@wooledge.org>
X-Amavis-Spam-Status: No, score=-1.9 tagged_above=-10000 required=5.3
 tests=[BAYES_00=-1.9] autolearn=ham autolearn_force=no
X-Policyd-Weight: using cached result; rate: -4.6
Mail-Followup-To: Charles Curley <charlescurley@charlescurley.com>,
	Debian Users <debian-user@lists.debian.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
X-Mailing-List: <debian-user@lists.debian.org> archive/latest/832899
List-ID: <debian-user.lists.debian.org>
List-URL: <https://lists.debian.org/debian-user/>
List-Archive: https://lists.debian.org/msgid-search/avm2v9BeMGRZx__7@wooledge.org
Approved: robomod@news.nic.it
Lines: 55
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Cc: Debian Users <debian-user@lists.debian.org>
X-Original-Date: Sun, 15 Nov 2026 08:42:23 -0500
X-Original-Message-ID: <avm2v9BeMGRZx__7@wooledge.org>
X-Original-References: <20261114170142.1a7283e6@hawk.localdomain>
 <avkeN-Tw0ppxgzqc@wooledge.org>
 <20261114220535.588a318e@peregrine.localdomain>