Hi, I'm using sys-kernel/gentoo-kernel-bin with useflag initramfs disabled. I do not have any initramfs. Each time I unmerge a kernel version I'm getting an error from find. The error comes from kernel-install_pkg_postrm() defined in kernel-install.eclass. See the following attached file. Reproducible: Always
Created attachment 915741 [details] kernel unmerge
Created attachment 915864 [details] remove empty directory if it exists This patch is fixing the issue for me : > Would you like to unmerge these packages? [Yes/No] yes > >>> Waiting 5 seconds before starting... > >>> (Control-C to abort)... > >>> Unmerging in: 5 4 3 2 1 > >>> Unmerging (1 of 1) sys-kernel/gentoo-kernel-bin-5.15.175... > * Removing initramfs ... [ ok ] > > * GNU info directory index is up-to-date.
Created attachment 915894 [details, diff] remove empty directory only if it exists Second version of the patch to properly consider the rmdir return value.
(In reply to Fab from comment #3) > Created attachment 915894 [details, diff] [details, diff] > remove empty directory only if it exists > > Second version of the patch to properly consider the rmdir return value. This fix modifies the intended behaviour. The find strips empty directories only, whereas after this patch the whole kernel source tree would be removed which is not what we want. I propose this fix instead, could you let me know if it resolves the problem on your end? diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass index 6ca39e551110..f70556ad41f5 100644 --- a/eclass/kernel-install.eclass +++ b/eclass/kernel-install.eclass @@ -738,9 +738,9 @@ kernel-install_pkg_postinst() { kernel-install_pkg_postrm() { debug-print-function ${FUNCNAME} "$@" - if [[ ! ${KERNEL_IUSE_GENERIC_UKI} ]]; then - local kernel_dir=${EROOT}/usr/src/linux-${KV_FULL} - local image_path=$(dist-kernel_get_image_path) + local kernel_dir=${EROOT}/usr/src/linux-${KV_FULL} + local image_path=$(dist-kernel_get_image_path) + if [[ ! ${KERNEL_IUSE_GENERIC_UKI} && -d ${kernel_dir} ]]; then ebegin "Removing initramfs" rm -f "${kernel_dir}/${image_path%/*}"/{initrd,uki.efi} && find "${kernel_dir}" -depth -type d -empty -delete
Yes, this works fine. Thank you.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=65594d38630d5406918d60ebd6d2aba7367aad6b commit 65594d38630d5406918d60ebd6d2aba7367aad6b Author: Nowa Ammerlaan <nowa@gentoo.org> AuthorDate: 2025-01-06 09:20:31 +0000 Commit: Nowa Ammerlaan <nowa@gentoo.org> CommitDate: 2025-01-06 14:37:49 +0000 kernel-install.eclass: only remove initrd,uki.efi if src dir still exists Closes: https://bugs.gentoo.org/947359 Signed-off-by: Nowa Ammerlaan <nowa@gentoo.org> eclass/kernel-install.eclass | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)