very useful: kernel-remover -f

Started by JohnML, 2014/08/01, 11:45:38

Previous topic - Next topic

JohnML

Just learned how to keep two running kernels using kernel-remover:


The paramater -f lets kernel-remover remove all kernels except the running one.


So, if you do kernel-remover just(!!) after apt installs a new kernel and without reboot, all kernel will be removed except the  last two.


Thats what i needed, because it was so annoying accepting "remove Kernel xy" until two are left!


I think its good to know this ( .. i didn't knew )

michaa7

#1
Quote from: JohnML on 2014/08/01, 11:45:38
The paramater -f lets kernel-remover remove all kernels except the running one.
Right. And indeed, this is very usfull.
QuoteSo, if you do kernel-remover just(!!) after apt installs a new kernel and without reboot, all kernel will be removed except the  last two.
Are you really sure it works that way? What does prevent the new installed kernel to be removed? It is on the list as update-grub has run.
I am not 100% sure, but as I recall it did not work this way when I once tried what you described.

Anyway, it works like described if you do it before you install a new kernel. But you would need to know there is a new kernel beforehand. Looking carefully at the output of "apt-get update && apt-get dist-upgrade -d" would tell you.
Ok, you can't code, but you still might be able to write a bug report for Debian's sake

JohnML

.. just tried it once with success!


I have to see if that works ok in the future!


The reason for my success is as i think: kernel-remover doesn't "see" kernels beyond the running one?!!

dibl

Quote from: JohnML on 2014/08/03, 19:51:36

The reason for my success is as i think: kernel-remover doesn't "see" kernels beyond the running one?!!


I think this must be correct -- because if you install an RC kernel, it will not be available for removal if you run kernel-remover.
System76 Oryx Pro, Intel Core i7-11800H, ASRock B860 Pro-A, Intel Core Ultra 7 265KF, Nvidia GTX-1060, SSD 990 EVO Plus.

michaa7

#4
Quote from: dibl on 2014/08/03, 21:58:25
...
I think this must be correct -- ...

hmm, but here it isn't.

I now can say that I obviously recalled correctly: I installed the new 3.16-0 kernel, and, without rebooting, run "kernel-remover -f" which - while observing it - deleted the newly installed kernel. Interestingly, it did not uninstall an old 3.9-2 kernel which for whatever reason survied all my previous attempts to delete it with the "-f" command (I noticed only now).

So, at least here it does not work like you described it. Which is not a big deal as you may circumvent it by running the command beforehand.

Just a heads up.


EDIT:
And after installing 3.16-0 a second time I have to object a second time: kernel-remover (without -f) sees 3.16-0 altough 3.15-8 is running.
But it does not see old 3.9-2 (update-grub does).

I now have to investigate how to delete 3.9-2, although I have to admit, I'm lost here. towo? melmaker?
Ok, you can't code, but you still might be able to write a bug report for Debian's sake

dibl

The kernel-remover script is at /usr/sbin/kernel-remover.  Looking at it, the actual removal of a kernel and related packages appears to be the module that runs from lines 154 - 173.  So if you carefully replicate those commands in a root terminal, substituting your 3.9 kernel for the variables in the script, I would think you could remove it manually.


When I had some 3.x-rc kernels installed, which were numbered newer than my running kernel, I noticed that kernel-remover did not show them.  But perhaps it was the "rc" in the version number and not the numerals that was the cause of that.
System76 Oryx Pro, Intel Core i7-11800H, ASRock B860 Pro-A, Intel Core Ultra 7 265KF, Nvidia GTX-1060, SSD 990 EVO Plus.

michaa7

#6
Quote from: dibl on 2014/08/04, 18:52:21
...So if you carefully replicate those commands in a root terminal, substituting your 3.9 kernel for the variables in the script, I would think you could remove it manually.
Presenting me this hint proves that you, too, thought it can't be as easy as "apt-get purge foo", but it is (as towo suggested).

QuoteWhen I had some 3.x-rc kernels installed, which were numbered newer than my running kernel, I noticed that kernel-remover did not show them.  But perhaps it was the "rc" in the version number and not the numerals that was the cause of that.
From what I can tell now this seems the case.
Ok, you can't code, but you still might be able to write a bug report for Debian's sake

dibl

Quote from: michaa7 on 2014/08/04, 19:25:43
you, too, thought it can't be as easy as "apt-get purge foo, but it is (as towo suggested).



So, you only need to purge the linux-image-xxx and the linux-headers-xxx packages?  I guess that makes sense, now that I think about it.  When you install a new kernel you always get 3 packages:  linux-image-xxx, linux-headers-xxx, and an upgrade to the linux-headers-siduction-amd64/i386 package.
System76 Oryx Pro, Intel Core i7-11800H, ASRock B860 Pro-A, Intel Core Ultra 7 265KF, Nvidia GTX-1060, SSD 990 EVO Plus.

michaa7

Quote from: dibl on 2014/08/04, 20:37:13
...
So, you only need to purge the linux-image-xxx and the linux-headers-xxx packages?  ...
Yes.
Ok, you can't code, but you still might be able to write a bug report for Debian's sake