[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231108000749.GA3723879@dev-arch.thelio-3990X>
Date: Tue, 7 Nov 2023 17:07:49 -0700
From: Nathan Chancellor <nathan@...nel.org>
To: dcavalca@...a.com
Cc: Masahiro Yamada <masahiroy@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Nicolas Schier <nicolas@...sle.eu>,
linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] rpm-pkg: simplify installkernel %post
Hi Davide,
On Fri, Nov 03, 2023 at 11:33:42PM +0000, Davide Cavalca via B4 Relay wrote:
> From: Davide Cavalca <dcavalca@...a.com>
>
> The %post currently does a shuffling dance before calling installkernel.
> This isn't actually necessary afaict, and the current implementation
> ends up triggering downstream issues such as
> https://github.com/systemd/systemd/issues/29568
>
> This commit simplifies the logic to remove the shuffling. For reference,
> the original logic was added in commit 3c9c7a14b627("rpm-pkg: add %post
> section to create initramfs and grub hooks").
>
> Signed-off-by: Davide Cavalca <dcavalca@...a.com>
I took this for a spin in a Fedora 38 virtual machine while I wait for
Fedora 39 to make sure that this does not regress older installkernel
implementations and I think that this patch does just that. With Fedora
38, I see the following error during installation that I did not see
prior to applying your patch:
cp: cannot stat '/boot/System.map-6.6.0-15157-gefb5302e6ea5': No such file or directory
and when attempting to boot the newly installed kernel, I see:
error: ../../grub-core/loader/efi/linux.c:47:kernel is too small.
error: ../../grub-core/loader/efi/linux.c:47:kernel is too small.
error: ../../grub-core/loader/i386/efi/linux.c:258:you need to load the kernel
first.
error: ../../grub-core/loader/i386/efi/linux.c:258:you need to load the kernel first.
before I get kicked back to the grub menu. The /boot folder after
installing the rpm package with your patch in it looks like:
$ ls -al /boot
total 240012
dr-xr-xr-x. 5 root root 4096 Nov 7 17:04 .
dr-xr-xr-x. 18 root root 235 Nov 7 16:24 ..
-rw-r--r--. 1 root root 268497 Nov 7 15:43 config-6.6.0-15156-g13d88ac54ddd
-rw-r--r--. 1 root root 268497 Nov 7 15:50 config-6.6.0-15157-gefb5302e6ea5
drwx------. 3 root root 4096 Dec 31 1969 efi
drwx------. 3 root root 50 Nov 7 17:03 grub2
-rw-------. 1 root root 114164610 Nov 7 16:26 initramfs-0-rescue-01cdbeade0ec4c07828d9f3919ec2772.img
-rw-------. 1 root root 36334410 Nov 7 16:40 initramfs-6.6.0-15156-g13d88ac54ddd.img
-rw-------. 1 root root 36174736 Nov 7 17:04 initramfs-6.6.0-15157-gefb5302e6ea5.img
drwxr-xr-x. 3 root root 21 Nov 7 16:25 loader
lrwxrwxrwx. 1 root root 42 Nov 7 17:04 System.map -> /boot/System.map-6.6.0-15157-gefb5302e6ea5
-rw-r--r--. 1 root root 8968631 Nov 7 16:40 System.map-6.6.0-15156-g13d88ac54ddd
-rw-r--r--. 1 root root 8968631 Nov 7 15:50 System.map-6.6.0-15157-gefb5302e6ea5.old
lrwxrwxrwx. 1 root root 39 Nov 7 17:04 vmlinuz -> /boot/vmlinuz-6.6.0-15157-gefb5302e6ea5
-rwxr-xr-x. 1 root root 14577352 Nov 7 16:25 vmlinuz-0-rescue-01cdbeade0ec4c07828d9f3919ec2772
-rw-r--r--. 1 root root 13012992 Nov 7 16:40 vmlinuz-6.6.0-15156-g13d88ac54ddd
-rw-r--r--. 1 root root 0 Nov 7 17:04 vmlinuz-6.6.0-15157-gefb5302e6ea5
-rw-r--r--. 1 root root 13012992 Nov 7 15:50 vmlinuz-6.6.0-15157-gefb5302e6ea5.old
That zero sized vmlinuz-6.6.0-15157-gefb5302e6ea5 is likely the cause of
the grub error. It seems like this logic is likely still necessary for
older distributions.
Cheers,
Nathan
> ---
> scripts/package/kernel.spec | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/scripts/package/kernel.spec b/scripts/package/kernel.spec
> index 3eee0143e0c5..cc4292c03ea2 100644
> --- a/scripts/package/kernel.spec
> +++ b/scripts/package/kernel.spec
> @@ -77,11 +77,7 @@ rm -rf %{buildroot}
>
> %post
> if [ -x /sbin/installkernel -a -r /boot/vmlinuz-%{KERNELRELEASE} -a -r /boot/System.map-%{KERNELRELEASE} ]; then
> -cp /boot/vmlinuz-%{KERNELRELEASE} /boot/.vmlinuz-%{KERNELRELEASE}-rpm
> -cp /boot/System.map-%{KERNELRELEASE} /boot/.System.map-%{KERNELRELEASE}-rpm
> -rm -f /boot/vmlinuz-%{KERNELRELEASE} /boot/System.map-%{KERNELRELEASE}
> -/sbin/installkernel %{KERNELRELEASE} /boot/.vmlinuz-%{KERNELRELEASE}-rpm /boot/.System.map-%{KERNELRELEASE}-rpm
> -rm -f /boot/.vmlinuz-%{KERNELRELEASE}-rpm /boot/.System.map-%{KERNELRELEASE}-rpm
> +/sbin/installkernel %{KERNELRELEASE} /boot/vmlinuz-%{KERNELRELEASE} /boot/System.map-%{KERNELRELEASE}
> fi
>
> %preun
>
> ---
> base-commit: e392ea4d4d00880bf94550151b1ace4f88a4b17a
> change-id: 20231103-rpmpost-f5c99552919f
>
> Best regards,
> --
> Davide Cavalca <dcavalca@...a.com>
>
Powered by blists - more mailing lists