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
Created attachment 898513 [details] grub.cfg
Created attachment 898514 [details] anaconda.program.log
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.
Confirmed that I also see this with Rawhide installs.
anaconda-21.37-1.fc21.x86_64 grubby-8.35-1.fc21.x86_64
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)
I found the problem and have a fix. A patch to anaconda will be submitted "real soon now."
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)
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.
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.
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.
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
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.