-
Notifications
You must be signed in to change notification settings - Fork 359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bootloader: rely on unified GRUB configuration for UEFI and BIOS #5996
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ | |
from pyanaconda.core import util | ||
from pyanaconda.core.configuration.anaconda import conf | ||
from pyanaconda.core.i18n import _ | ||
from pyanaconda.core.path import open_with_perm | ||
from pyanaconda.core.path import join_paths, open_with_perm | ||
from pyanaconda.core.product import get_product_name | ||
|
||
from pyanaconda.anaconda_loggers import get_module_logger | ||
|
@@ -363,14 +363,23 @@ def write_config(self): | |
if rc: | ||
log.error("failed to set menu_auto_hide=1") | ||
|
||
# now tell grub2 to generate the main configuration file | ||
rc = util.execWithRedirect( | ||
"grub2-mkconfig", | ||
["-o", self.config_file], | ||
root=conf.target.system_root | ||
) | ||
# Executes the grub2-common posttrans script to generate grub config files | ||
# This should be autohandled by grub2-common, but posttrans scriptlets | ||
# in live image scenarios are not triggered. | ||
# FIXME: https://bugzilla.redhat.com/show_bug.cgi?id=2327644 | ||
|
||
# Drop the first line as it's the posttrans scriptlet header | ||
script = util.execWithCapture("rpm", ["-q", "--scripts", "grub2-common"], root=conf.target.system_root).splitlines()[1:] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will work only as long as the rootfs deployed by the payload:
Also I'm not sure about immutable system like ostree or bootc/image mode. Eq. if they even have scriptlets like this or if they can/expect changes being done in chroot. Lastly I wonder about ordering or re-entrancy. Eq. can it depend on some other scritplet being called & can it survive being called more times (or do we need to make sure not to call it twice on regular RPM installs). |
||
script = "\n".join(script) | ||
|
||
# Write the script to a temporary file in the chroot | ||
with open(join_paths(conf.target.system_root, "/tmp/grub2-posttrans.sh"), "w") as f: | ||
f.write(script) | ||
|
||
# Run the script in the chroot | ||
rc = util.execWithRedirect("/bin/sh", ["/tmp/grub2-posttrans.sh"], root=conf.target.system_root) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the main issue with this would be that is basically a black box & implementation detail of the GRUB 2 package - eq. some changes unless properly coordinated with us could potentially break things due to changes in GRUB, its packaging or Anaconda. Also unlike a more widely used tool, it would be IMHO quite hard (to impossible) to test, especially outside of this very specific environment. In comparison, the proposed "shared script" solution could be called by this scriplet (making it much simpler), could be versions (with both GRUB 2 & Anaconda being able to see & control the installed version) as well as presumably being much easier to test a debug separately ("this folder is now /boot, do your thing"). |
||
if rc: | ||
raise BootLoaderError("failed to write boot loader configuration") | ||
raise BootLoaderError("grub2-common posttrans script failed") | ||
|
||
# | ||
# installation | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be in install-env-deps (eq. the package that pulls in dependencies needed to do a a full installation run) as otherwise it could get pulled in when just the Anaconda package gets installed, say a an
initial-setup
dependency.IIRC some people potentially use something else than grub (systemd-boot ? at least there seem to be enough users to complain on fedora-devel when its broken by grub specifics). If it adds post-transaction scriptlets, I guess it could actively break something.