From Fedora Project Wiki

Revision as of 20:27, 18 December 2023 by Salimma (talk | contribs) (→‎Benefit to Fedora: add use case)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Comments and Explanations
The page source contains comments providing guidance to fill out each section. They are invisible when viewing this page. To read it, choose the "view source" link.
Copy the source to a new page before making changes! DO NOT EDIT THIS TEMPLATE FOR YOUR CHANGE PROPOSAL.
Guidance
For details on how to fill out this form, see the documentation.
Report issues
To report an issue with this template, file an issue in the pgm_docs repo.


EtcDefaultGrubD

This is a proposed Change for Fedora Linux.
This document represents a proposed Change. As part of the Changes process, proposals are publicly announced in order to receive community feedback. This proposal will only be implemented if approved by the Fedora Engineering Steering Committee.

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


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:
  • 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)

Release Notes