diff mbox

Kernel binrpm produces brokes grub2 config

Message ID 53D774F9.3090305@nod.at (mailing list archive)
State New, archived
Headers show

Commit Message

Richard Weinberger July 29, 2014, 10:18 a.m. UTC
Hi!

I'm not sure who to blame, but the below commit breaks the kernel binrpm target for me.
It produces a faulty grub2 config.
After installing such a kernel grub2 looks for vmlinuz-XY-rpm and initrd-XY-rpm.
These files are not existing and the machine does no longer boot.
Luckily an addition boot entry without the -rpm suffix exists, if remote access works
one can recover the machine.

My question is, why do we need these copy of vmlinuz anyway?
After calling installkernel on the -rpm variants you delete them again...

This <insert swear word here> happens on openSUSE 13.1, maybe their installkernel script needs fixing.

commit 3c9c7a14b6274074cc3af2b83d56a92547188f27
Author: Mike Marciniszyn <mike.marciniszyn@intel.com>
Date:   Mon Jun 24 10:38:22 2013 -0400

    rpm-pkg: add %post section to create initramfs and grub hooks

    /sbin/installkernel is used to insure grub hooks are
    inserted and the initramfs is created on the
    target system.

    The invokation installkernel will work with any
    kernel as long as:
    - /sbin/installkernel exists
    - the kernel and sysem map files are readable

    Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
    Signed-off-by: Michal Marek <mmarek@suse.cz>


Thanks,
//richard
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Michal Marek July 29, 2014, 12:23 p.m. UTC | #1
On 2014-07-29 12:18, Richard Weinberger wrote:
> Hi!
> 
> I'm not sure who to blame, but the below commit breaks the kernel binrpm target for me.
> It produces a faulty grub2 config.
> After installing such a kernel grub2 looks for vmlinuz-XY-rpm and initrd-XY-rpm.
> These files are not existing and the machine does no longer boot.
> Luckily an addition boot entry without the -rpm suffix exists, if remote access works
> one can recover the machine.
> 
> My question is, why do we need these copy of vmlinuz anyway?
> After calling installkernel on the -rpm variants you delete them again...

The typical /sbin/installkernel script does a cp "$2" "/boot/...", so
you can't use the already installed files as its arguments.


> This <insert swear word here> happens on openSUSE 13.1, maybe their installkernel script needs fixing.

I guess that the problem is that grub2-mkconfig sees the temporary
/boot/vmlinuz-*-rpm file and creates a menu entry for it. I guess we
should create the temporary kernel and initrd files somewhere else than
in /boot.

Michal

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andrei Borzenkov July 29, 2014, 3:22 p.m. UTC | #2
? Tue, 29 Jul 2014 14:23:54 +0200
Michal Marek <mmarek@suse.cz> ?????:

> On 2014-07-29 12:18, Richard Weinberger wrote:
> > Hi!
> > 
> > I'm not sure who to blame, but the below commit breaks the kernel binrpm target for me.
> > It produces a faulty grub2 config.
> > After installing such a kernel grub2 looks for vmlinuz-XY-rpm and initrd-XY-rpm.
> > These files are not existing and the machine does no longer boot.
> > Luckily an addition boot entry without the -rpm suffix exists, if remote access works
> > one can recover the machine.
> > 
> > My question is, why do we need these copy of vmlinuz anyway?
> > After calling installkernel on the -rpm variants you delete them again...
> 
> The typical /sbin/installkernel script does a cp "$2" "/boot/...", so
> you can't use the already installed files as its arguments.
> 
> 
> > This <insert swear word here> happens on openSUSE 13.1, maybe their installkernel script needs fixing.
> 
> I guess that the problem is that grub2-mkconfig sees the temporary
> /boot/vmlinuz-*-rpm file and creates a menu entry for it. I guess we
> should create the temporary kernel and initrd files somewhere else than
> in /boot.
> 

Or name it differently - e.g. rpm-vmlinuz-XY.

> Michal
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index fdd3fbf..0aa6a24 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -112,6 +112,15 @@  echo ""
 echo "%clean"
 echo 'rm -rf $RPM_BUILD_ROOT'
 echo ""
+echo "%post"
+echo "if [ -x /sbin/installkernel -a -r /boot/vmlinuz-$KERNELRELEASE -a -r /boot/System.map-$KERNELRELEASE ]; then"
+echo "cp /boot/vmlinuz-$KERNELRELEASE /boot/vmlinuz-$KERNELRELEASE-rpm"
+echo "cp /boot/System.map-$KERNELRELEASE /boot/System.map-$KERNELRELEASE-rpm"
+echo "rm -f /boot/vmlinuz-$KERNELRELEASE /boot/System.map-$KERNELRELEASE"
+echo "/sbin/installkernel $KERNELRELEASE /boot/vmlinuz-$KERNELRELEASE-rpm /boot/System.map-$KERNELRELEASE-rpm"
+echo "rm -f /boot/vmlinuz-$KERNELRELEASE-rpm /boot/System.map-$KERNELRELEASE-rpm"
+echo "fi"
+echo ""
 echo "%files"
 echo '%defattr (-, root, root)'
 echo "%dir /lib/modules"