Bug 1100504 - rescue boot entry is listed first
Summary: rescue boot entry is listed first
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: anaconda
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Anaconda Maintenance Team
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-05-23 00:11 UTC by Chris Murphy
Modified: 2014-09-04 17:28 UTC (History)
13 users (show)

Fixed In Version:
Clone Of: 1012646
Environment:
Last Closed: 2014-09-04 17:28:02 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
screenshot grub menu (18.02 KB, image/png)
2014-05-23 00:11 UTC, Chris Murphy
no flags Details
grub.cfg (3.87 KB, text/plain)
2014-05-23 00:12 UTC, Chris Murphy
no flags Details
anaconda.program.log (38.31 KB, text/plain)
2014-05-23 00:17 UTC, Chris Murphy
no flags Details
new-kernel-pkg --rpmpost-trans need to immediately follow install (2.18 KB, patch)
2014-05-26 19:11 UTC, Gene Czarcinski
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1036349 0 unspecified CLOSED When extlinux is bootloader on X86, rescue kernel not added to extlinux.conf 2021-02-22 00:41:40 UTC
Red Hat Bugzilla 1099627 0 unspecified CLOSED grub.cfg broken after live install 2021-02-22 00:41:40 UTC

Internal Links: 1036349 1099627

Description Chris Murphy 2014-05-23 00:11:14 UTC
Created attachment 898512 [details]
screenshot grub menu

This bug relates to bug 1012646.

Description of problem: Anaconda calls grub2-mkconfig before new-kernel-pkg. On Fedora 20 live installs it means the initial grub.cfg lacks an initrd entry for the primary kernel (non-rescue), which is later "fixed" by grubby. However on Rawhide, the initial grub.cfg only contains the rescue entry, there is no non-rescue entry at all, and grubby also doesn't fix this. It merely adds the non-rescue kernel as a 2nd entry which is not the default.

1. Install Rawhide Live using defaults.
2. Reboot

Comment 1 Chris Murphy 2014-05-23 00:12:52 UTC
Created attachment 898513 [details]
grub.cfg

Comment 2 Chris Murphy 2014-05-23 00:17:55 UTC
Created attachment 898514 [details]
anaconda.program.log

Comment 3 Chris Murphy 2014-05-23 00:22:30 UTC
OK, sorry, wrong. On Rawhide, the grub2-mkconfig grub.cfg contains one menu entry: for the non-rescue kernel, but it lacks an initrd line because it doesn't exist yet. The rescue kernel hasn't been installed at all so there's no menu entry for it. Next the primary (non-rescue) kernel initramfs gets created, and grubby updates the grub.cfg fixing the missing initrd line. Then the rescue kernel and its initramfs are installed, and grubby updates the grub.cfg again, which makes it the top listed and default menu entry.

Comment 4 Adam Williamson 2014-05-23 00:23:35 UTC
Confirmed that I also see this with Rawhide installs.

Comment 5 Chris Murphy 2014-05-23 00:29:32 UTC
anaconda-21.37-1.fc21.x86_64
grubby-8.35-1.fc21.x86_64

Comment 6 Chris Murphy 2014-05-23 18:49:07 UTC
The same problem happens with extlinux. The extlinux.conf includes the line:
default Fedora 21 Rescue c80f5da5274a456b83c73b3e3ab8b0bc (3.15.0-0.rc6.git0.1.fc21.x86_64)

Comment 7 Gene Czarcinski 2014-05-26 13:48:09 UTC
I found the problem and have a fix.  A patch to anaconda will be submitted "real soon now."

Comment 8 Gene Czarcinski 2014-05-26 15:15:50 UTC
Or maybe not so soon.

The problem:

For a DVD or netinstall the rescue kernel and initramfs are done by anaconda-yum as part of the install process ... by something anyway because when stopped with pdb.set_trace() and only anaconda-yum is running installing all the rpms.  After anaconda-yum completes but is still there, the recue kernel and initramfs have magically appeared in /boot.  When the bootloader is installed, both regular and rescue kernels and initramfs files are there.

Well, then the answer is to do the same thing for Liveinstall (livepayload.py).  In livepayload.py, move the code generating the rescue kernel from postInstall() to the end of install().

Worked great for grub2.  For extlinux, we do not have the rescue kernel anymore and it really looks like we should work from my inspection of the code.

This code is from the commit which was part of anaconda-21.27 to:
Add rescue kernels to the bootloader install list. (#1036349)

Comment 9 Gene Czarcinski 2014-05-26 19:11:14 UTC
Created attachment 899354 [details]
new-kernel-pkg --rpmpost-trans need to immediately follow install

OK, I believe that this patch fixes the problem with liveinst resulting in bad extlinux.conf and grub.cfg files.

However, I figured out that the patch/update in 21.27 for BZ 1036349 does not currently work.  The added code is not used for a DVD or network install and for a LiveInstall, it still does not handle the rescue kernel.

Comment 10 Gene Czarcinski 2014-05-26 19:59:54 UTC
OK, I have a winner!  Both extlinux.conf and grub.cfg have two entries: regular and rescue as well as each having its own initramfs file ... and a good default to boot.

Patch RSN as soon as I polish it up.

Comment 11 Colin Walters 2014-05-26 20:10:08 UTC
Conceptually a lot of the gyrations here I think are fallout from the "dracut hostonly" changes.  See:

https://git.fedorahosted.org/cgit/anaconda.git/commit/?id=9b49dd182d2d2e2d02861fd3b6caa8492968abdb
https://bugzilla.redhat.com/show_bug.cgi?id=1013087

which introduced further special casing in Anaconda for initramfs.

The whole new-kernel-pkg -> /etc/kernel/postinst.d -> 51-dracut-rescue-postinst.sh -> new-kernel-pkg (!!!) -> ... is such a mess.

Anyways from a code structure this looks conceptually right; the other payload types are setting up the kernel in their install, and this updates livePayload to match.

Comment 12 Gene Czarcinski 2014-05-26 20:35:27 UTC
THe submitted patch is good.  I created an additional patch to address having a rescue kernel in extlinux.conf when a live install is done.  This was attached to the re-opened BZ 1036349

Comment 13 Adam Williamson 2014-05-30 21:54:50 UTC
This fix is in current anaconda git master (post-21.38), so marking MODIFIED. I tested the fix with an updates.img - available at http://www.happyassassin.net/updates/updates-1100504-1094489.img , it contains all changes in current anaconda git master - and it seems good, the 'regular' kernel is #1 in the list, rescue kernel is second.


Note You need to log in before you can comment on or make changes to this bug.