GrubConflictDetection

Differences between revisions 1 and 10 (spanning 9 versions)
Revision 1 as of 2007-10-30 19:01:33
Size: 3336
Editor: 12
Comment: first half of the draft
Revision 10 as of 2007-11-22 12:00:42
Size: 6378
Editor: 82-69-40-219
Comment:
Deletions are marked like this. Additions are marked like this.
Line 24: Line 24:
 1. Trang knows nothing about kernels or bootloaders, and has never touched /boot/grub/menu.lst. A newer kernel becomes available; it should be installed on her system automatically and become the default.

 1. Lawrence is new to Ubuntu, but has used grub before on other systems. He edits /boot/grub/menu.lst by hand to change the boot options for his kernel, and a kernel update later becomes available. His changes to the boot options should not be overwritten silently.

 1. Barb is an experienced Ubuntu user who has read the comments in the Ubuntu /boot/grub/menu.lst and used the `kopt=` setting to configure her boot options. She expects that this setting will continue to be applied for newly-installed kernel packages.
Line 25: Line 31:

 * grub2 will not be a viable solution for 8.04 LTS.
 * keeping magic comments in /boot/grub/menu.lst is better than keeping them in an external file, since existing widely-available documentation will talk about /boot/grub/menu.lst rather than said hypothetical external file
Line 28: Line 37:
You can have subsections that better describe specific parts of the issue. update-grub should manage the auto-generated section of /boot/grub/menu.lst using ucf. This allows storing a baseline for the file contents after each automatic update, so that with the next update the user can make an informed decision about the proposed changes to boot options.

This does not eliminate the presence of magic comments or ensure that changes to this file by the user can be reliably merged, however it does ensure that local changes will not be silently overwritten.
Line 32: Line 43:
This section should describe a plan of action (the "how") to implement the changes discussed. Could include subsections like:
Line 36: Line 45:
Should cover changes required to the UI, or specific UI that is required to implement this This change introduces a new debconf question. This will not be displayed on systems with the default configuration, but must be shown to users when upgrading kernels if they have modified their menu.lst outside the constraints of the existing auto-update support.
Line 40: Line 49:
Code changes should include an overview of what needs to change, and in some cases even the specific details.  * update ucf to support specifying an alternate debconf template to use for the user prompt.
 * modify update-grub to store the autogenerated portion of the boot config with ucf, so that local changes can be detected and handled by prompting the user to resolve conflicts.
 * once the conflict is resolved, /boot/grub/menu.lst is updated with the result.
 * two passes will be required, first to verify whether the magic comments have changed relative to the previous invocation and incorporate any changes if so, and second to update the list of kernels presently available.
Line 44: Line 56:
Include:
 * data migration, if any
 * redirects from old URLs to new ones, if any
 * how users will be pointed to the new way of doing things, if necessary.
This specification imposes no migration requirements on the user.
Line 55: Line 64:
== Outstanding Issues == == Future Work ==
Line 57: Line 66:
This should highlight any issues that should be addressed in further specifications, and not problems with the specification itself; since any specification with problems cannot be approved.  * The /boot/grub/menu.lst file will still contain functional comments, whose contents will be duplicated multiple times in the bootloader config. A future version of update-grub may attempt to heuristically detect these from the existing boot stanzas, for example:
  * Hand-edited kernel options should be intelligently copied to the configuration for newly-installed kernels.
 * This change does not provide any hooks for external packages, such as apparmor or selinux, which may need to update the kernel boot-time options. This may be implemented separately in update-grub.
Line 59: Line 70:
== BoF agenda and discussion == == Comments ==
Line 61: Line 72:
Use this section to take notes during the BoF; if you keep it in the approved spec, use it for summarising what was discussed and note any options that were rejected. I can't really understand why to use update-grub at all. It's crap and the first thing I disable (in /etc/kernel-img.conf) after installing a new Ubuntu machine.
 * What use cases does using update-grub solve that the old-days method of using /vmlinuz and /vmlinuz.old symlinks to refer to the current and old kernel does not?
 (unless having 12 old kernels listed in your menu.lst counts as a use-case:-))
 * If a tool to update menu.lst is really needed (it is?), why not a simple script which update it in place, without all those crappy comments-which-actually-are-directives?
 * IMHO update-grub is the cause of the problems the spec tries to face, not their solution.
--RobePisc

''We want to make minimal changes to fix the worst problems in Ubuntu 8.04. A more complete re-engineering does make sense at some point in the future (perhaps in conjunction with grub2), but right now, taking the whole system out back and shaking it down is not on the table. --ColinWatson''

Please check the status of this specification in Launchpad before editing it. If it is Approved, contact the Assignee or another knowledgeable person before making changes.

Summary

