EtcDefaultGrubD
Summary
Allow drop-ins to be added to /usr/share/grub/conf.d
and /etc/default/grub.d
to override the generated Grub configuration
Owner
- Name: Michel Lind
- Email: michel @ michel-slm.name
Current status
- Targeted release: Fedora Linux 40
- Last updated: 2023-12-18
- [<will be assigned by the Wrangler> devel thread]
- FESCo issue: <will be assigned by the Wrangler>
- Tracker bug: <will be assigned by the Wrangler>
- Release notes tracker: <will be assigned by the Wrangler>
Detailed Description
grub2-mkconfig
currently sources ${sysconfdir}/default/grub
for its configuration. This file is managed by RPM (as part of grub2-tools
), so in case the default needs to be changed, the user / sysadmin would need to then manually check if the configuration diverges (i.e. /etc/default/grub.rpmnew
gets created) and manually reconcile the changes. This can be impractical on a large fleet running heterogeneous hardware, where some machines might require tweaks to e.g. GRUB_CMDLINE_LINUX
.
An alternative is to script the Grub update with grubby
, but that is rather inelegant: the configuration management system will have to use grubby to check if the expected options are there, and invoke grubby again to insert the options if they are missing.
If we make grub2-mkconfig
also source from ${sysconfdir}/default/grub.d/*.cfg
, this issue is resolved: files in this directory are not tracked by RPM, and any change here will automatically be applied whenever grub2-mkconfig
is triggered, e.g. when a kernel is installed/removed.
This is already part of grub-mkconfig
in Debian and Ubuntu, so it's a low-risk approach and will allow sysadmins to use the same configuration across more distributions
Similarly, for overrides that come from the manufacturer / distribution / spins, support reading configurations from /usr/share/grub/conf.d
. Read ${sysconfdir}/default/grub
first, this second, and ${sysconfdir}/default/grub.d/*.cfg
last so the user/sysadmin has the last say.
Feedback
Benefit to Fedora
Allows Grub configuration to be easily overridden without touching RPM-managed configuration files, in a manner compatible with how this is done in Debian and Ubuntu.
Also allows other packages (e.g. for hardware enablement) or spins to override the default Grub config in a clean way.
Scope
- Proposal owners:
Change grub2-mkconfig
to also source files it find in /usr/share/grub/conf.d
and /etc/default/grub.d
Make the RPM package own these two directories.
- Other developers:
- Release engineering: #Releng issue number
- Policies and guidelines: N/A (not needed for this Change)
- Trademark approval: N/A (not needed for this Change)
- Alignment with Community Initiatives:
Upgrade/compatibility impact
N/A
How To Test
Create /etc/default/grub.d/deep_sleep.cfg
containing
GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_DEFAULT} mem_sleep_default=deep"
(or any other change you prefer)
Run grub2-mkconfig -o /boot/grub2/grub.cfg
(see grub2 docs)
User Experience
Users can customize their Grub configuration without worrying that system updates cause their configuration to fall out of sync
Dependencies
Contingency Plan
- Contingency mechanism: (What to do? Who will do it?) N/A (not a System Wide Change)
- Contingency deadline: N/A (not a System Wide Change)
- Blocks release? N/A (not a System Wide Change), Yes/No
Documentation
N/A (not a System Wide Change)