Dear Maintainer,
kthresher fails on systems (container) where the running kernel is
not installed:
root@tranquility:/tmp/autopkgtest.wBbOzr/build.4Yl/src# kthresher
INFO: No kernel packages available for autoremoval.
root@tranquility:/tmp/autopkgtest.wBbOzr/build.4Yl/src# kthresher -d
INFO: Attempting to read /etc/kthresher.conf.
INFO: Options found: ['include'].
INFO: Valid setting found "include"
INFO: include = /etc/kthresher.d/*.conf
INFO: Options: {'dry_run': True, 'headers': False, 'keep': 1, 'purge': False, 'verbose': False, 'include': '/etc/kthresher.d/*.conf'}
INFO: ----- DRY RUN -----
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apt/cache.py", line 277, in __getitem__
rawpkg = self._cache[key]
~~~~~~~~~~~^^^^^
KeyError: 'linux-image-6.1.0-26-amd64'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/kthresher", line 33, in <module>
sys.exit(load_entry_point('kthresher==1.4.1', 'console_scripts', 'kthresher')())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/kthresher.py", line 475, in main
kthreshing(purge=False, headers=options["headers"], keep=options["keep"])
File "/usr/lib/python3/dist-packages/kthresher.py", line 266, in kthreshing
kernel_pkg = apt_cache["linux-image-%s" % current_kernel_ver]
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/apt/cache.py", line 279, in __getitem__
raise KeyError("The cache has no package named %r" % key)
KeyError: "The cache has no package named 'linux-image-6.1.0-26-amd64'"
root@tranquility:/tmp/autopkgtest.wBbOzr/build.4Yl/src# uname -a
Linux tranquility 6.1.0-26-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.112-1 (2024-09-30) x86_64 GNU/Linux
root@tranquility:/tmp/autopkgtest.wBbOzr/build.4Yl/src# dpkg -l | grep linux-image
root@tranquility:/tmp/autopkgtest.wBbOzr/build.4Yl/src#
We enabled autopkgtest for this package and noticed this problem.
Yes, kthresher should handle this case, but I think this is a minor
issue for most systems where kthresher is used.
I will file a bug upstream and declare a autopkgtest restriction flaky
to prevent a RC bug for this.
Best,
- Darsha