/boot/grub/menu.lst is the single file where all boot-time options are configured for installed i386 and amd64 systems. Ubuntu must support package-initiated updates (for installation of new kernel packages) without silently discarding user-initiated config changes.

Release Note

User-modified grub menu.lst files will trigger conflict-resolution dialog on kernel upgrade: previously, if a user edited the bootloader configuration in /boot/grub/menu.lst directly, these changes might be silently lost when a new kernel was installed. The new version of the grub package detects when such changes have been made, and will ask users to resolve this conflict manually when a kernel package is installed.

Rationale

/boot/grub/menu.lst is the canonical upstream location where changes are made to the configuration for the grub bootloader. Third-party documentation and how-tos will document that users should edit this file in order to make changes to their boot configuration. However, the current behavior of update-grub is to replace the kernel boot stanzas with stanzas auto-generated from magic comments stored at the top of this file. This will overwrite configuration changes made by the user, and may result in a non-working bootloader configuration or a non-working kernel configuration.

This is reported as [https://bugs.launchpad.net/ubuntu/+source/grub/+bug/103297 bug #103297] against grub.

Use Cases

  1. Trang knows nothing about kernels or bootloaders, and has never touched /boot/grub/menu.lst. A newer kernel becomes available; it should be installed on her system automatically and become the default.
  2. Lawrence is new to Ubuntu, but has used grub before on other systems. He edits /boot/grub/menu.lst by hand to change the boot options for his kernel, and a kernel update later becomes available. His changes to the boot options should not be overwritten silently.
  3. Barb is an experienced Ubuntu user who has read the comments in the Ubuntu /boot/grub/menu.lst and used the kopt= setting to configure her boot options. She expects that this setting will continue to be applied for newly-installed kernel packages.

Assumptions

  • grub2 will not be a viable solution for 8.04 LTS.
  • keeping magic comments in /boot/grub/menu.lst is better than keeping them in an external file, since existing widely-available documentation will talk about /boot/grub/menu.lst rather than said hypothetical external file

Design

update-grub should manage the auto-generated section of /boot/grub/menu.lst using ucf. This allows storing a baseline for the file contents after each automatic update, so that with the next update the user can make an informed decision about the proposed changes to boot options.

This does not eliminate the presence of magic comments or ensure that changes to this file by the user can be reliably merged, however it does ensure that local changes will not be silently overwritten.

Implementation

UI Changes

This change introduces a new debconf question. This will not be displayed on systems with the default configuration, but must be shown to users when upgrading kernels if they have modified their menu.lst outside the constraints of the existing auto-update support.

Code Changes

  • update ucf to support specifying an alternate debconf template to use for the user prompt.
  • modify update-grub to store the autogenerated portion of the boot config with ucf, so that local changes can be detected and handled by prompting the user to resolve conflicts.
  • once the conflict is resolved, /boot/grub/menu.lst is updated with the result.
  • two passes will be required, first to verify whether the magic comments have changed relative to the previous invocation and incorporate any changes if so, and second to update the list of kernels presently available.

Migration

This specification imposes no migration requirements on the user.

Test/Demo Plan

It's important that we are able to test new features, and demonstrate them to users. Use this section to describe a short plan that anybody can follow that demonstrates the feature is working. This can then be used during CD testing, and to show off after release.

This need not be added or completed until the specification is nearing beta.

Future Work

  • The /boot/grub/menu.lst file will still contain functional comments, whose contents will be duplicated multiple times in the bootloader config. A future version of update-grub may attempt to heuristically detect these from the existing boot stanzas, for example:
    • Hand-edited kernel options should be intelligently copied to the configuration for newly-installed kernels.
  • This change does not provide any hooks for external packages, such as apparmor or selinux, which may need to update the kernel boot-time options. This may be implemented separately in update-grub.

Comments

I can't really understand why to use update-grub at all. It's crap and the first thing I disable (in /etc/kernel-img.conf) after installing a new Ubuntu machine.

  • What use cases does using update-grub solve that the old-days method of using /vmlinuz and /vmlinuz.old symlinks to refer to the current and old kernel does not? (unless having 12 old kernels listed in your menu.lst counts as a use-case:-))
  • If a tool to update menu.lst is really needed (it is?), why not a simple script which update it in place, without all those crappy comments-which-actually-are-directives?
  • IMHO update-grub is the cause of the problems the spec tries to face, not their solution.

--RobePisc

We want to make minimal changes to fix the worst problems in Ubuntu 8.04. A more complete re-engineering does make sense at some point in the future (perhaps in conjunction with grub2), but right now, taking the whole system out back and shaking it down is not on the table. --ColinWatson


CategorySpec

GrubConflictDetection (last edited 2008-08-06 16:30:05 by localhost)