Editing grub boot menu, how to save?

Colin Watson cjwatson at ubuntu.com
Fri Oct 29 17:31:01 UTC 2021


On Fri, Oct 29, 2021 at 07:00:11PM +0200, Bo Berglund wrote:
> I have found this webpage describing how to edit a grub boot menu item, but it
> does not work...
> https://docs.oracle.com/cd/E19120-01/open.solaris/819-2379/fwbme/index.html
> 
> What happens is this:
> - On the boot menu I select a line I want to edit.
> - Then I hit the letter e on the keyboard and the edit starts
> - I move the cursor to where I will add text and type away
> - Now I want to save the edit but *there is no save cmd*!!!
> 
> The help line at the bottom has other explanations like TAB for completion and
> Ctrl-x or F10 to reboot and ESC to return while discarding edits.

If what you mean by "save" is "save to disk", GRUB itself never writes
to your grub.cfg file, so there is no such facility.  Making a permanent
change to the boot menu requires editing it from a proper operating
system rather than the boot loader environment.

If what you mean by "save" is "boot the system with this change", then
you have misquoted the help text in a way that affects its meaning: it
says "Press Ctrl-x or F10 to boot", not "... to reboot".  That is,
pressing Ctrl-x or F10 will boot the system according to your edited
menu item.

> I just want to change the label so that it is unmistakable *what* is going to
> boot by that line.
> Currently my top line only says "Ubuntu" and since there are multiple Ubuntus
> this is not very user friendly!

That's a change you'd need to make from the operating system that owns
the relevant grub.cfg file.  grub.cfg is typically generated, and there
isn't a simple way to make this change: it requires editing
/etc/grub.d/10_linux, which is a shell script, working out what change
you need to make to that (probably the "simplest" approach would be to
edit the type=simple branch of the conditional code near the top of the
linux_entry function to pass different text to grub_quote), and then
running "sudo update-grub".

-- 
Colin Watson (he/him)                              [cjwatson at ubuntu.com]




More information about the ubuntu-users mailing list