🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.user
Article #563

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

#563
From: Vincent Lefevre
Date: Tue, 17 Nov 2026 03:20
50 lines
3922 bytes
On 2026-11-16 13:58:11 -0600, David Wright wrote:
> It would be more realistic to try out Vincent's suggestion by
> testing with APT::NeverAutoRemove::KernelCount "N"; where N=0…6
> in turn.

Yes. And the current code (3.3.7) in apt-pkg/algorithms.cc is

   auto keepKernels = (unsigned long)_config->FindI("APT::NeverAutoRemove::KernelCount", 2);
   if (keepKernels < 2)
      keepKernels = 2;

   if (Debug)
      std::clog << "Amount of kernels to keep " << keepKernels << std::endl;

   if (not bootedVersion.empty())
   {
      if (Debug)
         std::clog << "Keeping booted kernel " << bootedVersion << std::endl;
      keep.insert(bootedVersion);
   }

   while (keep.size() < keepKernels && versions != version2unames.rend())
   {
      auto v = versions->first;
      if (v == bootedVersion)
      {
         versions++;
         continue;
      }
      if (Debug)
         std::clog << "Keeping previous kernel " << v << std::endl;
      keep.insert(v);
      versions++;
   }

So it can output debug information. It would be interesting to get it.
If this loop outputs unexpected "Keeping previous kernel" lines, then
the bug is there. If not...

Later in the code:

   if (Debug)
      std::clog << "Kernel protection regex: " << re << "\n";

See whether the constructed regex is correct.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Pascaline project (LIP, ENS-Lyon)
Technical Details
Message-ID: <O0hTH-cnsG-1@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.corradoroberto.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> <NZKEs-c49T-83@gated-at.bofh.it> <NZMPU-c5zY-19@gated-at.bofh.it> <NZNsB-c5QC-7@gated-at.bofh.it> <O03e1-cf3m-7@gated-at.bofh.it> <O08dI-chPl-9@gated-at.bofh.it> <O0b1T-cjra-1@gated-at.bofh.it>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.corradoroberto.it!bofh.it!news.nic.it!robomod
From: Vincent Lefevre <vincent@vinc17.net>
Newsgroups: linux.debian.user
Subject: Re: APT::NeverAutoRemove::KernelCount "3"; Not quite working: I get  more than three kernels
Date: Tue, 17 Nov 2026 04:20:01 +0100
Message-ID: <O0hTH-cnsG-1@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> <NZKEs-c49T-83@gated-at.bofh.it> <NZMPU-c5zY-19@gated-at.bofh.it> <NZNsB-c5QC-7@gated-at.bofh.it> <O03e1-cf3m-7@gated-at.bofh.it> <O08dI-chPl-9@gated-at.bofh.it> <O0b1T-cjra-1@gated-at.bofh.it>
X-Original-To: debian-user@lists.debian.org
X-Mailbox-Line: From debian-user-request@lists.debian.org  Tue Nov 17 03:19:09 2026
Old-Return-Path: <vincent@vinc17.net>
X-Amavis-Spam-Status: No, score=-1.9 tagged_above=-10000 required=5.3
 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001]
 autolearn=ham autolearn_force=no
X-Policyd-Weight: using cached result; rate: -4.6
Mail-Followup-To: debian-user@lists.debian.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
X-Mailer-Info: https://www.vinc17.net/mutt/
User-Agent: Mutt/2.4.3+67 (b2844dd7) vl-188789 (2026-11-11)
X-Mailing-List: <debian-user@lists.debian.org> archive/latest/832951
List-ID: <debian-user.lists.debian.org>
List-URL: <https://lists.debian.org/debian-user/>
List-Archive: https://lists.debian.org/msgid-search/20261117031855.GC803748@qaa.vinc17.org
Approved: robomod@news.nic.it
Lines: 50
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Date: Tue, 17 Nov 2026 04:18:55 +0100
X-Original-Message-ID: <20261117031855.GC803748@qaa.vinc17.org>
X-Original-References: <20261114170142.1a7283e6@hawk.localdomain>
 <avkeN-Tw0ppxgzqc@wooledge.org>
 <20261114220535.588a318e@peregrine.localdomain>
 <avm2v9BeMGRZx__7@wooledge.org>
 <20261115084323.6000e2dc@peregrine.localdomain>
 <avn1HIGw1_1mb5g_@argo.corp>
 <20261115114153.4c463e2b@hawk.localdomain>
 <20261116113011.GE670644@qaa.vinc17.org>
 <b1c795f330751c4af0240ab6357cca96@charlescurley.com>
 <avtgU6DyhaoMaA_7@argo.corp>