Welcome, Guest. Please login or register.
Did you miss your activation email?

Author Topic: Kernel and autoremove  (Read 1796 times)

Offline hendrikL

  • Global Moderator
  • User
  • *****
  • Gravatar
  • Posts: 507
Re: Kernel and autoremove
« Reply #15 on: 2021/04/03, 07:32:10 »
What i don't understand is, why is there a need to have more than 3 kernels installed.
The better way is to mark the kernel you want not to be removed as manual installed and the problem should be solved.
My 2c

Offline gnasch

  • User
  • Posts: 45
Re: Kernel and autoremove
« Reply #16 on: 2021/04/03, 13:33:03 »
The answer is that on a lenovo s540 I had to use an old kernel for several month,
because the next higher x in  5.x.zz version would not work. Had I left the updates
do what they wanted, my daughter could not have finished the work for the final year
of school.
Really practical reasons only.

Thanks!
gnasch

Offline hendrikL

  • Global Moderator
  • User
  • *****
  • Gravatar
  • Posts: 507
Re: Kernel and autoremove
« Reply #17 on: 2021/04/03, 15:15:09 »
That is okay, but if you mark that specific kernel as manual installed "apt-mark manual <foo>" .
Then you can use autopurge/autoremove without that that specific kernel <foo> gets removed but all other that are not needed, and you have a clean system.

Offline gnasch

  • User
  • Posts: 45
Re: Kernel and autoremove
« Reply #18 on: 2021/04/03, 15:24:49 »
Yeah - but the point is:
By the time I find out that something is wrong,
the automaton has already removed the old kernel.
I like to be in charge of my things, so when it breaks, I
know the culprit! I can almost cope with my own stupidity,
don't care about the stupidity of automatons.
That's why I am not using Win$ by the way. I have to
care about the mess that M$ is making out of printing
at my customers atm. Blerg.

Best,
ch

Offline Mister00X

  • User
  • Posts: 57
Re: Kernel and autoremove
« Reply #19 on: 2021/04/12, 19:20:40 »
I tested a bit and added that line above to /etc/apt/apt.sonf.d/01autoremove

Code: [Select]
---snip--
APT
{
  NeverAutoRemove
  {
"^firmware-linux.*";
"^linux-firmware$";
"^linux-image-[a-z0-9]*$";
"^linux-image-[a-z0-9]*-[a-z0-9]*$";
"^linux-[h-i]";
  };

  VersionedKernelPackages
---snap---

so it works for meβ„’, i don't have to mark new kernel as installed manual.

I am by no means an expert when it comes to regex but I believe that the reason for the original config not matching the kernels is that those strings do not match the dots "." in the kernel package names and maybe some of the "-" too.

So looking at a current kernel
Code: [Select]
linux-image-5.11.13-2-siduction-amd64
I imagine a string like
Code: [Select]
"^linux-image-[a-z0-9\.]*-[a-z0-9\-]*$"
to actually match this.

That said I am not entirely sure if apt accepts this kind of escaping special characters.
Arguing that you don't care about the right to privacy because you have nothing to hide is no different than saying you don't care about free speech because you have nothing to say. – Edward Snowden