Bug 1474042

Summary: Install to new partition on system with existing F26 /boot leaves broken boot options
Product: [Fedora] Fedora Reporter: "FeRD" (Frank Dana) <ferdnyc>
Component: anacondaAssignee: Anaconda Maintenance Team <anaconda-maint-list>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: anaconda-maint-list, g.kaviyarasu, jonathan, mkolman, vanmeeuwen+fedora, vponcova
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-01-02 04:13:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description "FeRD" (Frank Dana) 2017-07-23 11:21:44 UTC
Description of problem:

When attempting to install F26 from the LiveCD environment onto a system which contains an existing installation of F26 (in a separate LV), Anaconda made rather a mess of the bootloader configuration. It left me booted into an unusable system as the booted kernel (though present on /boot) had not actually been installed. Therefore, no modules were present in /lib/modules/`uname -r`/ (in fact that directory itself was not present), which meant I couldn't even enable the WiFi adapter to reach the network and repair the problem with dnf.


Background/Rationale:
Due to the issues I encountered after upgrading F25->F26 (bug 1470038, though nothing there is of any relevance to this bug), I decided to attempt a fresh install of F26 from the Workstation Live image environment (on bootable DVD), alongside the non-functional F26 upgrade install I'd previously done. 

I realize this is an esoteric case, and that very few people will ever be affected by this issue. But I feel that it's worth addressing, becauese if Anaconda is able to make the right decisions and properly account for this type of setup, that'll probably make it a smarter, safer, and more robust installer in general.


Steps Taken/Detail:
This is a legacy-BIOS / MBR-disk laptop from ca. 2009, there's no EFI, GPT, or other modern sorcery involved. Just a single 2.5" HDD with an MBR partition table, containing an NTFS partition (Windows), an ext4 partition (/boot), and an LVM partition. The LVM partition contains a single VG, LVs for / and /home, and some free extents.

Using the advanced Blivet partitioning option, I...
1. Created a separate, secondary root LV on available VG extents. 
2. Left my previous (F25-upgraded-to-)F26 root volume untouched and unconfigured.
3. Configured the existing /boot and /home into the new install, by setting their mount points accordingly.

The install process itself went fine. The new root volume was formatted and all of the packages were installed to it, the root password was set, and my user account was created as specified. But on first boot, as I said in the introduction, the system was unusable due to the lack of kernel modules.

As I discovered...
1. `uname -r` showed I was booted into 4.11.10-300.fc26.x86_64
2. `rpm -q kernel` returned ONLY kernel-4.11.8-300.fc26.x86_64
3. `rpm -q kernel-core`, the source of /lib/modules/<version>/, also returned only kernel-core-4.11.8-300.fc26.x86_64

What anaconda had apparently done was...

1. Installed the 4.11.8 kernel packages distributed on the LiveCD

2. Rewrote ALL of the previous F26 install's menuentry items in grub.cfg, replacing the previous root LV with the new one so that they booted into the new install. Because I had used `dnf upgrade` to update the previous install post-upgrade, there were three of these: 4.11.10-300, 4.11.9-300, and 4.11.8-300. All three kernels were present on /boot, but only one (4.11.8-300) was installed to the new F26 root LV.

3. Perhaps because 4.11.10-300 is newer than 4.11.8-300, anaconda left the 4.11.10-300 menuentry as the default, pointing to the newly-installed root LV, despite the packages for that kernel not being installed there.

By rebooting the laptop and selecting the 4.11.8-300.fc26.x86_64 boot option, I was able to reach a running system with all of the hardware drivers present in /lib/modules/4.11.8-300.fc26.x86_64


Expected Results:
A bootable system.

I'm undecided myself on what anaconda should've done with the existing F26 entries in /boot/grub2/grub.cfg, when upgrading. The way I see it, either of these would be acceptable:

1. Leave the existing entries alone (or possibly renamed somehow), so that the option is still available to boot into either install. They use separate root volumes, so there's no reason that shouldn't be a valid config.

2. Delete the entries for the previous F26 install from grub.cfg completely. 

Effectively it's doing #2 anyway, since by rewriting the old entries with the new root volume it turned them into invalid boot options. Leaving those entries in place, rewritten into effectively-corrupted form, only causes confusion and problems. (bug 1456353 and bug 1456404, which relate to anaconda's management of boot entries on EFI systems, probably also figure in here.)

Above all else, anaconda DEFINITELY should've set the menuentry corresponding to the kernel _it_just_installed_ as  the default boot entry, regardless of whatever else might be present in the boot menu, or on the /boot partition. (Or even present on the system, for that matter.)

Comment 1 "FeRD" (Frank Dana) 2017-07-23 11:25:19 UTC
*sigh* I knew there'd be at least one error:

"I'm undecided myself on what anaconda should've done with the existing F26 entries in /boot/grub2/grub.cfg, when upgrading."

I meant when side-installing, specifically NOT upgrading (but also not reinstalling). Anaconda doesn't do upgrades anymore, anyway, which is why having upgrade-esque logic still in there such as the rewriting of existing boot entries seems especially strange.

Comment 2 Fedora End Of Life 2018-05-03 08:39:13 UTC
This message is a reminder that Fedora 26 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 26. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '26'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 26 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 3 Fedora End Of Life 2018-05-29 12:04:15 UTC
Fedora 26 changed to end-of-life (EOL) status on 2018-05-29. Fedora 26
is no longer maintained, which means that it will not receive any
further security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 4 "FeRD" (Frank Dana) 2019-01-02 04:13:46 UTC
I honestly do not remember reopening this, and I can't pretend I've tested it with the current F29/rawhide installer, so... closing as out-of-date, I have no idea if it's still an issue. (I assume yes, but without testing can't be sure.)