Bug#918607: ITP: kthresher -- Purge Unused Kernels

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug#918607: ITP: kthresher -- Purge Unused Kernels

Darshaka Pathirana-2
Package: wnpp
Severity: wishlist
Owner: Darshaka Pathirana <[hidden email]>

* Package name    : kthresher
  Version         : 1.3.1
  Upstream Author : Rackspace US, Inc.
* URL             : https://github.com/rackerlabs/kthresher
* License         : Apache
  Programming Lang: Python
  Description     : Purge Unused Kernels

Tool to remove unused kernels that were installed automatically
This tool removes those kernel packages marked as candidate for autoremoval.
Those packages are generally installed via Unattended upgrade or
meta-packages. By default the latest kernel and manual installations are
marked to Never Auto Remove.

Reply | Threaded
Open this post in threaded view
|

Bug#918607: ITP: kthresher -- Purge Unused Kernels

Eduard Bloch
Hallo,
* Darshaka Pathirana [Mon, Jan 07 2019, 07:30:24PM]:

> Package: wnpp
> Severity: wishlist
> Owner: Darshaka Pathirana <[hidden email]>
>
> * Package name    : kthresher
>   Version         : 1.3.1
>   Upstream Author : Rackspace US, Inc.
> * URL             : https://github.com/rackerlabs/kthresher
> * License         : Apache
>   Programming Lang: Python
>   Description     : Purge Unused Kernels
>
> Tool to remove unused kernels that were installed automatically
> This tool removes those kernel packages marked as candidate for autoremoval.
> Those packages are generally installed via Unattended upgrade or
> meta-packages. By default the latest kernel and manual installations are
> marked to Never Auto Remove.

Please point out the difference to "deborphan --guess-kernel" somewhere
along the lines.

Best Regards,
Eduard.
--
error compiling committee.c: too many arguments to function

Reply | Threaded
Open this post in threaded view
|

Bug#918607: ITP: kthresher -- Purge Unused Kernels

Philipp Kern-6
In reply to this post by Darshaka Pathirana-2
Hi,

Am 07.01.2019 um 19:30 schrieb Darshaka Pathirana:

> * Package name    : kthresher
>   Version         : 1.3.1
>   Upstream Author : Rackspace US, Inc.
> * URL             : https://github.com/rackerlabs/kthresher
> * License         : Apache
>   Programming Lang: Python
>   Description     : Purge Unused Kernels
>
> Tool to remove unused kernels that were installed automatically
> This tool removes those kernel packages marked as candidate for autoremoval.
> Those packages are generally installed via Unattended upgrade or
> meta-packages. By default the latest kernel and manual installations are
> marked to Never Auto Remove.

it looks like this doesn't support Python 3 yet and I suspect that new
packages should. I'd suggest that instead of distutils' LooseVersion,
which was never meant for that, you use apt_pkg.version_compare. To be
fair it's not quite a Debian revision to parse but it's close enough
that the tokenization from our algorithm should work fine to sort kernel
versions.

Kind regards
Philipp Kern

Reply | Threaded
Open this post in threaded view
|

Bug#918607: ITP: kthresher -- Purge Unused Kernels

Darshaka Pathirana-2
In reply to this post by Eduard Bloch
Hi Eduard,

On 1/7/19 10:53 PM, Eduard Bloch wrote:> * Darshaka Pathirana [Mon, Jan 07 2019, 07:30:24PM]:

>> Package: wnpp
>> Severity: wishlist
>> Owner: Darshaka Pathirana <[hidden email]>
>>
>> * Package name    : kthresher
>>   Version         : 1.3.1
>>   Upstream Author : Rackspace US, Inc.
>> * URL             : https://github.com/rackerlabs/kthresher
>> * License         : Apache
>>   Programming Lang: Python
>>   Description     : Purge Unused Kernels
>>
>> Tool to remove unused kernels that were installed automatically
>> This tool removes those kernel packages marked as candidate for autoremoval.
>> Those packages are generally installed via Unattended upgrade or
>> meta-packages. By default the latest kernel and manual installations are
>> marked to Never Auto Remove.
>
> Please point out the difference to "deborphan --guess-kernel" somewhere
> along the lines.
I've forwarded your question to the upstream developer Tony Garcia
<[hidden email]> and this is his answer:

