Bug 18560 - MCC->boot->Set up boot system fails to set correct default menu entry for grub2
Summary: MCC->boot->Set up boot system fails to set correct default menu entry for grub2
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: All Linux
Priority: Normal major
Target Milestone: ---
Assignee: Mageia Bug Squad
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 416
  Show dependency treegraph
 
Reported: 2016-05-27 16:36 CEST by Barry Jackson
Modified: 2017-12-30 09:51 CET (History)
2 users (show)

See Also:
Source RPM: drakxtools-curses-17.30-1
CVE:
Status comment:


Attachments
grub2: set GRUB_DEFAULT (1.07 KB, patch)
2016-05-27 17:07 CEST, Thierry Vignaud
Details | Diff
save menu ID instead of menu label (mga#XXXX) (1.51 KB, patch)
2016-05-27 17:08 CEST, Thierry Vignaud
Details | Diff
save menu ID instead of menu label (mga#18560) (2.39 KB, patch)
2016-06-22 02:12 CEST, Thierry Vignaud
Details | Diff

Description Barry Jackson 2016-05-27 16:36:55 CEST
Description of problem:
Testing this in x86_64 UEFI system:
It currently puts an entry in /boot/grub2/grubenv to be used IIUC when
GRUB_DEFAULT=saved.

From my testing it appears not to add GRUB_DEFAULT=saved to /etc/default/grub if it is not already there.

Doing this manually and running update-grub2 throws a warning and the new
default fails to work.

[baz@jackodesktop grub2]$ update-grub2
Password: 
Generating grub configuration file ...
Found theme: /boot/grub2/themes/maggy/theme.txt
Found linux image: /boot/vmlinuz-4.6.0-desktop-1.mga6
-------------snip-------------           
Warning: Please don't use old title âMageia (4.6.0-desktop-1.mga6) 6 (on
/dev/sda5)â for GRUB_DEFAULT, use âAdvanced options for Mageia 6 (6) (on
/dev/sda5)>Mageia (4.6.0-desktop-1.mga6) 6 (on /dev/sda5)â (for versions before
2.00) or
âgnulinux-advanced-18c8d8d4-dee6-4219-9dbf-a96d439ea76e>gnulinux---18c8d8d4-dee6-4219-9dbf-a96d439ea76eâ
(for 2.00 or later)                                                          
done

The head of /boot/grub2/grubenv is:

# GRUB Environment Block
saved_entry=Mageia (4.6.0-desktop-1.mga6) 6 (on /dev/sda5)
##########################################################---snip

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
Comment 1 Charles Edwards 2016-05-27 17:03:59 CEST
If you use GRUB_DEFAULT=saved you must also add the line GRUB_SAVEDEFAULT=true .

Both lines must be present in /etc/default/grub or "save" will not work.

CC: (none) => cae

Comment 2 Barry Jackson 2016-05-27 17:06:19 CEST
(In reply to Charles Edwards from comment #1)
> If you use GRUB_DEFAULT=saved you must also add the line
> GRUB_SAVEDEFAULT=true .
> 
> Both lines must be present in /etc/default/grub or "save" will not work.

Thanks for the reminder ;)
Comment 3 Thierry Vignaud 2016-05-27 17:07:58 CEST
Created attachment 7867 [details]
grub2: set GRUB_DEFAULT

CC: (none) => thierry.vignaud

Comment 4 Thierry Vignaud 2016-05-27 17:08:20 CEST
Created attachment 7868 [details]
save menu ID instead of menu label (mga#XXXX)

both patches are totally untested
Thierry Vignaud 2016-05-27 17:08:35 CEST

Blocks: (none) => 416

Comment 5 Barry Jackson 2016-05-27 17:34:29 CEST
Does the second patch replace the first, or are they both required?

with only patch 2 I still see

Warning: Please don't use old title âMageia (4.6.0-desktop-1.mga6) 6 (on /dev/sda5)â for GRUB_DEFAULT, use âAdvanced options for Mageia 6 (6) (on /dev/sda5)>Mageia (4.6.0-desktop-1.mga6) 6 (on /dev/sda5)â (for versions before 2.00) or âgnulinux-advanced-18c8d8d4-dee6-4219-9dbf-a96d439ea76e>gnulinux---18c8d8d4-dee6-4219-9dbf-a96d439ea76eâ (for 2.00 or later)
Comment 6 Barry Jackson 2016-05-27 18:30:39 CEST
OK looking at them they are both required and with both applied the entries in /etc/default/grub look OK (I removed them before testing and they were re-inserted).

The entry in grubenv looks the same:
saved_entry=Mageia (4.6.0-desktop-1.mga6) 6 (on /dev/sda5)
...and the Warning is the same on running update-grub2.

On booting an error message appears in the grub terminal window which I will photograph on next boot.
Thierry Vignaud 2016-05-31 11:09:49 CEST

See Also: (none) => https://bugs.mageia.org/show_bug.cgi?id=16059

Comment 7 Charles Edwards 2016-06-13 18:59:48 CEST
For Barry in comment 6 if this is still an issue.

Because it is in a sub menu the correct entry for Mageia (4.6.0-desktop-1.mga6)
by label would be:
GRUB_DEFAULT="Advanced options for Mageia>Mageia (4.6.0-desktop-1.mga6) 6" 
This can also be done numerically:
GRUB_DEFAULT="2>line-number-desired-kernel-entry" 

In either case the > IS IMPORTANT
and 
GRUB_SAVEDEFAULT="false" also needs to be used.


With the increase in the number Mga6 user who will have to use grub2 it would be beneficial if grub-customizer were added as, at least, a Recommends to grub-common.
It will greatly simplify the process for the average user.
Comment 8 Thierry Vignaud 2016-06-22 02:12:28 CEST
Created attachment 8048 [details]
save menu ID instead of menu label (mga#18560)

more work but our grub2 doesn't support selecting menu entry by ids

Attachment 7868 is obsolete: 0 => 1

Comment 9 Charles Edwards 2016-06-22 02:47:57 CEST
Thierry does your statement mean that with the patch applied that ID will be used
instead of Label?
Or will Both be usable?
Comment 10 Mageia Robot 2016-06-22 02:48:23 CEST
commit 5d85cc4dba16dbf5cd219c21d47677e4b8ad3df8
Author: Thierry Vignaud <thierry.vignaud@...>
Date:   Wed Jun 22 02:09:34 2016 +0200

    fix setting default entry when in a submenu
    
    default entry must be selected by its full path (mga#18560)
    eg: "submenu1>submenu2>title":
    
    See http://www.gnu.org/software/grub/manual/html_node/default.html#default
---
 Commit Link:
   http://gitweb.mageia.org/software/drakx/commit/?id=5d85cc4dba16dbf5cd219c21d47677e4b8ad3df8
Comment 11 Thierry Vignaud 2016-06-22 02:52:20 CEST
(In reply to Charles Edwards from comment #9)
That was not working work in progress.

Closing anyway

Status: NEW => RESOLVED
Resolution: (none) => FIXED

Marja Van Waes 2017-12-30 09:51:15 CET

See Also: (none) => https://bugs.mageia.org/show_bug.cgi?id=22274


Note You need to log in before you can comment on or make changes to this bug.