🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.user
Article #518

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

#518
From: Charles Curley
Date: Sun, 15 Nov 2026 15:50
90 lines
6125 bytes
On Sun, 15 Nov 2026 08:42:23 -0500
Greg Wooledge <greg@wooledge.org> wrote:

> > 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.

root@peregrine:~# pre ux-im ; uname -r
linux-image-6.12.111+deb13-amd64	6.12.111-1		amd64
linux-image-6.12.113+deb13-amd64	6.12.113-1		amd64
linux-image-6.12.115+deb13.1-amd64	6.12.115-2		amd64
linux-image-6.12.116+deb13-amd64	6.12.116-1		amd64
linux-image-6.12.117+deb13-amd64	6.12.117-1		amd64
linux-image-amd64	6.12.117-1		amd64
6.12.117+deb13-amd64
root@peregrine:~# apt-get -s upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@peregrine:~# apt-get -s autoremove 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@peregrine:~# 




> 
> > 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.

No custom kernels here. Nor have I mucked with NeverAutoRemove.

> 
> How *exactly* did you configure this variable?

root@peregrine:/etc/apt/apt.conf.d# cat 40neverAutoRemove
# man apt.conf; less /usr/share/doc/apt/examples/configure-index

APT::NeverAutoRemove::KernelCount "3";
root@peregrine:/etc/apt/apt.conf.d# 



-- 
Does anybody read signatures any more?

https://charlescurley.com
https://charlescurley.com/blog/
Technical Details
Message-ID: <NZKEs-c49T-83@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> <NZIMh-c35e-3@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: Charles Curley <charlescurley@charlescurley.com>
Newsgroups: linux.debian.user
Subject: Re: APT::NeverAutoRemove::KernelCount "3"; Not quite working: I get  more than three kernels
Date: Sun, 15 Nov 2026 16:50:04 +0100
Message-ID: <NZKEs-c49T-83@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> <NZIMh-c35e-3@gated-at.bofh.it>
X-Mailbox-Line: From debian-user-request@lists.debian.org  Sun Nov 15 15:43:41 2026
Old-Return-Path: <charlescurley@charlescurley.com>
X-Amavis-Spam-Status: No, score=-0.752 tagged_above=-10000 required=5.3
 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
 DKIM_VALID_EF=-0.1, RCVD_IN_BL_SPAMCOP_NET=1.347, RCVD_IN_MSPIKE_H2=0.001]
 autolearn=no autolearn_force=no
X-Policyd-Weight: using cached result; rate: -3.5
X-Authority-Analysis: v=2.4 cv=JY+8rVKV c=1 sm=1 tr=0 ts=6af9d31d
 a=NgvI/wQFGgfv1u5PwVnSLQ==:117 a=NgvI/wQFGgfv1u5PwVnSLQ==:17
 a=kj9zAlcOel0A:10 a=zJRp6_cAMcgA:10 a=x5bAJOVjf1IA:10 a=UPwgjlzBAAAA:8
 a=dZMFJRZpAAAA:8 a=uKnijGUfXsMUogH7hmcA:9 a=CjuIK1q_8ugA:10
 a=IJG1HS28PhTFVN2WG8Av:22 a=0ALrU5orTrKXcsu2oHG6:22 a=77MlUavazzFiBdNJOaXW:22
Organization: occasionally
X-Mailer: Claws Mail 4.3.1 (GTK 3.24.49; x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-Antiabuse: This header was added to track abuse, please include it with any abuse report
X-Antiabuse: Primary Hostname - box5635.bluehost.com
X-Antiabuse: Original Domain - lists.debian.org
X-Antiabuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-Antiabuse: Sender Address Domain - charlescurley.com
X-Bwhitelist: no
X-Source-IP: 97.245.236.164
X-Source-L: No
X-Exim-ID: 1xScO4-00000003Qio-3BAE
X-Source-Sender: 164.sub-97-245-236.myvzw.com (peregrine.localdomain) [97.245.236.164]:34918
X-Source-Auth: charlescurley@charlescurley.com
X-Email-Count: 2
X-Org: HG=bhshared;ORG=bluehost;
X-Source-Cap: Y2hhcmxpYTM7Y2hhcmxpYTM7Ym94NTYzNS5ibHVlaG9zdC5jb20=
X-Local-Domain: yes
X-Cmae-Envelope: MS4xfJV+1WYWHmL87WaMGhOQ/bvPKfZXVOKQuqVbhDTYYzuO7mCjQQJ8pG219m2rbjjDpRE5fI04FyqSlHR4kmLSZgyOFApjDxMpNI6++38K1yg/8hAwkee+
 sFLdz6uVjkYnO25S/qKts+VI0QkJ0ddQDFp61YXSAP9vHsFyKoUI705oLA/7q0+PgMz5qoJMauOL86jSlXrCKrdlEB927sqx1V/uxJWMM9W5iDym4Aoajoe6
X-Mailing-List: <debian-user@lists.debian.org> archive/latest/832903
List-ID: <debian-user.lists.debian.org>
List-URL: <https://lists.debian.org/debian-user/>
List-Archive: https://lists.debian.org/msgid-search/20261115084323.6000e2dc@peregrine.localdomain
Approved: robomod@news.nic.it
Lines: 90
Sender: robomod@news.nic.it
X-Original-Date: Sun, 15 Nov 2026 08:43:23 -0700
X-Original-Message-ID: <20261115084323.6000e2dc@peregrine.localdomain>
X-Original-References: <20261114170142.1a7283e6@hawk.localdomain>
	<avkeN-Tw0ppxgzqc@wooledge.org>
	<20261114220535.588a318e@peregrine.localdomain>
	<avm2v9BeMGRZx__7@wooledge.org>