Bug 28426

Summary: Installation of M8 on multiboot system destroys grub menu and boots only one system
Product: Mageia Reporter: Herman Viaene <herman.viaene>
Component: RPM PackagesAssignee: Mageia Bug Squad <bugsquad>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: Normal CC: davidwhodgins, fri, lewyssmith, mageia, ouaurelien, zen25000
Version: 8   
Target Milestone: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Source RPM: drakx-installer-stage2-18.45-1.mga8.src.rpm CVE:
Status comment:
Attachments: bug.report.xz

Description Herman Viaene 2021-02-24 11:47:34 CET
Description of problem:
Found with M8 Ci of 22/2, not on the one of 17/2.
Installing on PeaqC10110, legacy BIOS.
There is a M7 installation present , and a M8 from the 17/2 "final". This had multiboot with grub flawlessly up to now.
Doing M8 CI installation on the existing M8 partition (this implies a formatting of this partition). Installation seems to work OK. Rebooting does not show the grub menu but boots directly to the M8 installation. Running MCC - Bootsystem does not help. Only recovery possible is running M7 CI and running Rescue system - Reinstall bootloader.
Then the multiboot is working again, but as soon as you try to do something on the MCC-Bootsystem (like changing some paramater), it blows up the grub menu.
I could in M8 MCC select the M7 partition as default, and then the system reboots directly in M7, this boot fails wit lots of timeouts and finally hangs. But powering down and up, lets finally reboot the system successfully, but directly to M7.

Version-Release number of selected component (if applicable):
M8 CI x86-64 22 feb. 2021

How reproducible:
Always
Comment 1 Martin Whitaker 2021-02-24 14:04:54 CET
Please attach /root/drakx/report.bug.xz from the M8 root partition.

CC: (none) => mageia

Comment 2 Aurelien Oudelet 2021-02-24 17:40:11 CET
Hi, thanks reporting this.

We are waiting for your /root/drakx/report.bug.xz file.

CC: (none) => ouaurelien
Keywords: (none) => NEEDINFO
Source RPM: (none) => drakx-installer-stage2-18.45-1.mga8

Comment 3 Herman Viaene 2021-02-25 11:55:03 CET
Created attachment 12389 [details]
bug.report.xz
Comment 4 Barry Jackson 2021-02-25 21:07:45 CET
Martin,
In install.sh, grub2-install has no target drive parameter which IIRC should be there in the case of legacy bios.

It's a while since I was regularly involved with grub2, but that's all I notice looking at the above report.

Barry

CC: (none) => zen25000

Comment 5 Martin Whitaker 2021-02-25 22:30:32 CET
It's actually a UEFI BIOS, so the install.sh is correct. I can't spot anything obviously wrong in the installer logs.

Herman, if you can switch back to the M8 bootloader, boot into M8 and run

  grub2-editenv list

