From: Nathan Chancellor <nathan@kernel.org>
To: dcavalca@meta.com
Cc: Masahiro Yamada <masahiroy@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Nicolas Schier <nicolas@fjasle.eu>,
linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rpm-pkg: simplify installkernel %post
Date: Tue, 7 Nov 2023 17:07:49 -0700 [thread overview]
Message-ID: <20231108000749.GA3723879@dev-arch.thelio-3990X> (raw)
In-Reply-To: <20231103-rpmpost-v1-1-9c18afab47f4@meta.com>
Hi Davide,
On Fri, Nov 03, 2023 at 11:33:42PM +0000, Davide Cavalca via B4 Relay wrote:
> From: Davide Cavalca <dcavalca@meta.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@meta.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@meta.com>
>
next prev parent reply other threads:[~2023-11-08 0:07 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-03 23:33 [PATCH] rpm-pkg: simplify installkernel %post Davide Cavalca via B4 Relay
2023-11-08 0:07 ` Nathan Chancellor [this message]
2023-12-12 17:10 ` [PATCH v2] " Jose Ignacio Tornos Martinez
2023-12-12 19:19 ` Nathan Chancellor
2023-12-18 18:26 ` Masahiro Yamada
2023-12-19 8:43 ` Jose Ignacio Tornos Martinez
2023-12-19 15:56 ` [PATCH v3] " Jose Ignacio Tornos Martinez
2023-12-19 16:49 ` Masahiro Yamada
2023-12-19 20:17 ` [PATCH v4] " Jose Ignacio Tornos Martinez
2023-12-20 17:18 ` Nathan Chancellor
2023-12-26 4:02 ` Masahiro Yamada
2024-01-07 15:25 ` Jose Ignacio Tornos Martinez
2024-01-14 8:06 ` [PATCH V5 1/2] " Jose Ignacio Tornos Martinez
2024-01-17 1:29 ` Masahiro Yamada
2024-01-18 14:12 ` Jose Ignacio Tornos Martinez
2024-01-21 17:32 ` Masahiro Yamada
2024-01-22 18:22 ` Jose Ignacio Tornos Martinez
2024-01-22 18:22 ` [PATCH] " Jose Ignacio Tornos Martinez
2024-01-28 7:32 ` Masahiro Yamada
2024-01-29 9:27 ` Jose Ignacio Tornos Martinez
2024-01-29 9:28 ` [PATCH v7] " Jose Ignacio Tornos Martinez
2024-01-31 1:48 ` Masahiro Yamada
2024-01-14 8:07 ` [PATCH V5 2/2] rpm-pkg: avoid install/remove the running kernel Jose Ignacio Tornos Martinez
2024-01-17 1:32 ` Masahiro Yamada
2024-01-18 14:12 ` Jose Ignacio Tornos Martinez
2024-01-21 17:33 ` Masahiro Yamada
2024-01-22 15:53 ` Jose Ignacio Tornos Martinez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231108000749.GA3723879@dev-arch.thelio-3990X \
--to=nathan@kernel.org \
--cc=dcavalca@meta.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=ndesaulniers@google.com \
--cc=nicolas@fjasle.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox