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

Author Topic:  very useful: kernel-remover -f  (Read 4325 times)

Offline JohnML

  • User
  • Posts: 22
very useful: kernel-remover -f
« on: 2014/08/01, 11:45:38 »
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 )

Offline michaa7

  • User
  • Posts: 2.298
Re: very useful: kernel-remover -f
« Reply #1 on: 2014/08/03, 18:03:09 »
The paramater -f lets kernel-remover remove all kernels except the running one.
Right. And indeed, this is very usfull.
Quote
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.
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.
« Last Edit: 2014/08/03, 18:06:27 by michaa7 »
Ok, you can't code, but you still might be able to write a bug report for Debian's sake

Offline JohnML

  • User
  • Posts: 22
Re: very useful: kernel-remover -f
« Reply #2 on: 2014/08/03, 19:51:36 »
.. 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?!!

Offline dibl

  • siduction community member
  • Global Moderator
  • User
  • *****
  • Posts: 2.358
    • Land of the Buckeye
Re: very useful: kernel-remover -f
« Reply #3 on: 2014/08/03, 21:58:25 »

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, SSD 970 EVO Plus;  Asus ROG STRIX X299-E, Core i7-7740X, Nvidia GTX-1060, dual monitors, SSD 860 EVO

Offline michaa7

  • User
  • Posts: 2.298
Re: very useful: kernel-remover -f
« Reply #4 on: 2014/08/04, 17:58:47 »
...
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?
« Last Edit: 2014/08/04, 18:12:50 by michaa7 »
Ok, you can't code, but you still might be able to write a bug report for Debian's sake

Offline dibl

  • siduction community member
  • Global Moderator
  • User
  • *****
  • Posts: 2.358
    • Land of the Buckeye
Re: very useful: kernel-remover -f
« Reply #5 on: 2014/08/04, 18:52:21 »
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, SSD 970 EVO Plus;  Asus ROG STRIX X299-E, Core i7-7740X, Nvidia GTX-1060, dual monitors, SSD 860 EVO

Offline michaa7

  • User
  • Posts: 2.298
Re: very useful: kernel-remover -f
« Reply #6 on: 2014/08/04, 19:25:43 »
...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).

Quote
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.
From what I can tell now this seems the case.
« Last Edit: 2014/08/04, 21:06:28 by michaa7 »
Ok, you can't code, but you still might be able to write a bug report for Debian's sake

Offline dibl

  • siduction community member
  • Global Moderator
  • User
  • *****
  • Posts: 2.358
    • Land of the Buckeye
Re: very useful: kernel-remover -f
« Reply #7 on: 2014/08/04, 20:37:13 »
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, SSD 970 EVO Plus;  Asus ROG STRIX X299-E, Core i7-7740X, Nvidia GTX-1060, dual monitors, SSD 860 EVO

Offline michaa7

  • User
  • Posts: 2.298
Re: very useful: kernel-remover -f
« Reply #8 on: 2014/08/05, 03:28:01 »
...
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