What does that show?
Comment 6 Herman Viaene 2021-02-26 10:57:21 CET
saved_entry=gnulinux-advanced-d4d0fdcc-db47-4921-b364-3a0e9ae106f1>gnulinux-5.10.16-desktop-1.mga8-advanced-d4d0fdcc-db47-4921-b364-3a0e9ae106f1
boot_success=0
This is the second boot after getting back in the status where there is no grub menu showing. Does that matter or did you want the really first one after enforcing this situation?
Comment 7 Barry Jackson 2021-02-26 20:11:43 CET
(In reply to Martin Whitaker from comment #5)
> It's actually a UEFI BIOS, so the install.sh is correct. I can't spot
> anything obviously wrong in the installer logs.

I was looking at line 3 of the original post.
Comment 8 Martin Whitaker 2021-02-27 20:57:53 CET
@Herman, no, that shows what I wanted - even though it doesn't help. The grub.cfg file tests if boot_success = 1, and sets the boot timeout to 0 if so. I wondered if that was what you were seeing, but I guess not.

There were no changes to drakboot or grub2 between the 17-Feb and 22-Feb ISOs. The only change to the installer was in the artwork. So I really don't know what else to suggest here.

(if you just wanted a working system, I'd suggest using rEFInd instead of GRUB2, but that won't help explain what went wrong here)
Morgan Leijström 2021-02-27 21:44:44 CET

CC: (none) => fri

Comment 9 Herman Viaene 2021-02-28 09:10:08 CET
@Barry on Comment 7
Sorry to have you put on the wrong foot: it is definitely a UEFI machine.
Comment 10 Martin Whitaker 2021-02-28 10:20:27 CET
I tried to reproduce this on my Asus tablet, which has the same CPU as Herman's machine, but a different brand of 32-bit UEFI BIOS, but it did not show this fault.

Herman, do you still have the USB stick you used to do the install? If so, can we just confirm it's not a bad copy. To do that, as root

  dd if=/dev/sdX bs=1k count=4393770 | md5sum

substituting sdX with the actual device your USB stick appears as. The result should be

  ade337db66b90e5307fc8bc6bba4a3ca  -
Comment 11 Herman Viaene 2021-02-28 11:40:01 CET
# dd if=/dev/sde bs=1k count=4393770 | md5sum
4393770+0 records gelezen (read)
4393770+0 records geschreven (written)
4499220480 bytes (4,5 GB, 4,2 GiB) copied, 355,883 s, 12,6 MB/s
ade337db66b90e5307fc8bc6bba4a3ca  -
Comment 12 Barry Jackson 2021-02-28 12:33:14 CET
Hi Herman,
I would really recommend that you try https://wiki.mageia.org/en/User_talk:Barjac It takes only a few minutes to set up and has been in use here for over 5 years. Keeps all systems totally isolated.
Barry
Comment 13 Aurelien Oudelet 2021-02-28 21:55:28 CET
UEFI system:
Is the NVRAM ticklish? Joking aside, this reminds me that Ubuntu and his flavors share the same "Ubuntu" directory for /boot/EFI/ubuntu and leads to one take precedence if you update on Kubuntu, and next time you update on Xubuntu... Sometimes you get Kubuntu loading, sometimes you get Xubuntu as default entry...

So, Mageia 7 and 8 share the same name "Mageia" in /boot/EFI/ directory... this can lead to on such issue. That is strange is that a M8 installation was already done according to

(In reply to Martin Whitaker from comment #8)
> @Herman, no, that shows what I wanted - even though it doesn't help. The
> grub.cfg file tests if boot_success = 1, and sets the boot timeout to 0 if
> so. I wondered if that was what you were seeing, but I guess not.
> 
> There were no changes to drakboot or grub2 between the 17-Feb and 22-Feb
> ISOs. The only change to the installer was in the artwork. So I really don't
> know what else to suggest here.
> 
> (if you just wanted a working system, I'd suggest using rEFInd instead of
> GRUB2, but that won't help explain what went wrong here)

Better to use rEFInd in this case...

Source RPM: drakx-installer-stage2-18.45-1.mga8 => drakx-installer-stage2-18.45-1.mga8.src.rpm
Keywords: NEEDINFO => (none)

Comment 14 Lewis Smith 2021-03-02 21:47:06 CET
It is nice to see BarryJ here. That script is a tour de force.

But Herman's problem...
> Installation seems to work OK. Rebooting does not show the grub menu
> but boots directly to the M8 installation
This is totally weird, not seeing the Grub2 menu. I cannot imagine how that could be by-passed, whichever installation (M7 or M8) gets shown.
It is often useful in such problems to see what is what:
 # gdisk -l /dev/sd...
 # efibootmgr
 # efibootmgr -v
 # tree /boot/EFI/              [but trim the rEFInd & Windows bits]
 # ls -l /boot/EFI/EFI/mageia   [shows when the Mageia Grub2 b/l was done]
But all that is too late.

> Ubuntu and his flavors share the same "Ubuntu" directory for /boot/EFI/ubuntu
> and leads to one take precedence if you update on Kubuntu, and next time you
> update on Xubuntu... Sometimes you get Kubuntu loading, sometimes you get
> Xubuntu as default entry...
> Mageia 7 and 8 share the same name "Mageia" in /boot/EFI/ directory...
[/boot/EFI/EFI/]
= same problem. The most recent kernel update takes the boot. See
https://wiki.mageia.org/en/About_EFI_UEFI#Multi-booting_.26_EFI_Boot_Managers
"Multiple instances of a distribution"

For EFI, just use rEFInd. Once it is installed and *always* booted, you can wave goodbye to Grub2. It does not need any NVRAM entry other than for itself, no bootloaders in /boot/efi/EFI/ other than itself (but offers those it finds). It offers to boot (directly, with Linux stub) all systems it finds on the disc. It pays to label each filesystem e.g. MAGEIA7 because this gets shown.

I seriously think for M9 we should abandon Grub2 for EFI systems. We get bugs for it.
Comment 15 Martin Whitaker 2021-03-03 01:33:47 CET
Unfortunately rEFInd is not the answer here, as Herman's machine has a 32-bit UEFI BIOS, rEFInd doesn't support mixed-mode boot, and from bug 27484 we know that Herman can't install a 32-bit system.

Something is causing GRUB to time out instantly, but from the config files shown in the installer log, I can't see what that could be - we have the line

  GRUB_TIMEOUT=10

in /etc/defaults/grub
Comment 16 Herman Viaene 2021-03-03 09:48:12 CET
@ Martin
Where did you get that it is a 32-bit UEFI, I've never noticed something like that looking into it????
Comment 17 Herman Viaene 2021-03-03 09:52:52 CET
@ Lewis
Well, it is not too late, I can always get back to the "faulty condition" by running drakboot in the M8 system. If you think it is usefull, say so, I'll have a look at it tomorrow.
Comment 18 Martin Whitaker 2021-03-03 11:27:08 CET
@ Herman,

In the dmidecode section of the report.bug.xz it says

BIOS Information
        Vendor: Phoenix Technologies Ltd.
        Version: 1.00.12.MN IA32

IA32 indicates it's 32-bit. Also the installer has chosen to install the 32-bit grub2-efi-2.04.0-29.mga8.i586 package.

You can confirm it by

  cat /sys/firmware/efi/fw_platform_size

If you do decide to have another attempt, try adding the line

  set timeout=10

to the end of /boot/grub2/grub.cfg, just to be sure that the timeout is set correctly.
Comment 19 Herman Viaene 2021-03-03 17:04:27 CET
@ Lewis
# gdisk -l /dev/mmcblk1p1
GPT fdisk (gdisk) version 1.0.6

Warning: Partition table header claims that the size of partition table
entries is 0 bytes, but this program  supports only 128-byte entries.
Adjusting accordingly, but partition table may be garbage.
Warning: Partition table header claims that the size of partition table
entries is 3145784 bytes, but this program  supports only 128-byte entries.
Adjusting accordingly, but partition table may be garbage.
Partition table scan:
  MBR: MBR only
  BSD: not present
  APM: not present
  GPT: not present


***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory. 
***************************************************************

Disk /dev/mmcblk1p1: 1021986 sectors, 499.0 MiB
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): 4C70AB29-5EFF-4EFD-AC05-E85B31C63486
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 1021952
Partitions will be aligned on 2048-sector boundaries
Total free space is 1021919 sectors (499.0 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name

# efibootmgr
BootCurrent: 0001
Timeout: 2 seconds
BootOrder: 0001,0000,0013,0014,0015,0016,0017
Boot0000* Windows Boot Manager
Boot0001* mageia
Boot0010  Setup
Boot0011  Boot Menu
Boot0012  Diagnostic Splash
Boot0013* USB HDD:
Boot0014* eMMC Card0:
Boot0015* Internal Shell
Boot0016* USB CD:
Boot0017* USB FDD:
Boot0018* CD-ROM:

# efibootmgr -v
BootCurrent: 0001
Timeout: 2 seconds
BootOrder: 0001,0000,0013,0014,0015,0016,0017
Boot0000* Windows Boot Manager	HD(1,GPT,cfb14ee0-9db2-4b01-ad18-e4547d424ab6,0x800,0x32000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)WINDOWS.........x...B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}...5................
Boot0001* mageia	HD(1,GPT,8e5b974f-8fd8-477a-a3f3-fffc574edc8f,0x800,0xf9822)/File(\EFI\mageia\grubia32.efi)
Boot0010  Setup	FvFile(721c8b66-426c-4e86-8e99-3457c46ab0b9)
Boot0011  Boot Menu	FvFile(86488440-41bb-42c7-93ac-450fbf7766bf)
Boot0012  Diagnostic Splash	FvFile(a7d8d9a6-6ab0-4aeb-ad9d-163e59a7a380)
Boot0013* USB HDD:	VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,33e821aaaf33bc4789bd419f88c50803)
Boot0014* eMMC Card0:	VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,80145304018780439c84491cbd8274fb00)
Boot0015* Internal Shell	FvFile(c57ad6b7-0515-40a8-9d21-551652854e37)
Boot0016* USB CD:	VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,86701296aa5a7848b66cd49dd3ba6a55)
Boot0017* USB FDD:	VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,6ff015a28830b543a8b8641009461e49)
Boot0018* CD-ROM:	VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,be9d0102e211f3489efa0b983c96839b)

# tree /boot/EFI/
/boot/EFI/
└── EFI
    ├── BOOT
    └── mageia
        ├── grub.efi
        └── grubia32.efi

3 directories, 2 files
# ls -l /boot/EFI/EFI/mageia
total 208
-rwxrwxrwx 1 root root 106496 Mar  3 16:39 grub.efi*
-rwxrwxrwx 1 root root 106496 Mar  3 16:39 grubia32.efi*
Comment 20 Herman Viaene 2021-03-03 17:20:49 CET
@ Martin
Confirm it is 32.
Your last suggestion was understood as inserting this statement on the very last line of the /boot/grub2/grub.cfg file, right?
Well, it didn't have any effect at all. After running drakboot with "probe foreign OS" on in M8, the system boots straight into M8. I see the menu entries in the file /boot/grub2/grub.cfg, but on booting nada, null, niente, niks.
Comment 21 Martin Whitaker 2021-03-03 17:30:03 CET
(In reply to Herman Viaene from comment #20)
> Your last suggestion was understood as inserting this statement on the very
> last line of the /boot/grub2/grub.cfg file, right?

Yes. To have an effect, you need to do that after running drakboot (because /boot/grub2/grub.cfg is rewritten by drakboot).
Comment 22 Herman Viaene 2021-03-03 17:59:28 CET
That's what I did. I was wondering whether this statement would do any good in the commands list in drakboot. I let it as it was, let drakboot do what I usually does here, then checked th grubcfg file for the menu entries and added the statement. No effect on the M8 boot at all.
had to run the M7 Rescue again to get the proper grub again.
Comment 23 Lewis Smith 2021-03-07 22:30:19 CET
(In reply to Martin Whitaker from comment #15)
> Unfortunately rEFInd is not the answer here, as Herman's machine has a
> 32-bit UEFI BIOS, rEFInd doesn't support mixed-mode boot
Another 64-bit box with 32-bit EFI? Pains. Thanks for this info about rEFInd, important to know. So 32-bit EFI needs Grub2, gloom. I merely repeated your c8!

Thanks for the command outputs, Herman, even though they have not helped. The identical sizes of:
-rwxrwxrwx 1 root root 106496 Mar  3 16:39 grub.efi*
-rwxrwxrwx 1 root root 106496 Mar  3 16:39 grubia32.efi*
look suspicous. Martin?

I am puzzled why this 64-bit apparently EFI system has "legacy BIOS" and an MBR disc (if that is what it is). No wonder gdisk was upset; this would have been more appropriate:
 # fdisk -l /dev/mmcblk1p1
but that is academic.

> Found with M8 Ci of 22/2, not on the one of 17/2.
> There is a M7 installation present , and a M8 from the 17/2 "final".
> This had multiboot with grub flawlessly up to now.
Are we drifting away from this important fact?
Martin said "There were no changes to drakboot or grub2 between the 17-Feb and 22-Feb ISOs", but *something* must have changed. Perhaps an unconscious difference in the installation of the two. It is common to see "Nothing has changed" then after a lot of painful diagnosis, there is always something, somewhere.

Have you tried (you may have, in which case sorry), for example, from either running Mageia,
either # update-grub2 ; or if that does not help,  # grub2-install

CC: (none) => lewyssmith

Comment 24 Dave Hodgins 2021-03-08 00:13:52 CET
(In reply to Lewis Smith from comment #23)
> I am puzzled why this 64-bit apparently EFI system has "legacy BIOS" and an
> MBR disc (if that is what it is). No wonder gdisk was upset; this would have

Despite a lot of public misinformation, efi does not require gpt and gpt
does not require efi.

efi firmware should work with either gpt or mbr partitioned drives. Same with
bios firmware systems as well as uefi firmware running in either uefi mode or
bios legacy emulation mode. There are some faulty uefi systems where this is
not true and gpt is required, but the systems that follow the uefi standards
do support mbr partitioning.

The system will appear as legacy bios in a uefi firmware system if Compatibility
Support Module (CSM) has been activated in the uefi setup.

CC: (none) => davidwhodgins

Comment 25 Aurelien Oudelet 2021-03-19 19:17:03 CET
Bogus UEFI?
Comment 26 Lewis Smith 2021-03-19 20:11:04 CET
(In reply to Dave Hodgins from comment #24)
> (In reply to Lewis Smith from comment #23)
> Despite a lot of public misinformation, efi does not require gpt and gpt
> does not require efi.
This I knew: https://wiki.mageia.org/en/About_EFI_UEFI
"GPT is independent of EFI. Some EFI systems require GPT (or they'll automatically switch to CSM mode). Other EFI systems are ok with MBR partition tables."

(In reply to Aurelien Oudelet from comment #25)
> Bogus UEFI?
This does not explain the *change* Herman suffered in comment 0.

@Herman
Where are you with this?
Have you been able to get into either M7 or M8 system and run 'update-grub2' or 'grub2-install'?
Aurelien Oudelet 2021-04-06 19:51:13 CEST

Status: NEW => NEEDINFO

Comment 27 Herman Viaene 2021-04-07 10:15:40 CEST
Run update-grub2 on M7 and that picked up the M8  installation. Rebooted and, choose M8 and niw editing from there.
So this workaround seems to do the trick.
Comment 28 Lewis Smith 2021-04-08 21:32:22 CEST
Thanks for the feedback.
Can we close this?
Comment 29 Dave Hodgins 2021-04-08 21:44:00 CEST
Yeah. Closing as works for me. Feel free to reopen if a way to reproduce it
for others can be found using only Mageia tools to create the issue.

Resolution: (none) => WORKSFORME
Status: NEEDINFO => RESOLVED