,----
| Here the response with deborphan, first of all I acknowledge I was not aware of
| this package, but after poking a bit with it I wasn't able to find a way to do
| what kthresher does, few points:
|
| - kthresher is focused on kernel images and headers
| - deborphan is focused on libraries with extension to other type of packages,
|   there is one related to kernels but is only kernel modules:
|
|   # deborphan --help | grep kernel
|   --guess-kernel              Try to report kernel modules.
|
| Man pages explains that it tries to find kernel modules only, not kernel
| images:
|
|   --guess-kernel  This option tries to find kernel-modules. It tries to match (-modules|^nvidia-kernel)-.*[0-9]+\.[0-9]+\.[0-9]+.
|
|
| - kthresher will only remove packages listed as candidates for autoremoval,
|   will not remove: running kernel, latest kernel nor unexplicitly kernels
|   installed.
| - Did not find a way to remove kernels with deborphan.
| - kthresher is meant to be executed through a cronjob/timer to purge old
|   kernels on a nightly basis
|
| This is an example of both (kthresher and deborphan) being executed on a server with multiple kernels:
|
| # deborphan --guess-kernel
| libxapian30
| libxenstore3.0
|
|  ## Here kthresher is showing the available kernel packages for autoremoval:
|
| # python3 kthresher.py -s
| INFO: List of kernel packages available for autoremoval:
| INFO:            Version Package
| INFO:    4.9.30-2+deb9u5 linux-headers-4.9.0-3-all-amd64
| INFO:    4.9.30-2+deb9u5 linux-headers-4.9.0-3-amd64
| INFO:    4.9.30-2+deb9u5 linux-headers-4.9.0-3-common
| INFO:    4.9.30-2+deb9u5 linux-headers-4.9.0-3-common-rt
| INFO:    4.9.30-2+deb9u5 linux-headers-4.9.0-3-rt-amd64
| INFO:    4.9.65-3+deb9u1 linux-headers-4.9.0-4-all-amd64
| INFO:    4.9.65-3+deb9u1 linux-headers-4.9.0-4-amd64
| INFO:    4.9.65-3+deb9u1 linux-headers-4.9.0-4-common
| INFO:    4.9.65-3+deb9u1 linux-headers-4.9.0-4-common-rt
| INFO:    4.9.65-3+deb9u1 linux-headers-4.9.0-4-rt-amd64
| INFO:    4.9.65-3+deb9u2 linux-headers-4.9.0-5-all-amd64
| INFO:    4.9.65-3+deb9u2 linux-headers-4.9.0-5-amd64
| INFO:    4.9.65-3+deb9u2 linux-headers-4.9.0-5-common
| INFO:    4.9.65-3+deb9u2 linux-headers-4.9.0-5-common-rt
| INFO:    4.9.65-3+deb9u2 linux-headers-4.9.0-5-rt-amd64
| INFO:    4.9.88-1+deb9u1 linux-headers-4.9.0-6-all-amd64
| INFO:   4.9.110-3+deb9u2 linux-headers-4.9.0-7-all-amd64
| INFO:    4.9.30-2+deb9u5 linux-image-4.9.0-3-amd64
| INFO:    4.9.30-2+deb9u5 linux-image-4.9.0-3-rt-amd64
| INFO:    4.9.65-3+deb9u1 linux-image-4.9.0-4-amd64
| INFO:    4.9.65-3+deb9u1 linux-image-4.9.0-4-rt-amd64
| INFO:    4.9.65-3+deb9u2 linux-image-4.9.0-5-amd64
| INFO:    4.9.65-3+deb9u2 linux-image-4.9.0-5-rt-amd64
|
|   ## Here kthresher is attempting to remove all the candidates of headers and
|   ## images for autoremoval keeping 0 (dry-run)
|
| # python3 kthresher.py -v -d -H -k0
| INFO: Attempting to read /etc/kthresher.conf.
| INFO: Config file /etc/kthresher.conf is empty or does not exist, ignoring.
| INFO: Options: {'purge': False, 'headers': True, 'keep': 0, 'verbose': True, 'dry_run': True}
| INFO: ----- DRY RUN -----
| INFO: Running kernel is linux-image-4.9.0-7-amd64 v[4.9.110-1]
| INFO: Attempting to keep 0 kernel package(s)
| INFO: Found 5 kernel image(s) installed and available for autoremoval
| INFO: Pre-sorting: ['4.9.88-1+deb9u1', '4.9.65-3+deb9u1', '4.9.30-2+deb9u5', '4.9.65-3+deb9u2', '4.9.110-3+deb9u2']
| INFO: Post-sorting: ['4.9.30-2+deb9u5', '4.9.65-3+deb9u1', '4.9.65-3+deb9u2', '4.9.88-1+deb9u1', '4.9.110-3+deb9u2']
| INFO: Purging packages from version: 4.9.30-2+deb9u5
| INFO: Purging: linux-image-4.9.0-3-amd64
| INFO: Purging: linux-image-4.9.0-3-rt-amd64
| INFO: Purging: linux-headers-4.9.0-3-all-amd64
| INFO: Purging: linux-headers-4.9.0-3-amd64
| INFO: Purging: linux-headers-4.9.0-3-common
| INFO: Purging: linux-headers-4.9.0-3-common-rt
| INFO: Purging: linux-headers-4.9.0-3-rt-amd64
| INFO: Purging packages from version: 4.9.65-3+deb9u1
| INFO: Purging: linux-image-4.9.0-4-amd64
| INFO: Purging: linux-image-4.9.0-4-rt-amd64
| INFO: Purging: linux-headers-4.9.0-4-all-amd64
| INFO: Purging: linux-headers-4.9.0-4-amd64
| INFO: Purging: linux-headers-4.9.0-4-common
| INFO: Purging: linux-headers-4.9.0-4-common-rt
| INFO: Purging: linux-headers-4.9.0-4-rt-amd64
| INFO: Purging packages from version: 4.9.65-3+deb9u2
| INFO: Purging: linux-image-4.9.0-5-amd64
| INFO: Purging: linux-image-4.9.0-5-rt-amd64
| INFO: Purging: linux-headers-4.9.0-5-all-amd64
| INFO: Purging: linux-headers-4.9.0-5-amd64
| INFO: Purging: linux-headers-4.9.0-5-common
| INFO: Purging: linux-headers-4.9.0-5-common-rt
| INFO: Purging: linux-headers-4.9.0-5-rt-amd64
| INFO: Purging packages from version: 4.9.88-1+deb9u1
| INFO: Purging: linux-headers-4.9.0-6-all-amd64
| INFO: Purging packages from version: 4.9.110-3+deb9u2
| INFO: Purging: linux-headers-4.9.0-7-all-amd64
|
|
| I wasn't able to remove packages with deborphan but seems like the main task of
| this tool is to find packages that are might not bee needed but does not seem
| to have a way to remove packages through it, you will need to use another tool
| to then remove those packages.
|
`----

I hope his reply did answer you question.

Regards,
 - Darsha


signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Bug#918607: ITP: kthresher -- Purge Unused Kernels

Darshaka Pathirana-2
In reply to this post by Philipp Kern-6
Hi Philipp,

On 1/16/19 12:51 AM, Philipp Kern wrote:

> Am 07.01.2019 um 19:30 schrieb Darshaka Pathirana:
>> * Package name    : kthresher
>>   Version         : 1.3.1
>>   Upstream Author : Rackspace US, Inc.
>> * URL             : https://github.com/rackerlabs/kthresher
>> * License         : Apache
>>   Programming Lang: Python
>>   Description     : Purge Unused Kernels
>>
>> Tool to remove unused kernels that were installed automatically
>> This tool removes those kernel packages marked as candidate for autoremoval.
>> Those packages are generally installed via Unattended upgrade or
>> meta-packages. By default the latest kernel and manual installations are
>> marked to Never Auto Remove.
>
> it looks like this doesn't support Python 3 yet and I suspect that new
> packages should. I'd suggest that instead of distutils' LooseVersion,
> which was never meant for that, you use apt_pkg.version_compare. To be
> fair it's not quite a Debian revision to parse but it's close enough
> that the tokenization from our algorithm should work fine to sort kernel
> versions.
Thank you for your feedback (I have forwarded your comment to the
upstream issue/PR[2]). Apart of the distutils.LooseVersion
problem, there have been also some other things in kthresher with
Python 3 problems. So yes, kthresher is currently lacking Python 3 support.

But upstream is working on it[1][2] and a new release is on the way.

[1] https://github.com/rackerlabs/kthresher/issues/53
[2] https://github.com/rackerlabs/kthresher/pull/61/

Regards,
 - Darsha


signature.asc (849 bytes) Download Attachment