No appropriate method for modifying specfic menuentry

Bug #538884 reported by Peter Hurley on 2010-03-15
This bug affects 1 person
Affects Status Importance Assigned to Milestone
grub2 (Ubuntu)

Bug Description

Binary package hint: grub2

With grub2 (grub-pc 1.97~beta4-1ubuntu4.1) on Ubuntu 9.10, there is no appropriate mechanism for adding command-line parameters to a specific menuentry.

For example, I need to add "disable_esco=true" (bluetooth subsystem kernel parameter) to the "Ubuntu, Linux 2.6.31-20-generic" menuentry. I *do not* want this parameter for any other menuentry. Similarly, I only want 1 (recovery mode) menuentry.

I understand that I could create a custom script, say /etc/grub.d/07-custom, that would have a menuentry in it copied from /boot/grub/grub.cfg. Unfortunately, this approach has several drawbacks that make it unsuitable. First, it forces this menuentry to be before any kernel enumerated by the 10-linux script, even if it's a prior version to other kernels. Second, the script has no access to the functions available in 10-linux (like the UUID get).

I'm also aware that I could edit /boot/grub/grub.cfg directly. Unfortunately, this is worse because *there is no way* to protect the contents of grub.cfg. The kernel upgrade packages overwrite this file regardless of the file attributes (like, what if I forget that I've made custom changes to this file when I upgrade the kernel in 6 months).

Adding a kernel parameter should not be this difficult.

Colin Watson (cjwatson) wrote :

This is related to bug 439538, although it's not quite the same thing.

Changed in grub2 (Ubuntu):
importance: Undecided → Wishlist
status: New → Triaged
Colin Watson (cjwatson) wrote :

(And I agree that we ought to have something for this kind of thing that's easier than editing /etc/grub.d/10_linux, although it will take some careful design work.)

Peter Hurley (phurley) wrote :

Well, I took the most direct route that made sense to me.

I created a 07_custom script (attached) that is largely a refactored version of 10_linux, where each menuentry is built from functionality that existed in 10_linux. The only truly new addition is that kernels can be added to a no-search list so that when the modified 10_linux runs, it can exclude those kernels from created new menuentries.

Although it's hardly robust, I marked this for patch anyway.

Peter Hurley (phurley) wrote :

[Matching 10_linux]

tags: added: patch
Colin Watson (cjwatson) wrote :

Thanks for your patch. I'm unsubscribing the sponsors team from this, though, as I don't want somebody to just go ahead and upload this. We'd like to look at this upstream after the 1.99 release and design something hopefully comprehensive and workable. In the meantime I would prefer not to add temporary solutions that we might have to migrate away from later.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers